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

2007-10-11 Thread Samuel R. Neff
team building products. Position is in the Washington D.C. metro area. If interested contact [EMAIL PROTECTED] -Original Message- From: Virgilio Fornazin [mailto:[EMAIL PROTECTED] Sent: Thursday, October 11, 2007 2:21 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] how to get file

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

2007-10-11 Thread Virgilio Fornazin
I'm thinking about this.. to get a 'exact' copy of a sqlite database we should implement a new public API: sqlite3 * sqlite3_clonedb(sqlite3 * db, const char * szOutput); sqlite3 * sqlite3_clonedb16(sqlite3 * db, const void * szOutput); // utf-16 version this api can do the real file copy

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

2007-10-10 Thread Joe Wilson
> > sqlite3OsFileHandle no longer exists. > Can you tell me the first sqlite3 version to include this change? I'm guessing that it's 3.5.0 when most of the code was revised. Yahoo! oneSearch: Finally,

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

2007-10-10 Thread Andy Spencer
On Wed, 10 Oct 2007, Joe Wilson wrote: > --- Andy Spencer <[EMAIL PROTECTED]> wrote: > > I'm not sure what you mean by database "main", and I did not > > write the functions. > > The default database name (really more of an alias) is "main". > So "SELECT * from foo" and "SELECT * from main.foo"

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

2007-10-10 Thread Joe Wilson
--- Andy Spencer <[EMAIL PROTECTED]> wrote: > I'm not sure what you mean by database "main", and I did not > write the functions. The default database name (really more of an alias) is "main". So "SELECT * from foo" and "SELECT * from main.foo" are the same. Attached databases are known by the

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

2007-10-10 Thread Andy Spencer
On Wed, 10 Oct 2007, Joe Wilson wrote: > > At Schrodinger, we added two functions to our version of sqlite3: > > > > /* The sqlite3 APIs to get file descriptors fo the open files */ > > int sqlite3_get_database_file_fd( sqlite3* sqlite3_db_ptr ); > > int sqlite3_get_journal_file_fd( sqlite3*

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

2007-10-10 Thread John Stanton
Andy, Thank you for your note. It is very useful. Andy Spencer wrote: On Tue, 9 Oct 2007, Joe Wilson wrote: --- 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

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

2007-10-10 Thread Joe Wilson
--- Andy Spencer <[EMAIL PROTECTED]> wrote: > On Tue, 9 Oct 2007, Joe Wilson wrote: > > > --- 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

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

2007-10-10 Thread Andy Spencer
On Tue, 9 Oct 2007, Joe Wilson wrote: > --- 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. >

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

2007-10-10 Thread John Stanton
Cyrus Durgin" <[EMAIL PROTECTED]> To: <sqlite-users@sqlite.org> Sent: Wednesday, October 10, 2007 6:41 PM Subject: Re: [sqlite] how to get file handle from sqlite3 object? Agreed - it seems like this would be useful enough functionality that I'm not sure everyone who needs it

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

2007-10-10 Thread Joe Wilson
> There is a better workaround: get the code from the .dump command of sqlite3 > utility and use it... > it creates a fresh copy of your database like using > > sqlite3 dbold .dump | sqlite3 newdb (not sure about the syntax, thereĀ“s a > example of this > case on internet) This will always work

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

2007-10-10 Thread Virgilio Alexandre Fornazin
: Ronny Dierckx [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 10 de outubro de 2007 13:55 To: sqlite-users@sqlite.org Subject: Re: [sqlite] how to get file handle from sqlite3 object? I think a possible solution is to lock the database with a "BEGIN EXCLUSIVE" statement and then copy th

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

2007-10-10 Thread Cyrus Durgin
Agreed - it seems like this would be useful enough functionality that I'm not sure everyone who needs it should be reinventing the wheel... So is it fair to say that the sqlite3_file API methods are not useful for this purpose? The docs are a bit sparse regarding their intended purposes. On

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

2007-10-10 Thread John Stanton
There is a good case to have an Sqlite API call to take a snapshot of a database. It would integrate with the locking logic and secure an exclusive lock before taking the snapshot. That is a safer and handier approach than extracting a file descriptor and perhaps creating mayhem. Cyrus

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

2007-10-10 Thread Vitali Lovich
Two approaches - use sqlite, or use OS code. Use proper filesystem synchronization as appropriate for the given OS & filesystem, where you guarantee that your db copy is the only one that holds an exclusive lock. Then do the file copy and release the lock. The better approach, IMHO would be to

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