Sub Process_Globals
Dim SQL1 As SQL
End Sub
Sub Globals
Dim MyFolder As String = "test"
Dim DBFileName As String = "test.db"
Dim DBFilePath As String
Dim txt As String
Dim DBTableName As String ="tblOriginal"
Dim badger As ShortcutBadger
End Sub
Sub Activity_Create(FirstTime As Boolean)
badger.Initialize
If File.ExternalWritable Then
DBFilePath = File.DirRootExternal & "/" & MyFolder
Else
DBFilePath = File.DirInternal & "/" & MyFolder
End If
File.MakeDir(DBFilePath,"")
If SQL1.IsInitialized =False Then
SQL1.Initialize(DBFilePath,DBFileName,True)
End If
txt="DROP TABLE IF EXISTS " & DBTableName
SQL1.ExecNonQuery(txt)
txt="CREATE TABLE IF NOT EXISTS " & DBTableName & " (ID INTEGER PRIMARY KEY,COUNTRY TEXT, POPULATION TEXT)"
SQL1.ExecNonQuery(txt)
txt="INSERT INTO " & DBTableName & " VALUES(?,?,?)"
SQL1.ExecNonQuery2(txt, Array As Object(Null,"CHINA","1330044000"))
txt="INSERT INTO " & DBTableName & " VALUES(?,?,?)"
SQL1.ExecNonQuery2(txt, Array As Object(Null,"INDIA","1173108018"))
txt="INSERT INTO " & DBTableName & " VALUES(?,?,?)"
SQL1.ExecNonQuery2(txt, Array As Object(Null,"USA","310232863"))
txt="INSERT INTO " & DBTableName & " VALUES(?,?,?), (?,?,?), (?,?,?)"
SQL1.ExecNonQuery2(txt, Array As Object(Null,"BELGIUM","10403000", _
Null,"BOLIVIA","9947412",Null,"IRAQ","29671605") )
txt="INSERT INTO " & DBTableName & " VALUES(?,?,?), (?,?,?), (?,?,?)"
SQL1.ExecNonQuery2(txt, Array As Object(Null,"TUNISIA","10589025", _
Null,"EGYPT","80471869",Null,"FRANCE","64768389") )
Dim MyCount As Int =SQL1.ExecQuerySingleResult("SELECT count(*) from " & DBTableName)
badger.applyCount(MyCount)
End Sub