I'm not sure that this is the conceptual no-brainer it may sound
like.  For example, transaction management changes significantly when
dealing with attached databases (you need a master journal, for
starters).  My hunch is that internally SQLite does more than just
open a handle when attaching a database file, so I don't think that
having a pre-existing handle will make it any easier to attach a
database file.

   It's been more than a year since I looked at the SQLite source code
though, so I could be wrong. :)

   -T


On Fri, Oct 17, 2008 at 3:53 AM, MikeW <[EMAIL PROTECTED]> wrote:
> John Belli <[EMAIL PROTECTED]> writes:
>>
>> On Thu, 16 Oct 2008 17:54:52 +0000 (UTC), MikeW
>> <[EMAIL PROTECTED]> wrote:
>>
>> >My code has two pre-opened DB connection handles, and would like to
>> >perform an SQL operation over the two databases.
>> >The DB filenames are not available at this point, hence an ATTACH is
>> >not feasible.
>> >Is there any way to achieve this by applying an ATTACH at the handle level ?
>>
>> I don't think so, but check into "PRAGMA database_list" (See
>> http://www.sqlite.org/pragma.html ).
>>
>> JAB
>
> Thanks, that might be useful in some situations but not in this one.
>
> The use case is a very specific one in which a database may contain one-off
> overrides for a second, normally independent (but already opened) database.
> I can obviously implement this by reading rows from the first one
> and updating the second, but if I could briefly refer to both DBs at
> the same time, it would be just one 'atomic' SQL statement -
> much simpler and more robust.
>
> Still, it seems surprising that there isn't a (SQLite-specific) handle-level
> operation to do this attach, maybe I should put in a feature request.
> (Or even have a look in the SQLite code to see if it's an easy mod ...)
>
> MikeW
>
>
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to