' This method can create a database on both the Server and Browser side
public Sub OPENDATABASEWait(DatabaseName As String)
Dim Query As String = $"CREATE TABLE IF NOT EXISTS tRecords (uuid TEXT PRIMARY KEY, linkuuid TEXT, recordtype INTEGER NOT NULL, created TEXT NOT NULL, lastmodified TEXT NOT NULL, status INTEGER NOT NULL, syncstatus INTEGER NOT NULL, syncvalue TEXT DEFAULT '')"$
#if B4J
SQL.InitializeSQLite(File.DirApp, DatabaseName, True)
SQL.ExecNonQuery(Query)
#else
SQL.OpenWait("SQL", DatabaseName)
SQL.ExecuteWait(Query, Null)
#End If
End Sub
' This method can insert a record on both the Server and Browser side
public Sub INSERTRecordWait(Rec as SHAREDSyncRecord, FromUUID As String) As String
Dim values As List = Rec.ToListRECORD(True)
Dim Query As String = $"INSERT INTO tRecords (uuid, linkuuid, recordtype, created, lastmodified, status, syncstatus, syncvalue) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"$
#if B4J
Try
SQL.BeginTransaction
SQL.ExecNonQuery2(Query, values)
SQL.TransactionSuccessful
Catch
Log(LastException)
SQL.Rollback
End Try
#else
SQL.ExecuteWait(Query, values)
#End If
Return rec.UUID
End Sub