Re: [sqlite] Create Table oddity

2013-05-20 Thread Simon Slavin
On 20 May 2013, at 4:55am, Simon Slavin slav...@bigfraud.org wrote: I wonder if there's a difference between DEFAULT date('now') and DEFAULT (date('now')) Bah. Of course, you can't do either: http://www.sqlite.org/lang_createtable.html An explicit DEFAULT clause may specify that

Re: [sqlite] Create Table oddity

2013-05-20 Thread Keith Medcalf
-Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- boun...@sqlite.org] On Behalf Of Simon Slavin Sent: Monday, 20 May, 2013 07:17 To: General Discussion of SQLite Database Subject: Re: [sqlite] Create Table oddity On 20 May 2013, at 4:55am, Simon Slavin

Re: [sqlite] Create Table oddity

2013-05-20 Thread Simon Slavin
On 20 May 2013, at 2:41pm, Keith Medcalf kmedc...@dessus.com wrote: It works quite fine: sqlite create table a(a,b text default (datetime())); sqlite insert into a (a) values (1); sqlite insert into a (a) values (2); sqlite select * from a; 1|2013-05-20 13:27:30 2|2013-05-20 13:27:34

Re: [sqlite] Create Table oddity

2013-05-19 Thread Jean-Christophe Deschamps
I've been talking with Bogdan about a change to SQLite Expert and ran across something I did NOT expect. I have this schema: CREATE TABLE [tApplicationPaths] ( [AppID] INTEGER PRIMARY KEY, [ApplicationName] CHAR, [ApplicationMonitorPath] CHAR, [SearchSubDirs] BOOL DEFAULT 1,

Re: [sqlite] Create Table oddity

2013-05-19 Thread Keith Medcalf
This is a feature (or a bug, depending on your view). A column default must be a constant, so your reference to AppID is translated to the string 'AppID' because it cannot be a column name since that would not be a constant. Perhaps your intent to do the following: CREATE TABLE

Re: [sqlite] Create Table oddity

