Re: [sqlite] how to get file handle from sqlite3 object?

2007-10-09 Thread Cyrus Durgin
Maybe it would help to state my use case: without this functionality, what is the proper way to copy a database using the C API without introducing a race condition? On 10/9/07, Robert Simpson <[EMAIL PROTECTED]> wrote: > > > -Original Message- > > From: Cyrus Durgin [mailto:[EMAIL

Re: [sqlite] how to get file handle from sqlite3 object?

2007-10-09 Thread Joe Wilson
--- Cyrus Durgin <[EMAIL PROTECTED]> wrote: > i'm wondering if there's a "standard" way to get an open file handle from an > sqlite3 pointer using the C API. anyone know? Patch below implements getting a file descriptor for a UNIX database using the existing sqlite3 API function

RE: [sqlite] how to get file handle from sqlite3 object?

2007-10-09 Thread Robert Simpson
> -Original Message- > From: Cyrus Durgin [mailto:[EMAIL PROTECTED] > Sent: Tuesday, October 09, 2007 5:02 PM > To: sqlite-users@sqlite.org > Subject: [sqlite] how to get file handle from sqlite3 object? > > i'm wondering if there's a "standard" way to get an open file > handle from an

Re: [sqlite] how to get file handle from sqlite3 object?

2007-10-09 Thread Joe Wilson
--- Cyrus Durgin <[EMAIL PROTECTED]> wrote: > i'm wondering if there's a "standard" way to get an open file handle from an > sqlite3 pointer using the C API. anyone know? No such function exists, but it would be a useful addition to the API. Copying the database during an exclusive lock without

Re: [sqlite] how to get file handle from sqlite3 object?

2007-10-09 Thread Vitali Lovich
Can you please clarify why this would be needed? Sqlite databases are opened by name, thereby you can use standard OS or stdlib functions to open the same file with a different handle. Cyrus Durgin wrote: i'm wondering if there's a "standard" way to get an open file handle from an sqlite3

Re: [sqlite] SELECT crashes with small cache?

2007-10-09 Thread Richard Klein
Joe Wilson wrote: --- Richard Klein <[EMAIL PROTECTED]> wrote: I am seeing SQLite crashing during execution of a SELECT statement when I make the page cache very small (40 pages). When I bump the cache up to 50 pages, the problem goes away. The problem only occurs on my RISC platform, not on

[sqlite] how to get file handle from sqlite3 object?

2007-10-09 Thread Cyrus Durgin
i'm wondering if there's a "standard" way to get an open file handle from an sqlite3 pointer using the C API. anyone know? -- Cyrus. <[EMAIL PROTECTED]>

Re: [sqlite] auto library function loading

2007-10-09 Thread Kees Nuyt
On Tue, 9 Oct 2007 07:06:48 -0700 (PDT), you wrote: > Is there a way for SQLITE to automatically load user > defined functions at database instantiation or upon > database connection? You can put a file .sqliterc in the users homedirectory with commands for the command line tool. They will be

[sqlite] Re: Reading error outside the while

2007-10-09 Thread Igor Tandetnik
[EMAIL PROTECTED] wrote: sqlite3_open(dbname, ); sqlite3_prepare_v2(db, sql, -1, , 0); while(sqlite3_step(pStat) == SQLITE_ROW) { row = (char *)sqlite3_column_text(pStat, 0); my_array[i] = malloc( sizeof row * sizeof *my_array[i]); memcpy (my_array[i], row, sizeof row * sizeof

Re[2]: [sqlite] Reading error outside the while

2007-10-09 Thread Teg
The original example's an accident waiting to happen. You've hard coded the results to 3 but, not limited the number of loops in the while loop so, you could easily crash/corrupt the stack. You'll crash if you have less than 3 results too. What happens if you only get one result from the while

Re: [sqlite] auto library function loading

2007-10-09 Thread John Stanton
Ken wrote: Is there a way for SQLITE to automatically load user defined functions at database instantiation or upon database connection? Can it test for a .so/.dll and perform a call to load user functions? If the .dll does not exist maybe issue a warning? Just a thought as a way to

Re: [sqlite] Reading error outside the while

2007-10-09 Thread [EMAIL PROTECTED]
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Hello, I got an error when I try to read some data outside the while{}, inside the while{} it's ok, an idea ? test.db have just one "table1" and a "field1" with values "one", "two", "three". #include #include int main(void) { sqlite3

Re: [sqlite] Reading error outside the while

2007-10-09 Thread [EMAIL PROTECTED]
Simon Davies a écrit : On 09/10/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hello, I got an error when I try to read some data outside the while{}, inside the while{} it's ok, an idea ? test.db have just one "table1" and a "field1" with values "one", "two", "three". . . . const

Re: [sqlite] Reading error outside the while

2007-10-09 Thread Ken
You need to make a copy of the str instead of just capturing a pointer reference. try: my_array[i] = strdup(sqlite3_column_text(pStat, 0)); "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Hello, I got an error when I try to read some data outside the while{}, inside the while{} it's

Re: [sqlite] Reading error outside the while

2007-10-09 Thread John Stanton
[EMAIL PROTECTED] wrote: Hello, I got an error when I try to read some data outside the while{}, inside the while{} it's ok, an idea ? test.db have just one "table1" and a "field1" with values "one", "two", "three". #include #include int main(void) { sqlite3 *db; sqlite3_stmt

[sqlite] auto library function loading

2007-10-09 Thread Ken
Is there a way for SQLITE to automatically load user defined functions at database instantiation or upon database connection? Can it test for a .so/.dll and perform a call to load user functions? If the .dll does not exist maybe issue a warning? Just a thought as a way to allow users

Re: [sqlite] Reading error outside the while

2007-10-09 Thread Simon Davies
On 09/10/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello, > > I got an error when I try to read some data outside the while{}, inside the > while{} it's ok, an idea ? > test.db have just one "table1" and a "field1" with values "one", "two", > "three". . . . >const unsigned char

[sqlite] Reading error outside the while

2007-10-09 Thread [EMAIL PROTECTED]
Hello, I got an error when I try to read some data outside the while{}, inside the while{} it's ok, an idea ? test.db have just one "table1" and a "field1" with values "one", "two", "three". #include #include int main(void) { sqlite3 *db; sqlite3_stmt *pStat; const char *dbname =

Re: [sqlite] Null-ifying the columns

2007-10-09 Thread Dan Kennedy
On Mon, 2007-10-08 at 02:03 -0700, chetana bhargav wrote: > SQL Guru's, > > Want to know is there any easy way to make all the columns in a particular > row to NULL other than specifying column name and NULL value, no delete as > that would change the row-id What happens if you do: INSERT