11-09-2011, 04:42 AM
in the second example:
Should db1 be db2? or should there be no db2 because based on prior example:
Stuart
Quote: This is a simpler example. Just writes 1 row into an existing table.
Sqlite db2.Open(dbfile)
db1.Exec("INSERT INTO table1 VALUES ('value1','value2')")
Should db1 be db2? or should there be no db2 because based on prior example:
Quote: Creates or opens database with table 'table1', columns 'A' and 'B'. Writes 1 row.
Sqlite db1.Open(dbfile)
db1.Exec("BEGIN TRANSACTION") ;;don't save until END TRANSACTION. Makes faster whe calling Exec multiple times.
db1.Exec("CREATE TABLE IF NOT EXISTS table1 (A,B)")
str a("one") b("two") ;;data in variables
a.SqlEscape; b.SqlEscape ;;if there are ' characters, they must be replaced to ''
sql.format("INSERT INTO table1 VALUES ('%s','%s')" a b)
db1.Exec(sql)
db1.Exec("END TRANSACTION") ;;save now
Stuart