Re: [sqlite] Column headers of result

2009-07-04 Thread Simon Slavin
On 5 Jul 2009, at 2:35am, BareFeet wrote: > Hi Simon, Just a reminder that you're posting to a list, not to me personally. >> What are you trying to do ? Find all the columns in a TABLE or find >> all the columns in an arbitrary SELECT ? If it's the former use >> PRAGMA table_info for the ta

Re: [sqlite] Column headers of result

2009-07-04 Thread BareFeet
Hi Simon, >> In any case, it's not possible to convert an ad hoc query (ie not >> known beforehand) into one that returns no rows. > > Sure it is. Just add 'WHERE 1=2' to it if there's no WHERE clause, > or 'AND 1=2' if there is. Increasing potential complexity of the "ad hoc" SQL command wo

Re: [sqlite] Column headers of result

2009-07-04 Thread BareFeet
Hi Simon, How can I get just the column headers without all the result rows? >>> >>> Turn headers on, then perform a search which gives no results. >> >> Unfortunately, the sqlite3 command line tool does not show the >> headers >> when there are no result rows. In any case, it's nit possibl

Re: [sqlite] How to refer to a multiple-column primary key (PK) as 1 column (field) name

2009-07-04 Thread John Machin
On 5/07/2009 5:49 AM, James Scott wrote: > I have the following: > > CREATE TABLE [Sections] ( > [Department] varchar NOT NULL COLLATE NOCASE, > [Course] varchar NOT NULL COLLATE NOCASE, > [Section] varchar NOT NULL COLLATE NOCASE, > [Class_Time] timestamp, > [I_Id] varchar COLLATE NOCAS

Re: [sqlite] Re bind Statement

2009-07-04 Thread Simon Slavin
On 5 Jul 2009, at 12:50am, Indiff3rence wrote: > I'm new to SQLite programming. I need to insert a great number of > entries to > a DB, but my implementation is slow. > I've done a function that prepares a statement and returns it, like > this: > > const char *zSql = "INSERT INTO codewords( i

Re: [sqlite] Column headers of result

2009-07-04 Thread Simon Slavin
On 5 Jul 2009, at 12:31am, BareFeet wrote: > Hi Simon, > >>> How can I get just the column headers without all the result rows? >> >> Turn headers on, then perform a search which gives no results. > > Unfortunately, the sqlite3 command line tool does not show the headers > when there are no resul

Re: [sqlite] Column headers of result

2009-07-04 Thread Simon Davies
2009/7/5 BareFeet : >>> > Hi Simon, > >>> How can I get just the column headers without all the result rows? >> >> Turn headers on, then perform a search which gives no results. > > Unfortunately, the sqlite3 command line tool does not show the headers > when there are no result rows. In any case,

[sqlite] Re bind Statement

2009-07-04 Thread Indiff3rence
Hello, I'm new to SQLite programming. I need to insert a great number of entries to a DB, but my implementation is slow. I've done a function that prepares a statement and returns it, like this: const char *zSql = "INSERT INTO codewords( id, degree, seed, buffer ) VALUES( ?, ?, ?, ? )"; sqlite3

Re: [sqlite] Column headers of result

2009-07-04 Thread BareFeet
>> Hi Simon, >> How can I get just the column headers without all the result rows? > > Turn headers on, then perform a search which gives no results. Unfortunately, the sqlite3 command line tool does not show the headers when there are no result rows. In any case, it's nit possible to convert

Re: [sqlite] How to refer to a multiple-column primary key (PK) as 1 column (field) name

2009-07-04 Thread Simon Slavin
On 4 Jul 2009, at 8:49pm, James Scott wrote: > CREATE INDEX [PK_Sections] ON [Sections] ([Department], [Course], > [Section]); > > In the programming language, I need to refer to the primary key as 1 > field. > Does Sqlite allow a 'calculated field', such as concatenation of the 3 > columns in

[sqlite] How to refer to a multiple-column primary key (PK) as 1 column (field) name

2009-07-04 Thread James Scott
I have the following: CREATE TABLE [Sections] ( [Department] varchar NOT NULL COLLATE NOCASE, [Course] varchar NOT NULL COLLATE NOCASE, [Section] varchar NOT NULL COLLATE NOCASE, [Class_Time] timestamp, [I_Id] varchar COLLATE NOCASE, [Room] varchar COLLATE NOCASE, CONSTRAINT [sqlite_

Re: [sqlite] problem with SQLITE_BUSY

2009-07-04 Thread Dan
On Jul 4, 2009, at 8:12 PM, Wenton Thomas wrote: > I use prepare statements, and I am sure I finalize all of them. You may be mistaken. sqlite3_next_stmt() will return 0 if all statements really are finalized. assert( sqlite3_next_stmt(db, 0)==0 ); Dan. > > > > > >

Re: [sqlite] problem with SQLITE_BUSY

2009-07-04 Thread Wenton Thomas
I use prepare statements, and I am sure I finalize all of them. From: Igor Tandetnik To: sqlite-users@sqlite.org Sent: Saturday, July 4, 2009 8:44:52 PM Subject: Re: [sqlite] problem with SQLITE_BUSY Wenton Thomas wrote: > Now in my system I used sqlite

Re: [sqlite] problem with SQLITE_BUSY

2009-07-04 Thread Igor Tandetnik
Wenton Thomas wrote: > Now in my system I used sqlite to manage 2 database file A.db and > B.db, and each has a connection handle cA, cB. My operation perform > like this: > > > sqlite3_exec( select records from cA) > sqlite3_exec("begin transaction"); > insert all records into cB; > sqlite3_e

Re: [sqlite] problem with SQLITE_BUSY

2009-07-04 Thread Wenton Thomas
The two database file belongs to different modules. A module gets records from another through interfaces, not accesses other module's database file directly. The following statements sqlite3_exec( select records from cA) sqlite3_exec("begin transaction"); insert all records into cB

[sqlite] SQLite counters by "key" and "tempkey" extensions

2009-07-04 Thread Alexey Pechnikov
Hello! There is simple example for "tempkey" extension (Public Domain license): create table colors(name text); insert into colors values ('Red'); insert into colors values ('Green'); insert into colors values ('Blue'); select tempkey_install(); -- temp table "tempkeys" wiil be created select te

Re: [sqlite] problem with SQLITE_BUSY

2009-07-04 Thread freshie2004-sqlite
What about using only one connection and the ATTACH statement: http://www.sqlite.org/lang_attach.html Also, see the select-stmt form of the INSERT statement: http://www.sqlite.org/lang_insert.html Something like... sqlite3_open database B ATTACH DATABASE A.db AS dbA BEGIN INSERT INTO main.

[sqlite] sqlite-undo: loadable extension to give undo/redo functionality

2009-07-04 Thread freshie2004-sqlite
Hi All, As part of a project I am toying with writing I needed undo/redo functionality, so have ended up writing a loadable extension for sqlite which implements undo/redo functionality entirely within the database using custom functions. Kind-of a C implementation of http://www.sqlite.org/cvstrac

[sqlite] problem with SQLITE_BUSY

2009-07-04 Thread Wenton Thomas
Now in my system I used sqlite to manage 2 database file A.db and B.db, and each has a connection handle cA, cB. My operation perform like this: sqlite3_exec( select records from cA) sqlite3_exec("begin transaction"); insert all records into cB; sqlite3_exec("commit transaction"); All ret

Re: [sqlite] referential integrity and INSERT OR REPLACE

2009-07-04 Thread Kees Nuyt
On Fri, 03 Jul 2009 14:38:43 -0700, James Gregurich wrote: > >nuts. that makes INSERT OR REPLACE worthless if you have tables >dependent on one another. > > >Is there any way to manually get a list of records for which there >would be a conflict if a given record was inserted? BEGIN; INSERT