I'm having trouble on the "COMMIT TRANSACTION" Query.

I seem, for some reason, to be violating a SQLite rule.

This is from a language called RUN BASIC.

Here is the test program, note that "" translates to a single " and the 
print statements are just for this demo:

[code]
CLS
PRINT "Start"
    SQLITECONNECT #SQLiteDataBase, "Shopper.dbs"
        #SQLiteDataBase EXECUTE( "SELECT MAX( ShoppingListIndex ) AS 
MaxShoppingListIndex FROM ShoppingLists" )
PRINT "Executed select max"
        #CurrentQueryRow = #SQLiteDataBase #NEXTROW()
        ShoppingListIndex$ = STR$( (#CurrentQueryRow 
MaxShoppingListIndex()) + 1 )
PRINT "Figured next index value"
        #SQLiteDataBase EXECUTE( "BEGIN TRANSACTION" )
PRINT "Began transaction"
        #SQLiteDataBase EXECUTE( "INSERT Into ShoppingLists 
(CustomerIndex, ShoppingListDate, ShoppingListTime, ShoppingListIndex, 
CombinedShoppingList ) Values (""1"", ""01/25/2009"", ""12:50:30"", 
""1"", ""0"" )" )
PRINT "Inserted new data into ShoppingLists"
        #SQLiteDataBase EXECUTE( "COMMIT TRANSACTION" )
PRINT "committed transaction"
    #SQLiteDataBase DISCONNECT()
PRINT "End"
END
[/code]

And here is the displayed output:

Start
Executed select max
Figured next index value
Began transaction
Inserted new data into ShoppingLists

Runtime Error in program 'TestProblem': #SQLiteDataBase EXECUTE( "COMMIT 
TRANSACTION" )
SQL logic error or missing database

This error was triggered by SQLite.

If I remove the 3 lines (not counting the PRINT statements):


[code]
        #SQLiteDataBase EXECUTE( "SELECT MAX( ShoppingListIndex ) AS 
MaxShoppingListIndex FROM ShoppingLists" )
PRINT "Executed select max"
        #CurrentQueryRow = #SQLiteDataBase #NEXTROW()
        ShoppingListIndex$ = STR$( (#CurrentQueryRow 
MaxShoppingListIndex()) + 1 )
PRINT "Figured next index value"
[/code]

The program runs successfully.

Or, if I insert a disconnect and connect sequence just after those 
lines, the program runs OK.

Why?

Thanks for any help!

Vance



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to