Sub Process_Globals
Dim SQL1 As SQL
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
If SQL1.IsInitialized = False Then
SQL1.Initialize(File.DirDefaultExternal, "test1.db", True)
End If
sql1.ExecNonQuery("DROP TABLE IF EXISTS table1")
SQL1.ExecNonQuery("CREATE TABLE table1 (col1 TEXT , col2 INTEGER, col3 INTEGER)")
SQL1.ExecNonQuery2("INSERT INTO table1 VALUES (?, ?, 0)", Array As String("some text", 2))
sql1.ExecNonQuery("INSERT INTO table1 VALUES ('2', 22, 'asd')")
sql1.ExecNonQuery("INSERT INTO table1 VALUES (33, 211, '0')")
SQL1.BeginTransaction
Try
'block of statements like
For i = 1 To 10
SQL1.ExecNonQuery("INSERT INTO table1 VALUES(1, 2, 3)")
Next
SQL1.TransactionSuccessful
Catch
Log(LastException.Message)
End Try
SQL1.EndTransaction
Log(SQL1.ExecQuerySingleResult("SELECT count(*) FROM table1 WHERE col2 > 10"))
Dim Cursor As Cursor
Cursor = SQL1.ExecQuery("SELECT col1, col2 FROM table1")
For i = 0 To Cursor.RowCount - 1
Cursor.Position = i
Log(Cursor.GetString("col1"))
Log(Cursor.GetInt("col2"))
Next
Cursor.Close
End Sub