mirror of
https://github.com/KeymonSoft/jRDC-Multi.git
synced 2026-04-17 21:06:24 +00:00
- VERSION 5.08.30
- Se cambiaron los 4 handlers de B4A a uno solo que toma el DB de la ruta automáticamente. - Se agregaron validaciones del numero de parametros y si el query no los requiere o se dan de mas o de menos, manda un error especificando eso, ya no se reciben errores directos de la base de datos, esto fue tanto para B4A como para JSON. - Se modificó el Readme.md para incluir todos estos cambios.
This commit is contained in:
@@ -19,7 +19,7 @@ Public Sub Initialize(DB As String)
|
||||
' Log("RDCConnector Initialize")
|
||||
If DB.EqualsIgnoreCase("DB1") Then DB = "" 'Esto para el config.properties por default
|
||||
Dim config As Map = LoadConfigMap(DB)
|
||||
Log($"Inicializamos ${DB}, usuario: ${config.Get("User")} - Puerto: ${config.Get("ServerPort")}"$)
|
||||
Log($"Inicializamos ${DB}, usuario: ${config.Get("User")}"$)
|
||||
pool.Initialize(config.Get("DriverClass"), config.Get("JdbcUrl"), config.Get("User"), config.Get("Password"))
|
||||
Dim jo As JavaObject = pool
|
||||
jo.RunMethod("setMaxPoolSize", Array(5)) 'number of concurrent connections
|
||||
@@ -72,7 +72,7 @@ Public Sub Initialize(DB As String)
|
||||
' Dim jo2 As JavaObject = pool
|
||||
' Log(jo2.GetField("END_TO_END_CLIENTID_INDEX"))
|
||||
|
||||
' jo.RunMethod("setPreferredTestQuery", Array("BEGIN DBMS_SESSION.SET_IDENTIFIER('jRDC_Multi'); END;"))
|
||||
' jo.RunMethod("setPreferredTestQuery", Array("BEGIN DBMS_SESSION.SET_IDENTIFIER('whatever'); END;"))
|
||||
' jo.RunMethod("setPreferredTestQuery", Array("alter session set current_schema=MYSCHEMA"))
|
||||
' jo2.RunMethod("setClientIdentifier",Array( "MAX")) ' Tiempo máximo de inactividad antes de cerrar una conexión
|
||||
#if DEBUG
|
||||
@@ -88,32 +88,33 @@ End Sub
|
||||
Private Sub LoadConfigMap(DB As String) As Map
|
||||
Private DBX As String = ""
|
||||
If DB <> "" Then DBX = "." & DB
|
||||
Log("============= LoadConfigMap =============")
|
||||
Log($""========= Leemos el config${DBX}.properties ========="$)
|
||||
Log("===========================================")
|
||||
Log($"Leemos el config${DBX}.properties"$)
|
||||
Return File.ReadMap("./", "config" & DBX & ".properties")
|
||||
End Sub
|
||||
|
||||
Public Sub GetCommand(DB As String, Key As String) As String
|
||||
' Log("==== GetCommand ====")
|
||||
' Log("|" & Key & "|")
|
||||
Log("==== GetCommand ====")
|
||||
' Log("|" & DB & "|" & Key & "|")
|
||||
commands = Main.commandsMap.get(DB).As(Map)
|
||||
If commands.ContainsKey("sql." & Key) = False Then
|
||||
Log("*** Command not found: " & Key)
|
||||
End If
|
||||
' Log(commands.ContainsKey("sql." & Key))
|
||||
Log("========= Traemos """ & Key & """ ==========")
|
||||
Log(">>>>>> " & commands.Get("sql." & Key) & " <<<<<<")
|
||||
Return commands.Get("sql." & Key)
|
||||
End Sub
|
||||
|
||||
Public Sub GetConnection(DB As String) As SQL
|
||||
Log("============= GetConnection ============= ")
|
||||
Log("==== GetConnection ==== ")
|
||||
If DB.EqualsIgnoreCase("DB1") Then DB = "" 'Esto para el config.properties or default
|
||||
If DebugQueries Then LoadSQLCommands(LoadConfigMap(DB), DB)
|
||||
' Log("regresamos 0")
|
||||
Return pool.GetConnection
|
||||
End Sub
|
||||
|
||||
Private Sub LoadSQLCommands(config2 As Map, DB As String)
|
||||
Log("==== LoadSQLCommands ==== ")
|
||||
Log($"Cargamos los comandos desde el config.${DB}.properties"$)
|
||||
Dim newCommands As Map
|
||||
newCommands.Initialize
|
||||
@@ -123,7 +124,6 @@ Private Sub LoadSQLCommands(config2 As Map, DB As String)
|
||||
End If
|
||||
Next
|
||||
commands = newCommands
|
||||
' Log(commands)
|
||||
' Log($"Inicializado: ${DB} "$ & Main.commandsMap.IsInitialized)
|
||||
Main.commandsMap.Put(DB, commands)
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user