- VERSION 4.11.14

- Se agregó el parametro "setMaxPoolSize=5" para que solo genere 5 conexiones a la base de datos, antes generaba 15.
- Se quitaron lineas previamente comentadas.
This commit is contained in:
Jose Alberto Guerra Ugalde
2024-11-15 03:36:21 -06:00
parent a801577b6f
commit 45e4336d3c
7 changed files with 81 additions and 48 deletions

View File

@@ -23,34 +23,33 @@ End Sub
Sub Handle(req As ServletRequest, resp As ServletResponse)
Log("********************* DB1 ********************")
Dim start As Long = DateTime.Now
Dim q As String
Dim q As String
Dim in As InputStream = req.InputStream
Dim method As String = req.GetParameter("method")
Connector = Main.Connectors.Get("DB1")
Dim con As SQL
Try
con = Connector.GetConnection("DB1")
' con = Main.rdcConnectorDB1.GetConnection("")
If method = "query2" Then
q = ExecuteQuery2("DB1", con, in, resp)
'#if VERSION1
'#if VERSION1
Else if method = "query" Then
in = cs.WrapInputStream(in, "gzip")
q = ExecuteQuery("DB1", con, in, resp)
Else if method = "batch" Then
in = cs.WrapInputStream(in, "gzip")
q = ExecuteBatch("DB1", con, in, resp)
'#end if
'#end if
Else if method = "batch2" Then
q = ExecuteBatch2("DB1", con, in, resp)
Else
Log("Unknown method: " & method)
resp.SendError(500, "unknown method")
End If
Catch
Log(LastException)
resp.SendError(500, LastException.Message)
End Try
Catch
Log(LastException)
resp.SendError(500, LastException.Message)
End Try
If con <> Null And con.IsInitialized Then con.Close
Log($"Command: ${q}, took: ${DateTime.Now - start}ms, client=${req.RemoteAddress}"$)
End Sub
@@ -154,11 +153,11 @@ Private Sub ExecuteBatch(DB As String, con As SQL, in As InputStream, resp As Se
WriteInt(r, out)
Next
out.Close
Catch
con.Rollback
Log(LastException)
resp.SendError(500, LastException.Message)
End Try
Catch
con.Rollback
Log(LastException)
resp.SendError(500, LastException.Message)
End Try
Return $"batch (size=${numberOfStatements})"$
End Sub
@@ -237,7 +236,7 @@ Private Sub WriteObject(o As Object, out As OutputStream)
Else If GetType(o) = "[B" Then
data = o
out.WriteBytes(Array As Byte(T_BLOB), 0, 1)
WriteInt(data.Length, out)
WriteInt(data.Length, out)
Else 'If o Is String Then (treat all other values as string)
out.WriteBytes(Array As Byte(T_STRING), 0, 1)
data = bc.StringToBytes(o, "UTF8")