I like this Sqlite Make Array From Table command, very nice addition.
Anyway, I again have this problem with random crash even though this time I have not used any 3rd party application to view or edit database.
From what I can understand there seems to be some problem with reading strings.
Sqlite Array Get String From Cell$
Sqlite Record Current Row String$
Both these commands cause application crash when put inside (big)for-next loops when there are more than one.
For example this does not crash:
For x = 1 To rows
data$ = sqlite record current row string$( x, 1 )
n=sqlite next record row(1)
Next x
However, this will crash:
For x = 1 To rows
data$ = sqlite record current row string$( x, 1 )
data$ = sqlite record current row string$( x, 2 )
n=sqlite next record row(1)
Next x
For some reason this does only seem to crash when table is bigger than 11 rows (12+)
Edit:
here is example code that should initiate a crash to demonstrate:
Set Window On
Sync On
time = Timer()
time = Timer()
Rem LW - Open (or create) "test" database
result = SQLITE Open Database( 1, "test.s3db", "", "" )
Rem LW - Purge database
If SQLITE Table Exist( 1, "mytable" ) Then result = SQLITE Drop Table( 1, "mytable" )
Print "start : ", (timer()-time), "ms" : time = timer()
Rem LW - Make new table
PRint "create table : "; : sync
column$ = "[ID] INTEGER PRIMARY KEY ASC, "
column$ = column$ + "[A] TEXT, "
column$ = column$ + "[B] TEXT, "
column$ = column$ + "[C] TEXT, "
column$ = column$ + "[D] INTEGER, "
column$ = column$ + "[E] INTEGER, "
column$ = column$ + "[F] INTEGER, "
column$ = column$ + "[G] TEXT, "
column$ = column$ + "[H] INTEGER, "
column$ = column$ + "[I] INTEGER, "
column$ = column$ + "[J] INTEGER, "
column$ = column$ + "[K] TEXT, "
column$ = column$ + "[L] INTEGER, "
column$ = column$ + "[M] TEXT, "
column$ = column$ + "[N] TEXT, "
column$ = column$ + "[O] INTEGER, "
column$ = column$ + "[P] INTEGER, "
column$ = column$ + "[Q] INTEGER"
result = SQLITE Create Table( 1, "mytable", column$ )
Print (timer()-time), "ms" : time = timer()
Rem LW - Add 20 rows using transaction
Print "fill table(trans.): "; : sync
result = sqlite begin transaction()
For x = 1 To 20
columns$ = "A, B"
values$ = "'abcas aoskds','abcas aoskds'"
sql$ = "INSERT INTO mytable ("+columns$+") VALUES ("+values$+")"
result = Sqlite Add To Transaction( sql$ )
next x
result = Sqlite Commit Transaction( 1 )
Print (timer()-time), "ms" : time = timer()
Rem LW - Retrieve using recordset
Print "retrieve(record) : "; : sync
sql$ = "SELECT * FROM mytable;"
n = Sqlite Begin Sql Query( 1, sql$ )
rows = Sqlite Record Row Count( 1 )
For row = 1 To rows
id= Sqlite Record Current Row Integer( 1, 0 )
a$= Sqlite Record Current Row String$( 1, 1 )
b$= Sqlite Record Current Row String$( 1, 2 )
c$= Sqlite Record Current Row String$( 1, 3 )
n = Sqlite Next Record Row( 1 )
Next row
n = Sqlite Finish Sql Query(1)
Print (timer()-time), "ms"
time = timer()
Rem LW - Finish
Print
Print "done"
Sync
wait key
n = Sqlite Close Database( 1 )
END
IS that a game, a program, or 3 year old drawing.