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

test[FMDB] 003 Create a test Table

"Table Creation"
| db databasePath success |
databasePath := 'Sample.sqlite' asLocalPathName.
db := FMDatabase withPath: databasePath.
db open ifTrue: [
	success := db executeUpdate: 'create table if not exists Books(Id INTEGER PRIMARY KEY, Title TEXT, Author TEXT, Pages INTEGER)'.
	success ifTrue: [ self print: 'Table Created successfully' ]
		ifFalse: [self print: 'Can not create the table' ].
	db close.
].