Sub CreateDatabase
Dim s As String
DBUtils.DropTable(mySQL,"IDs")
'IDs
Dim m As Map
m.Initialize
m.Put("TableID",DBUtils.DB_INTEGER)
m.Put("Details",DBUtils.DB_BLOB)
DBUtils.CreateTable(mySQL,"IDs",m,"TableID")
'Insert some IDs
ID.Initialize
ID.TableID = 2
ID.TableName = "Fares"
ID.LastID = 23
s = "INSERT INTO IDs (TableID,Details) VALUES(1,'" & ID & "')"
mySQL.ExecNonQuery(s)
End Sub
Sub bReadID_Click
Dim myid As tID
Dim m As Map
m.Initialize
m = DBUtils.ExecuteMap(mySQL,"Select TableID, Details FROM IDs",Null)
Dim m1 As String
m1 = m.Get("details")
'strip off the surrounding []s
m1 = m1.SubString2(1,m1.Length-1)
Dim com() As String
com = Regex.Split(",",m1)
myid.Initialize
Dim i As Int
For i=0 To com.Length-1
Dim s1() As String
If com(i).Contains("TableID") Then
s1 = Regex.Split("=",com(i))
myid.TableID = s1(1)
End If
If com(i).Contains("TableName") Then
s1 = Regex.Split("=",com(i))
myid.TableName = s1(1)
End If
If com(i).Contains("LastID") Then
s1 = Regex.Split("=",com(i))
myid.LastID = s1(1)
End If
If com(i).Contains("AddingNew") Then
s1 = Regex.Split("=",com(i))
myid.AddingNew = (s1(1)="true")
End If
Next
Msgbox(myid.TableID & " : " & myid.TableName & " : " & myid.LastID & " : " & myid.AddingNew ,"")
End Sub