Sub Class_Globals
Public mySQL As SD_SQL
Private recordSet As SD_ResultSet
Dim UserName As String
Dim Password As String
Dim Driver As String = "org.mariadb.jdbc.Driver"
Dim SQLServer As String = "127.0.0.1"
Dim LastRecord As Double
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(CallbackModule As Object, EventName As String)
mySQL.Initialize(CallbackModule,EventName)
recordSet.Initialize("")
End Sub
Public Sub connect(DataBase As String)
Log($"jdbc:mariadb://${SQLServer}/${DataBase}"$)
Try
mySQL.Connect(Driver, $"jdbc:mariadb://${SQLServer}/${DataBase}"$, UserName, Password)
ProgressDialogShow("connecting SQL")
Wait For SQL_Ready(Success As Boolean)
Catch
Log(LastException)
End Try
End Sub
Public Sub selectSQL(sqlStr As String)
Log("sql execute")
recordSet = mySQL.ExecQuery(sqlStr)
recordSet.last
LastRecord = recordSet.GetRow
recordSet.First
End Sub
Public Sub moveNext
Return recordSet.NextRow
End Sub
Public Sub movePrevious
Return recordSet.PreviousRow
End Sub
Public Sub moveFirst
recordSet.First
End Sub
Public Sub moveLast
recordSet.last
End Sub
Public Sub RowCount
Log(recordSet.relativeRow(-1))
End Sub
Public Sub eof
Return IIf(recordSet.GetRow = LastRecord, True, False)
End Sub
Public Sub bof
Return IIf(recordSet.GetRow = 1 Or recordSet.GetRow = 0, True, False)
End Sub
Public Sub GetString(Field As String)
Return recordSet.GetString(Field)
End Sub
Public Sub GetInt(Field As String)
Return recordSet.GetInt(Field)
End Sub
Public Sub GetDouble(Field As String)
Return recordSet.GetDouble(Field)
End Sub
Public Sub GetRow As Int
Return recordSet.GetRow
End Sub
Sub mySQL_Ready (Success As Boolean)
Log("sql ready")
If Success Then
Log("MSSQL_Ready")
End If
Log(Success)
End Sub