2013-05-19 Thread Jean-Christophe Deschamps
While Keith is closer to the right explanation than I was, there are a couple of points: default does not need a constant: a function call is valid as well, e.g. date() The syntax: CREATE TABLE tApplicationPaths ( AppID INTEGER PRIMARY KEY, ApplicationName CHAR, ApplicationMonitorPath

Re: [sqlite] Create Table oddity

2013-05-19 Thread Keith Medcalf
While Keith is closer to the right explanation than I was, there are a couple of points: default does not need a constant: a function call is valid as well, e.g. date() It can be a constant expression if surrounded by brackets. This does not mean that the value of the expression is a

Re: [sqlite] Create Table oddity

2013-05-19 Thread Jean-Christophe Deschamps
For me this inserts the text 'AppID' ... Sorry my bad, I tried a dummy table but made the type integer not char. So it was displaying 0 but hold text indeed. It's too late here for me to post anything, must be age! ___ sqlite-users mailing list

Re: [sqlite] Create Table oddity

2013-05-19 Thread Jay A. Kreibich
On Sun, May 19, 2013 at 06:05:05PM -0400, Stephen Chrzanowski scratched on the wall: I've been talking with Bogdan about a change to SQLite Expert and ran across something I did NOT expect. I have this schema: CREATE TABLE [tApplicationPaths] ( [AppID] INTEGER PRIMARY KEY,

Re: [sqlite] Create Table oddity

2013-05-19 Thread Stephen Chrzanowski
Maybe this will help someone else later on down the road when dealing with defaults and how the library handles them. My intention was to see about changing the behavior of SQLite Expert when it came to generating the SQL statement to create a new table. Currently, Expert takes whatever is in

Re: [sqlite] Create Table oddity

2013-05-19 Thread Simon Slavin
On 20 May 2013, at 4:33am, Stephen Chrzanowski pontia...@gmail.com wrote: CREATE TABLE [tApplicationPaths] ( [AppID] INTEGER PRIMARY KEY, [ApplicationName] CHAR, [ApplicationMonitorPath] CHAR, [SearchSubDirs] BOOL DEFAULT 1, [SearchMask] CHAR DEFAULT 8*8); Hmm. I wonder if there's a

Re: [sqlite] Create table returns database disk image is malformed when disk is full and SQLITE_IOCAP_ATOMIC and SQLITE_DEFAULT_AUTOVACUUM is enabled

2012-12-03 Thread Yongil Jang
Dear all, I changed btree.c like as follows. But, it may not be a best solution. Whatever TCL test for quick.test is passed, following code can have some mistakes... I couldn't change it more with my poor knowledge. *static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags)*{

Re: [sqlite] Create table returns database disk image is malformed when disk is full and SQLITE_IOCAP_ATOMIC and SQLITE_DEFAULT_AUTOVACUUM is enabled

2012-11-30 Thread Yongil Jang
In btreeCreateTable, a new page is allocated by allocateBtreePage function without any failures. In normal case, this should be failed because of there is no space to write journal file. jrnlWrite function called from allocateBtree is passed by writing memory block(no real file) in atomic write

Re: [sqlite] Create table returns database disk image is malformed when disk is full and SQLITE_IOCAP_ATOMIC and SQLITE_DEFAULT_AUTOVACUUM is enabled

2012-11-28 Thread Yongil Jang
I tried to solve this problem by myself... But, It's very difficult work to me. :) SQLITE_CORRUPT_BKPT is returned in lockBtree, because of, nPage(=4) is bigger than nPageFile(=3). First call of creating table b returns database or disk is full and it is normal case. But, second call of creating

Re: [sqlite] CREATE TABLE parsing error

2012-10-21 Thread Richard Hipp
On Sun, Oct 21, 2012 at 12:21 PM, Sean Doull-Connolly sea...@att.netwrote: SQLite version 3.7.11 Fedora 17 Linux 3.3.4-5.fc17.i686.PAE The CREATE TABLE text file below is missing a comma after the first FOREIGN KEY clause, and this should draw an error. No error is reported, and the table

Re: [sqlite] create table question

2012-08-11 Thread Simon Slavin
On 10 Aug 2012, at 9:14pm, u okafor uo07...@yahoo.com wrote: We are doing a CREATE TABLE query; sqlite3_step() is called in shell.c and along the way, sqlite3VdbeExec() is called. sqlite3VdbeExec() call is pased with p pointer which contains aOp array. Could you please tell us where this

Re: [sqlite] Create table if not exists and insert seed data

2011-03-22 Thread Philip Graham Willoughby
On 21 Mar 2011, at 22:04, Erich93063 wrote: I am trying to create a SQLite database if it doesn't exist, which I know I can use 'CREATE TABLE IF NOT EXISTS, but more importantly, I need to initially populate the database with seed data if it doesn't exist. If I use CREATE TABLE IF NOT EXISTS,

Re: [sqlite] Create table if not exists and insert seed data

2011-03-22 Thread Max Vlasov
On Tue, Mar 22, 2011 at 1:04 AM, Erich93063 erich93...@gmail.com wrote: I am trying to create a SQLite database if it doesn't exist, which I know I can use 'CREATE TABLE IF NOT EXISTS, but more importantly, I need to initially populate the database with seed data if it doesn't exist. If I use

Re: [sqlite] Create table if not exists and insert seed data

2011-03-22 Thread Pavel Ivanov
You can use a simple CREATE TABLE (without IF NOT EXISTS clause). If it succeeds then you populate table with data (remember to do that in the same transaction where you created the table). If CREATE TABLE fails then you don't insert your data. Pavel On Mon, Mar 21, 2011 at 6:04 PM, Erich93063

Re: [sqlite] Create table if not exists and insert seed data

2011-03-22 Thread Drake Wilson
Quoth Philip Graham Willoughby phil.willoug...@strawberrycat.com, on 2011-03-22 10:18:08 +: Yes, I had this problem - if sqlite3_open_v2 had an equivalent to O_EXCL it would make this a lot easier: you would only try to run your schema/prepopulating SQL if the exclusive open worked. If it

Re: [sqlite] Create table if not exists and insert seed data

2011-03-22 Thread Simon Slavin
On 22 Mar 2011, at 1:38pm, Pavel Ivanov wrote: You can use a simple CREATE TABLE (without IF NOT EXISTS clause). If it succeeds then you populate table with data (remember to do that in the same transaction where you created the table). If CREATE TABLE fails then you don't insert your data.

Re: [sqlite] Create table if not exists and insert seed data

2011-03-22 Thread A Gilmore
On 11-03-22 10:40 AM, Simon Slavin wrote: Or just do a 'SELECT id FROM whatever LIMIT 1'. If you get any error, it doesn't exist, so create it and fill it. Or look in sqlite_master for an entry for the TABLE. Simon. Could also use INSERT OR IGNORE statements for the seed data if the rows

Re: [sqlite] Create table if not exists and insert seed data

2011-03-22 Thread BareFeetWare
On 22/03/2011, at 9:04 AM, Erich93063 wrote: I am trying to create a SQLite database if it doesn't exist, which I know I can use 'CREATE TABLE IF NOT EXISTS, but more importantly, I need to initially populate the database with seed data if it doesn't exist. If I use CREATE TABLE IF NOT

Re: [sqlite] create table as syntax

2010-09-09 Thread Dan Kennedy
On Sep 9, 2010, at 3:56 PM, thomas veymont wrote: hello, I'm trying to use the CREATE TABLE AS syntax to create a table and insert in the same time a default row. e.g : sqlite CREATE TABLE test (x NUMERIC) AS (SELECT 25 AS x); Error: near AS: syntax error oops. this syntax is

Re: [sqlite] create table as syntax

2010-09-09 Thread Andy Gibbs
On Thursday, September 09, 2010 10:56 AM, thomas veymont wrote: hello, I'm trying to use the CREATE TABLE AS syntax to create a table and insert in the same time a default row. e.g : sqlite CREATE TABLE test (x NUMERIC) AS (SELECT 25 AS x); Error: near AS: syntax error oops. this

Re: [sqlite] create table as syntax

2010-09-09 Thread thomas veymont
hello, I'm trying to use the CREATE TABLE AS syntax to create a table and insert in the same time a default row. e.g : sqlite CREATE TABLE test (x NUMERIC) AS (SELECT 25 AS x); Error: near AS: syntax error oops. this syntax is documented in

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-07-01 Thread Tim Romano
If cross-implementation portability is a stated design goal, Adobe's departure from the authoritative behavior is indeed a bug. If cross-implementation portability is not officially supported but is simply something that users might expect and attempt, then Adobe's departure from the

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-07-01 Thread Pavel Ivanov
No, I am not asking SQLite to emulate an error in Adobe's code. Rather I am suggesting this: if SQLite is going to distinguish in any way between INT and INTEGER on primary key definitions, the CREATE TABLE X as SELECT... syntax ought not to produce a table with an INT primary key if the

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-07-01 Thread Simon Slavin
On 1 Jul 2010, at 2:21pm, Pavel Ivanov wrote: CREATE TABLE X as SELECT... syntax ought not to produce a table with an INT primary key if the prototype had INTEGER. The problem is not with primary keys, it's with the types of the columns in the table. The command is not CREATE TABLE y AS

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-07-01 Thread Pavel Ivanov
This is obviously wrong.  The SELECT command from TABLE t could never have returned any INT values (because SQLite has no INT datatype).  So why was TABLE t_copy created with an INT column ? Because three letters INT are enough to assign INTEGER affinity to the column. From

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-07-01 Thread Tim Romano
Here is what I wrote to Jay earlier this morning but meant to send to the entire list. I am still in the habit of hitting Reply in Google Mail when I should be hitting a different button that also says Reply. sent earlier today to Jay Jay, I agree with 99.44% of what you say. If in the future

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-07-01 Thread Simon Slavin
On 1 Jul 2010, at 2:49pm, Pavel Ivanov wrote: This is obviously wrong. The SELECT command from TABLE t could never have returned any INT values (because SQLite has no INT datatype). So why was TABLE t_copy created with an INT column ? Because three letters INT are enough to assign

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-07-01 Thread Pavel Ivanov
There is no such datatype as 'INT' in SQLite.  No part of SQLite should be declaring /any/ column as having an affinity of 'INT'. Yet another holly war and another fake problem... :( Why SQLite shouldn't declare column as INT? Who is confused by that this time? Yes, I know that there's no data

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-07-01 Thread Pavlos Christoforou
Thanks Tim for taking the time to point this out. On 1 July 2010 13:41, Tim Romano tim.romano...@gmail.com wrote: If cross-implementation portability is a stated design goal, Adobe's departure from the authoritative behavior is indeed a bug. If cross-implementation portability is not

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-07-01 Thread Jay A. Kreibich
On Thu, Jul 01, 2010 at 03:44:52PM +0100, Simon Slavin scratched on the wall: There is no such datatype as 'INT' in SQLite. SQLite doesn't have defined datatypes, so I suppose you could say this is correct. But if you want to say that SQLite has no 'INT' datatype, it is just as legit

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-30 Thread Tim Romano
Puneet, I am simply pointing out a potential pitfall. Putting up a highway sign that says Soft Shoulder is one way to go about things. Widening the shoulder and perhaps paving it is another. Regards Tim Romano Swarthmore PA On Tue, Jun 29, 2010 at 11:56 AM, P Kishor punk.k...@gmail.com wrote:

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-30 Thread Tim Romano
Jay, Let me try to scratch on the wall one more time and perhaps my point will make its way through. Notwithstanding your insistence that INT and INTEGER are the same in SQLite, *with respect to use in the PRIMARY KEY definition* there are subtle differences. In the authoritative version of

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-30 Thread David Bicking
On Wed, 2010-06-30 at 09:04 -0400, Tim Romano wrote: snip The EXAMPLE: If you create a database in the authoritative version of SQLite using INT PRIMARY KEY (rather than INTEGER PRIMARY KEY), when you share the database with your Adobe-using affiliate, all hell will break loose. I will

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-30 Thread Jay A. Kreibich
On Wed, Jun 30, 2010 at 09:04:14AM -0400, Tim Romano scratched on the wall: Notwithstanding your insistence that INT and INTEGER are the same in SQLite, *with respect to use in the PRIMARY KEY definition* there are subtle differences. Yes. However, CREATE TABLE ... AS SELECT doesn't carry

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-29 Thread Jay A. Kreibich
On Tue, Jun 29, 2010 at 06:59:18AM -0400, Tim Romano scratched on the wall: CREATE TABLE main.proto (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , name TEXT) CREATE TABLE main.clone as select * from PROTO The primary key of table CLONE is defined as INT not INTEGER. The only

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-29 Thread Pavel Ivanov
 ...which actually surprises me, since I was under the impression  CREATE TABLE ... AS SELECT always produced NONE affinities.  Is this  a semi-recent (last year) change? It looks like the only recent change was a year ago: http://www.sqlite.org/changes.html#version_3_6_15. But according to

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-29 Thread Tim Romano
But there may be an argument for making the cloning more precise. It's a bit of a mess, or at least it seems so to me because my first ten years of database work was done with PICK, a database that was developed by PICK Systems but licensed to many companies and marketed under different brands

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-29 Thread P Kishor
On Tue, Jun 29, 2010 at 9:58 AM, Tim Romano tim.romano...@gmail.com wrote: But there may be an argument for making the cloning more precise. The issue is that CREATE TABLE t AS SELECT... is not meant to clone a table. Not too long ago I encountered the same issue (search the mail archives).

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-29 Thread Pavel Ivanov
I think SQLite implementations should probably adhere to a core spec but I recognize this as my bias, not dogma. Probably this is my personal opinion but why should SQLite comply with specification of Pick Multi-dimensional databases if it never claimed to be multi-dimensional? SQLite is a

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-29 Thread Tim Romano
Puneet, I am not trying to give Adobe any sort of primacy; but I wouldn't call them unimportant either. The core concern, at least as I see it, is the undesirable effects of sharing data between implementations that do not handle INT and INTEGER primary keys compatibly. I don't use and won't

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-29 Thread P Kishor
On Tue, Jun 29, 2010 at 10:46 AM, Tim Romano tim.romano...@gmail.com wrote: Puneet, I am not trying to give Adobe any sort of primacy; but I wouldn't call them unimportant either. The core concern, at least as I see it, is the undesirable effects of sharing data between implementations that

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-29 Thread Tim Romano
Pavel, As I said, I am biased in favor of the benefits to there being core-compatibility among the various implementations of SQLite but I am not dogmatic about it, and I have no say in the matter in any case ;-) But I think you may have misunderstood me: I am not arguing that SQlite should be

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-29 Thread Jay A. Kreibich
On Tue, Jun 29, 2010 at 11:46:34AM -0400, Tim Romano scratched on the wall: The core concern, at least as I see it, is the undesirable effects of sharing data between implementations that do not handle INT and INTEGER primary keys compatibly. The only known program that can read SQLite

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-29 Thread Richard Hipp
On Tue, Jun 29, 2010 at 11:46 AM, Tim Romano tim.romano...@gmail.comwrote: Here's a little story: The Therac-25. http://sunnyday.mit.edu/papers/therac.pdf -- - D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-29 Thread Pavel Ivanov
PICK is simply an example of a database that came in many slightly different versions all of which adhered to a core definition,  and this compatibility was a good thing. Then I reiterate my point using your wordings: SQL comes in different versions and flavors (SQLite, Oracle, MS SQL etc.)

Re: [sqlite] create table {table-name} as select.... table definition is imperfectly cloned

2010-06-29 Thread Jay A. Kreibich
On Tue, Jun 29, 2010 at 09:51:42AM -0400, Pavel Ivanov scratched on the wall: ?...which actually surprises me, since I was under the impression ?CREATE TABLE ... AS SELECT always produced NONE affinities. ?Is this ?a semi-recent (last year) change? It looks like the only recent change was

Re: [sqlite] CREATE TABLE work arounds?

2010-06-10 Thread Jean-Christophe Deschamps
I am parsing fields on the fly and then creating tables, unfortunately one of the fields is Order and is a special word in SQL as is not allowed. Is there a way around this instead of intercepting with perl s'/Order/Orders/g' Can you wrap every column name inside double quotes or square

Re: [sqlite] CREATE TABLE work arounds?

2010-06-10 Thread Jay A. Kreibich
On Thu, Jun 10, 2010 at 07:02:02PM +0200, Jean-Christophe Deschamps scratched on the wall: I am parsing fields on the fly and then creating tables, Can you wrap every column name inside double quotes or square brackets? Order If you're using identifiers (table or column names) from an

Re: [sqlite] CREATE TABLE work arounds?

2010-06-10 Thread Jay A. Kreibich
On Thu, Jun 10, 2010 at 12:12:54PM -0500, Jay A. Kreibich scratched on the wall: On Thu, Jun 10, 2010 at 07:02:02PM +0200, Jean-Christophe Deschamps scratched on the wall: I am parsing fields on the fly and then creating tables, Can you wrap every column name inside double quotes or

Re: [sqlite] CREATE TABLE work arounds?

2010-06-10 Thread David Lyon
Thank You very much for all your responses and suggestions, they provided me with the information I needed to correct the issue. Cheers. ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] CREATE TABLE AS SELECT * FROM changes column definition --bug or feature?

