Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [SQLite3] CREATE TABLE ... doesn't work sometimes

Reply
Thread Tools

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

 
 
Une Bévue
Guest
Posts: n/a
 
      10-14-2007

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

begin; require 'rubygems'; rescue LoadError; end

require 'sqlite3'

db = SQLite3:atabase.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
[...]
sqlite> .dump devicephonebook I get :
BEGIN TRANSACTION;
COMMIT;
sqlite>

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
 
Reply With Quote
 
 
 
 
Une Bévue
Guest
Posts: n/a
 
      10-14-2007
Arlen Christian Mart Cuss <(E-Mail Removed)> wrote:

> Ideally, to do transactions, you should use the db.transaction method;
>
> http://sqlite-ruby.rubyforge.org/sql...html#538670536


OK, fine thanks !

--
Une Bévue
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ExecuteScalar method sometimes work, sometimes doesn't Randy Smith ASP .Net 2 04-24-2007 12:13 AM
Firefox locks up on first URL sometimes; Sometimes closes itself Jim Firefox 0 06-28-2005 01:42 PM
? Content Entered in Forms Sometimes Duplicated and Sometimes Not ? Nehmo Sergheyev HTML 1 05-09-2004 07:07 PM
::std sometimes needed, sometimes not Marcin Vorbrodt C++ 24 09-17-2003 03:01 PM
Re: Sometimes ASP.NET does find the dll, sometimes doesn't John Saunders ASP .Net 0 08-28-2003 01:40 PM



Advertisments