[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[sqlite3] 006 Retrieve some records

[ | db cursor value |
db := SQLiteDatabase openDatabase: '/data/data/net.smalltalking.s8.jx8/testdb' factory: nil flags: SQLiteDatabase openReadwrite.
cursor := db 
	rawQuery: 'SELECT description FROM testTable WHERE code=?'
	selectionArgs: (Array with: 's8').
cursor moveToFirst.
1 to: cursor count do: [
cursor getColumnIndex: 'description'.
value := cursor getString: (cursor getColumnIndex: 'description').
self print: 'value=', value.
cursor moveToNext
]. 
self print: 'rows count=', cursor count.
db close
] on: Error do: [:ex | self print: 'records retrieve data' ]