Re: [sqlite] Locking Methods

2005-04-20 Thread Ben Clewett
This is exactly my problem. My version is 3.1.6. The error is SQLITE_LOCKED. Ben Jay Sprenkle wrote: I had the same trouble he did. Here's what I did that doesn't work: select * from a into result; foreach row in result ' this fails: update b set col = a.value; next But

Re: [sqlite] CASE WHEN .. END AS 'blah' problem

2005-04-20 Thread John LeSueur
Steve Babineau wrote: Hello all, I'm having a problem here that seemed to work for SQLite < v3. When I do have a query like: SELECT UPPER(col1)|| '' '|| col2|| ' '|| CASE WHEN col3 IS NULL THEN ''19XX'' ELSE col3 END AS 'col3'|| ' ' FROM mytable; I get an error: near "||": syntax error.

[sqlite] querying schema for integer primary key

2005-04-20 Thread Harald Fernengel
Hi, does anyone know how I can query an existing database schema to figure out whether a integer in a table is a "integer primary key" or just a plain "integer"? Thanks, Harald

Re: [sqlite] querying schema for integer primary key

2005-04-20 Thread Witold Czarnecki
Try: sqlite>.schema TableName ...will display table definition. Best regards, Witold

Re: [sqlite] querying schema for integer primary key

2005-04-20 Thread Harald Fernengel
Hi, On Wednesday 20 April 2005 14:25, Harald Fernengel wrote: > does anyone know how I can query an existing database schema to figure out > whether a integer in a table is a "integer primary key" or just a plain > "integer"? ...replying to myself... The pragma table_info returns the info

Re: [sqlite] SQLite on Motorola Power PC

2005-04-20 Thread Ulrik Petersen
Hi, Cem Vedat ISIK wrote: Thank you very much for your reply, I'm using gcc but I think I have nothing to do with a Mac, since the PowerPC I mention is not the PowerPC of Macintosh. I'm working on a Motorola PowerPC. Last time I checked, Motorola were one of the vendors delivering PowerPC chips

Re: [sqlite] Locking Methods

2005-04-20 Thread Jay Sprenkle
With the current design you have to save your query results to memory then do your updates from that list. On 4/20/05, Ben Clewett <[EMAIL PROTECTED]> wrote: > This is exactly my problem. My version is 3.1.6. The error is > SQLITE_LOCKED. > > Ben > > Jay Sprenkle wrote: > > I had the same

[sqlite] Wrapper function to obtain a result query table in memory, leaving no lock.

2005-04-20 Thread Ben Clewett
Dear SQLite users, I have put together a small wrapper function to illustrate a method of completing a query which will not leave any lock on the database. This takes the response of a query, eg, "SELECT * FROM table" and returns a memory resident array containing the result. You may keep the

Re: [sqlite] Wrapper function to obtain a result query table in memory, leaving no lock.

2005-04-20 Thread F.W.A. van Leeuwen
I assume something is missing in your example. There seems to be no connection between the 'result' variable and the sw_cell() calls. > result = sw_query(sqlite_handle, "SELECT * FROM table"); > printf("Data %s, %s, %s\n", sw_cell(0, 0), sw_cell(0, 1), sw_cell(0, 2)); best regards Frank

RE: [sqlite] Locking Methods

2005-04-20 Thread Thomas Briggs
What APIs are you guys using to retrieve results and execute the subsequent updates? Are you using prepare/step or sqlite3_exec with a callback to retrieve the results? Would it be possible for you to post more detailed pseudo-code? Conceptually I think we're all on the same page; I think

Re: [sqlite] Wrapper function to obtain a result query table in memory, leaving no lock.

2005-04-20 Thread Ben Clewett
Frank, You spotted the deliberate error! :) The call is indeed: const unsigned char *sw_cell(sw_result *result, int column, int row); So the example should read: printf("Data %s, %s, %s\n", sw_cell(result, 0, 0), sw_cell(result, 0, 1), sw_cell(result, 0, 2)); Ben

Re: [sqlite] Locking Methods

2005-04-20 Thread Jay Sprenkle
I prepared the statement and executed it. Preparing doesn't use callbacks and prevents sql injection attacks. I used a C++ class to store the query results in an STL container. brief C/C++ pseudocode: string sql = "select * from blah"; sqlite3_open(); sqlite3_prepare( sql ); bool Loop = true;

Re: [sqlite] Locking Methods

2005-04-20 Thread Kervin L. Pierre
That's part of the problem I had been having... 1) You have to loop through the resultset twice, once to put it in memory, the other to process it in your application. 2) The sqlite3_prepare() and sqlite3_finalize() both should be in a loop as well right? Since they can throw SQLITE_BUSY and

RE: [sqlite] Locking Methods

2005-04-20 Thread Thomas Briggs
What did your code look like before you started storing results in memory? > -Original Message- > From: Jay Sprenkle [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 20, 2005 10:06 AM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Locking Methods > > I prepared the

Re: [sqlite] Locking Methods

2005-04-20 Thread Jay Sprenkle
> 1) You have to loop through the resultset twice, > once to put it in memory, the other to process > it in your application. Yes. > > 2) The sqlite3_prepare() and sqlite3_finalize() > both should be in a loop as well right? Since > they can throw SQLITE_BUSY and SQLITE_SCHEMA > themselves.

Re: [sqlite] NFS Query Performance

2005-04-20 Thread William Hachfeld
Good suggestions, guys! First, I modified the previously-posted test program to time the insertion rate outside of the transaction (i.e. Kilnt's suggestion). I left the creation of the table, however, outside of the timed insertion loop. In other words: Create Table Begin Timing

Re: [sqlite] SQLite on Motorola Power PC

2005-04-20 Thread Christian Smith
On Mon, 18 Apr 2005, Cem Vedat ISIK wrote: >Having a lot of cross compiling trials and errors, I have decided not to >cross compile, but to compile the SQLite on Motorola PowerPC itself. If this is still the config.h issue, I have made some changes to allow compiling without config.h being

Re: [sqlite] Re: SEGV (from Perl DBI) trying to run $sth->{TYPE}->[n] on a view

2005-04-20 Thread Will Leshner
On 4/19/05, Peter Shenkin <[EMAIL PROTECTED]> wrote: > In response to Will Leshner, could you tell me how to access this > functionality from the sqlite3 shell? I'll then try it and > respond. Thanks, -P. Ah. Good point. You can't. Sorry about that. I was trying to think of a way to determine

Re: [sqlite] SQLite on Motorola Power PC

2005-04-20 Thread Ted Unangst
Christian Smith wrote: On Mon, 18 Apr 2005, Cem Vedat ISIK wrote: Having a lot of cross compiling trials and errors, I have decided not to cross compile, but to compile the SQLite on Motorola PowerPC itself. If this is still the config.h issue, I have made some changes to allow compiling without

[sqlite] Re: SEGV (from Perl DBI) trying to run $sth->{TYPE}->[n] on a view

2005-04-20 Thread Peter Shenkin
Thanks, Will. I understand what you were trying to get at. Glad to know I wasn't missing something when I couldn't figure out how to do this from the sqlite3 shell. I guess I can learn the C API and try that way -P.

[sqlite] how to localize the errror message?

2005-04-20 Thread liigo
I want to localize the error message of sqlite, such as: errcode=1: "No such table: xx" But where is the message in the source file?