[SQLite3] CREATE TABLE ... doesn't work sometimes

with the following script :
#! /usr/bin/env ruby

begin; require 'rubygems'; rescue LoadError; end

require 'sqlite3'

db = SQLite3::Database.new( 'ou-ou.db' )

db.execute <<SQL
BEGIN TRANSACTION;
CREATE TABLE devicephonebook (
  UID INTEGER PRIMARY KEY AUTOINCREMENT,
  lastName TEXT NOT NULL DEFAULT(''),
  firstName TEXT NOT NULL DEFAULT(''),
  fullLastName TEXT
);
COMMIT;
SQL

if, from command line, i do :

$ sqlite3 ou-ou.db
[...]

.dump devicephonebook I get :

BEGIN TRANSACTION;
COMMIT;

then, no table created, why ?

i wrote "sometimes" because i've the feeling that if i INSERT something
just afterwards creating the table it's OK ???

···

--
Une Bévue

Hi,

Ideally, to do transactions, you should use the db.transaction method;

http://sqlite-ruby.rubyforge.org/sqlite3/faq.html#538670536

HTH,

Arlen

OK, fine thanks !

···

Arlen Christian Mart Cuss <celtic@sairyx.org> wrote:

Ideally, to do transactions, you should use the db.transaction method;

http://sqlite-ruby.rubyforge.org/sqlite3/faq.html#538670536

--
Une Bévue