2009-08-02 Thread Igor Tandetnik
P Kishor wrote: SQLite version 3.6.11 Enter .help for instructions Enter SQL statements terminated with a ; sqlite CREATE TABLE foo (id INTEGER PRIMARY KEY, desc TEXT, num INTEGER DEFAULT 0); sqlite INSERT INTO foo (desc) VALUES ('foo'); sqlite INSERT INTO foo (desc) VALUES ('bar'); sqlite

Re: [sqlite] CREATE TABLE AS SELECT * FROM changes column definition --bug or feature?

2009-08-02 Thread P Kishor
On Sun, Aug 2, 2009 at 10:39 PM, Igor Tandetnikitandet...@mvps.org wrote: P Kishor wrote: SQLite version 3.6.11 Enter .help for instructions Enter SQL statements terminated with a ; sqlite CREATE TABLE foo (id INTEGER PRIMARY KEY, desc TEXT, num INTEGER DEFAULT 0); sqlite INSERT INTO foo

Re: [sqlite] CREATE TABLE AS SELECT * FROM changes columndefinition --bug or feature?

2009-08-02 Thread Igor Tandetnik
P Kishor wrote: On Sun, Aug 2, 2009 at 10:39 PM, Igor Tandetnikitandet...@mvps.org wrote: You don't make a copy of a table - you make a copy of the resultset of a SELECT statement. Columns in said resultset don't carry attributes like DEFAULT, even though columns in the underlying table may.

