18 lines
829 B
Plaintext
18 lines
829 B
Plaintext
sqliteconnect #mem, ":memory:" ' Create in memory DB
|
|
#mem execute("CREATE TABLE data(str)") ' And fields to hold the string data
|
|
|
|
strings$ = "a bb ccc ddd ee f ggg" ' The given string data
|
|
|
|
while word$(strings$,i + 1," ") <> ""
|
|
i = i + 1
|
|
#mem execute("INSERT INTO data VALUES('";word$(strings$,i," ");"')") ' insert the strings in to the DB
|
|
wend
|
|
|
|
#mem execute("SELECT length(str) as leng, str FROM data ORDER BY leng desc,str") ' pull data in reverse lenght sequence
|
|
WHILE #mem hasanswer()
|
|
#row = #mem #nextrow()
|
|
leng = #row leng()
|
|
str$ = #row str$()
|
|
print leng;" ";str$ ' print the data
|
|
WEND
|