Re: [sqlite] create table default expr

2008-11-03 Thread Simon Davies
2008/11/3 John [EMAIL PROTECTED]: Hi I want to (if possible) create a table with a default timestamp in a format other than -MM-DD ... per example below. I have tried a few variants but always get same error. Can this be done and if so, how? create table ( custnum integer

Re: [sqlite] create table default expr

2008-11-03 Thread Igor Tandetnik
John [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I want to (if possible) create a table with a default timestamp in a format other than -MM-DD ... per example below. I have tried a few variants but always get same error. Can this be done and if so, how? create table (

Re: [sqlite] create table default expr

2008-11-03 Thread John
Simon Davies wrote: 2008/11/3 John [EMAIL PROTECTED]: Hi I want to (if possible) create a table with a default timestamp in a format other than -MM-DD ... per example below. I have tried a few variants but always get same error. Can this be done and if so, how? create table (

Re: [sqlite] create table default expr

2008-11-03 Thread John
Igor Tandetnik wrote: John [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I want to (if possible) create a table with a default timestamp in a format other than -MM-DD ... per example below. I have tried a few variants but always get same error. Can this be done and if so,

Re: [sqlite] create table if not exists virtual table?

2008-08-30 Thread Petite Abeille
On Aug 28, 2008, at 11:39 PM, Scott Hess wrote: There is already such a feature request at: http://www.sqlite.org/cvstrac/tktview?tn=2604 I just added a patch there which, I believe, implements this. I'm going to float it on sqlite-dev to see if I'm missing anything. Nice :) Hope to see

Re: [sqlite] create table if not exists virtual table?

2008-08-28 Thread Scott Hess
There is already such a feature request at: http://www.sqlite.org/cvstrac/tktview?tn=2604 I just added a patch there which, I believe, implements this. I'm going to float it on sqlite-dev to see if I'm missing anything. -scott On Wed, Aug 27, 2008 at 9:20 AM, Petite Abeille [EMAIL

Re: [sqlite] create table if not exists virtual table?

2008-08-27 Thread Petite Abeille
Hello, On Aug 26, 2008, at 11:34 PM, Dennis Cote wrote: Petite Abeille wrote: Is it possible to use 'if not exists' in conjunction with the creation DDL for a virtual table? No, its not possible. The syntax of a create table statement is shown here

Re: [sqlite] create table if not exists virtual table?

2008-08-26 Thread Dennis Cote
Petite Abeille wrote: Is it possible to use 'if not exists' in conjunction with the creation DDL for a virtual table? No, its not possible. The syntax of a create table statement is shown here http://www.sqlite.org/lang_createtable.html and that for a create virtual table statement is

Re: [sqlite] Create table error on AIX -- Unable to open database mytest: SQL logic error or missing database

2008-04-07 Thread Dennis Cote
Chris Pierce wrote: Here's what I'm doing/getting: AIX$ ./sqlite3 test.db SQLite version 3.5.7 Enter .help for instructions sqlite create table mytest(first smallint); Unable to open database mytest: SQL logic error or missing database AIX$ There is something fishy going on here.

Re: [sqlite] Create table error on AIX -- Unable to open database mytest: SQL logic error or missing database

2008-04-06 Thread John Stanton
I had a problem compiling Sqlite on ealrier versions of AIX. It turned out to be a linker problem and compiling without the -g optimization solved the problem. What compiler are you using? Xlc or gcc? Chris Pierce wrote: Hi, I am having problems with SQLite v3.5.7 on AIX v5.2. I

Re: [sqlite] Create table error on AIX -- Unable to open database mytest: SQL logic error or missing database

2008-04-06 Thread Chris Pierce
John Stanton wrote: I had a problem compiling Sqlite on ealrier versions of AIX. It turned out to be a linker problem and compiling without the -g optimization solved the problem. The configure process shows an entry that says: checking whether accepts -g... no I edited the Makefile

Re: [sqlite] create table with datatype = DATE. SHould use as DATETIME or INTEGER.

2007-12-17 Thread Joanne Pham
] To: sqlite-users@sqlite.org Sent: Thursday, December 13, 2007 2:48:26 PM Subject: Re: [sqlite] create table with datatype = DATE CREATE TABLE test (.. createData DATETIME DEFAULT CURRENT_TIMESTAMP) On 12/13/07, Joanne Pham [EMAIL PROTECTED] wrote: Hi All, I create the table as : create

Re: [sqlite] create table with datatype = DATE. SHould use as DATETIME or INTEGER.

2007-12-17 Thread John Stanton
, December 13, 2007 2:48:26 PM Subject: Re: [sqlite] create table with datatype = DATE CREATE TABLE test (.. createData DATETIME DEFAULT CURRENT_TIMESTAMP) On 12/13/07, Joanne Pham [EMAIL PROTECTED] wrote: Hi All, I create the table as : create table test (name varchar(30), createDate DATE default

Re: [sqlite] create table with datatype = DATE. SHould use as DATETIME or INTEGER.

2007-12-17 Thread Joanne Pham
, 2007 10:00:11 AM Subject: Re: [sqlite] create table with datatype = DATE. SHould use as DATETIME or INTEGER. If you declared your date and time (timestamp) column DATETIME it will be floating point and will store date and time in 8 bytes. Use the FP bind function. If you make it a REAL instead

Re: [sqlite] create table with datatype = DATE. SHould use as DATETIME or INTEGER.

2007-12-17 Thread Dennis Cote
Joanne Pham wrote: I have two question regarding DATETIME column data type: 1 ) Should I store my COLUMN as INTEGER instead of DATETIME. Is it easier if this column type is INTEGER vs DATETIME then do the conversion in the GUI code to convert from INTEGER TO DATETIME. 2) And

Re: [sqlite] create table with datatype = DATE. SHould use as DATETIME or INTEGER.

2007-12-17 Thread John Stanton
. Thanks, Joanne - Original Message From: John Stanton [EMAIL PROTECTED] To: sqlite-users@sqlite.org Sent: Monday, December 17, 2007 10:00:11 AM Subject: Re: [sqlite] create table with datatype = DATE. SHould use as DATETIME or INTEGER. If you declared your date and time (timestamp

Re: [sqlite] create table with datatype = DATE. SHould use as DATETIME or INTEGER.

2007-12-17 Thread Joanne Pham
Sent: Monday, December 17, 2007 12:59:00 PM Subject: Re: [sqlite] create table with datatype = DATE. SHould use as DATETIME or INTEGER. Sqlite stores a date and time as a REAL so instead of trusting to manifest typing to make it a REAL your code will be easier to follow if you declare it a REAL

Re: [sqlite] create table with datatype = DATE. SHould use as DATETIME or INTEGER.

2007-12-17 Thread Dennis Cote
Joanne Pham wrote: My application is used C++ to insert/select the data from this table. So if I defined it as create table mytable ( createDate REAL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (remoteWXId) ); Then I can use sqlite3_bind_real to bind the column but what is the

Re: [sqlite] create table with datatype = DATE. SHould use as DATETIME or INTEGER.

2007-12-17 Thread John Stanton
code that work for C++ in this case. Sorry for the question. Thanks, JP - Original Message From: John Stanton [EMAIL PROTECTED] To: sqlite-users@sqlite.org Sent: Monday, December 17, 2007 12:59:00 PM Subject: Re: [sqlite] create table with datatype = DATE. SHould use as DATETIME

Re: [sqlite] create table with datatype = DATE - STORE as DATETIME or INTEGER.

2007-12-14 Thread Joanne Pham
- Original Message From: John Stanton [EMAIL PROTECTED] To: sqlite-users@sqlite.org Sent: Thursday, December 13, 2007 3:05:52 PM Subject: Re: [sqlite] create table with datatype = DATE The type DATE is a declared type, not an actual type and has no effect u nless your code specifically picks it out

Re: [sqlite] create table with datatype = DATE - STORE as DATETIME or INTEGER.

2007-12-14 Thread Dennis Cote
Joanne Pham wrote: Hi All, Should I create the column in DATETIME or the INTEGER to store the time. DATETIME has the value of GMT time. So I store this value as INTEGER then I need to convert datetime format but it will be use less space if I use the INTEGER. Please give me an advice. See

Re: [sqlite] create table with datatype = DATE - STORE as DATETIME or INTEGER.

2007-12-14 Thread John Stanton
[EMAIL PROTECTED] To: sqlite-users@sqlite.org Sent: Thursday, December 13, 2007 3:05:52 PM Subject: Re: [sqlite] create table with datatype = DATE The type DATE is a declared type, not an actual type and has no effect u nless your code specifically picks it out as a declared type. To do what you

Re: [sqlite] create table with datatype = DATE

2007-12-13 Thread John Stanton
The type DATE is a declared type, not an actual type and has no effect u nless your code specifically picks it out as a declared type. To do what you want use a trigger on insert and update the date field with datetime('now'); Joanne Pham wrote: Hi All, I create the table as : create

RE: [sqlite] CREATE TABLE

2007-07-06 Thread James Dennett
-Original Message- From: Ryan M. Lederman [mailto:[EMAIL PROTECTED] Sent: Friday, July 06, 2007 3:34 PM To: sqlite-users@sqlite.org Subject: [sqlite] CREATE TABLE I'm using sqlite3, built with Microsoft's CL compiler, 8.0 on a Windows Mobile platform. I have a problem wherein I

Re: [sqlite] CREATE TABLE

2007-07-06 Thread Ryan M. Lederman
James, Nope. And actually, it's always a different table that fails to get created. I know that (usually) all the tables get created successfully. It seems plausible that it's a low-memory condition that causes it, seeing as this code is running on PDAs with very very little memory. I will

Re: [sqlite] CREATE TABLE

2007-07-06 Thread John Stanton
Are you execduting several sqlite3_prapare and sqlite3_step statements? The prepare steps through the statements returning a pointer to the start of the next one as one is compiled. Ryan M. Lederman wrote: I'm using sqlite3, built with Microsoft's CL compiler, 8.0 on a Windows Mobile

Re: [sqlite] create table error

2007-05-14 Thread allen . zhang
close it. that is for my reason. the relloc memory error! Mohd Radzi Ibrahim [EMAIL PROTECTED] 2007-05-10 16:44 Please respond to sqlite-users@sqlite.org To sqlite-users@sqlite.org cc Subject Re: [sqlite] create table error Could it be that the data where *sql is pointing to is being

Re: [sqlite] create table error

2007-05-10 Thread Mohd Radzi Ibrahim
Could it be that the data where *sql is pointing to is being re-used somewhere? --radzi. - Original Message - From: [EMAIL PROTECTED] To: sqlite-users@sqlite.org Sent: Thursday, May 10, 2007 3:54 PM Subject: [sqlite] create table error the following is my test code. just create

Re: [sqlite] CREATE TABLE fails if SQL starts with comment

2007-04-27 Thread drh
Yuriy Martsynovskyy [EMAIL PROTECTED] wrote: When I execute the SQL code below on a newly created DB file I get an error 'table Tab already exists', and it creates a table -- comment CREATE TABLE Tab(ID); Code below works without error messages: CREATE TABLE Tab(ID); I am unable to

Re: [sqlite] CREATE TABLE fails if SQL starts with comment

2007-04-27 Thread Yuriy Martsynovskyy
Update to version version 3.3.17 has solved the problem. The issue existed in version 3.3.14 - To unsubscribe, send email to [EMAIL PROTECTED] -

RE: [sqlite] Create table / data types

2006-11-19 Thread RB Smissaert
I can see that doing this: create table ReadCode (SUBJECT_TYPE varchar READ_CODE varchar TERM30 varchar TERM60 varchar); Seems to work just the same as does this: create table ReadCode (SUBJECT_TYPE text READ_CODE text TERM30 text TERM60 text);

Re: [sqlite] Create table / data types

2006-11-19 Thread drh
RB Smissaert [EMAIL PROTECTED] wrote: Also, how would I translate these data types of Interbase to SQLite data types: I take it that it will be like this: BLOB BLOB DATE TEXT DOUBLE REAL LONG INTEGER SHORT REAL Did you mean SHORT INTEGER here? I don't

Re: [sqlite] Create table / data types

2006-11-19 Thread drh
RB Smissaert [EMAIL PROTECTED] wrote: I can see that doing this: create table ReadCode (SUBJECT_TYPE varchar READ_CODE varchar TERM30 varchar TERM60 varchar); Seems to work just the same as does this: create table ReadCode (SUBJECT_TYPE text READ_CODE text

RE: [sqlite] Create table / data types

2006-11-19 Thread RB Smissaert
Yes, SHORT should translate to Integer. How about the syntax with create table? Thanks. RBS -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 19 November 2006 23:45 To: sqlite-users@sqlite.org Subject: Re: [sqlite] Create table / data types RB Smissaert [EMAIL

Re: [sqlite] create table command from listview in vb.net

2006-07-11 Thread C.Peachment
If understand your code correctly, this line creates a table with a single column. dbConn.createTable(CREATE TABLE tblName ( fldName fldAttribute )) You describe a user interface to be used to create tables with multiple columns. You must do one of two things:

Re: [sqlite] create table command from listview in vb.net

2006-07-11 Thread John Newby
Hi, thanks for your speedy reply, Yes, you have understood my code correctly, this is the create table statement, and at the time of execution all column names are known to the form, I am just unsure as how to get them from the listview to place into a create table statement, I think I will need

Re: [sqlite] create table command from listview in vb.net

2006-07-11 Thread C.Peachment
Sorry, but I don't use proprietary programming languages and can not provide assistance with Visual Basic. On Tue, 11 Jul 2006 12:00:34 +0100, John Newby wrote: Hi, thanks for your speedy reply, Yes, you have understood my code correctly, this is the create table statement, and at the time of

Re: [sqlite] create table command from listview in vb.net

2006-07-11 Thread Dennis Cote
John Newby wrote: Do you know of a way I could get the details from the listview? John, This question is far more likely to be answered on a Visual Basic mailing list rather than this one. HTH Dennis Cote

Re: [sqlite] create table command from listview in vb.net

2006-07-11 Thread John Newby
Hi Dennis, Yeah I know, I have posted several VB forums regarding this matter, I was just hoping there might have been an SQLite user that may have came accross this in the past. Sorry to have bothered you all. Thanks again John. On 11/07/06, Dennis Cote [EMAIL PROTECTED] wrote: John Newby

Re: [sqlite] Create Table Programatically

2005-04-18 Thread Jay Sprenkle
Callbacks are deprecated and harder to use in C++. try something like this: sqlite3* db; sqlite3_stmt *pStmt; intrc; bool Loop; char* p; inti; // Get configuration information for this website instance string sql

Re: [sqlite] Create Table Programatically

2005-04-16 Thread Dan Kennedy
It means there is a problem with the 'database' handle. Some likely causes are: * You never opened the database, * You've already called sqlite3_close() on the handle, * Another thread is using the handle (threads - just say no), or * Some other part of your program has accidentally overwritten

Re: [sqlite] create table question

2005-04-10 Thread Ken Deb Allen
So, would this problem still exist if the code were to open two 'connections' to the database, issue the SELECT on one open connection and then issue the CREATE TABLE via the other open connection? Does this in any way prevent an application from opening a single connection, issuing a SELECT,

  1   2   >