Re: [sqlite] attaching databases programmatically

2013-07-22 Thread Nelson, Erik - 2
Marc L. Allen wrote on Monday, July 22, 2013 10:55 AM
> 
> I see.  Sorry about that!
> 
> I guess the real problem is the in-memory ones.  The other ones must
> have a database file associated with them, right?
> 

Probably, but that doesn't mean that the file is accessible through a filename 
that can be understood by the "ATTACH" SQL statement.

For example, if the file handle is procured by sqlite and then the file is 
subsequently deleted, it's no longer available through a filename.  Or as 
Richard Hipp mentioned, the filename may refer to a space that the application 
can't currently get to, like a chroot jail.

Erik

--
This message, and any attachments, is for the intended recipient(s) only, may 
contain information that is privileged, confidential and/or proprietary and 
subject to important terms and conditions available at 
http://www.bankofamerica.com/emaildisclaimer.   If you are not the intended 
recipient, please delete this message.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] attaching databases programmatically

2013-07-22 Thread Richard Hipp
On Mon, Jul 22, 2013 at 10:47 AM, Marc L. Allen  wrote:

> Perhaps I misunderstood the question.  It sounds like he has the sqlite*
> objects for the databases, but wants to be able to determine the
> database/filename associated with them so he can construct an ATTACH
> statement in another query.
>
> So.. the question is.. given an sqlite*, can you determine the underlying
> database/filename?
>

The answer to Marc's question is "yes":
http://www.sqlite.org/c3ref/db_filename.html

But I think (I might be wrong) that Erik is asking something different.  In
particular, Erik indicated that the database is in an inaccessible
namespace (is that like a chroot jail or something?) and is thus
inaccessible.
-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] attaching databases programmatically

2013-07-22 Thread Nelson, Erik - 2
Richard Hipp wrote on  Monday, July 22, 2013 10:28 AM
> 
> On Mon, Jul 22, 2013 at 10:19 AM, Nelson, Erik wrote:
> 
> > I've got an application that allows the user to create an arbitrary
> > number of databases, either in memory or not.  In my C++ program, I
> > have the handles and I'd like to attach them all together so the user
> > can execute queries against them.  However, the only way that I've
> > found to do that is to use the "ATTACH" sql.  The problem is that the
> > sqlite3* exist, but the databases aren't in any namespace accessible
> >to the "ATTACH" query.
> >
> > Is there some way to programmatically attach databases when all you
> > have are the sqlite3 handles?
> >
> 
> No.  The only way to ATTACH a database is via the ATTACH command, which
> will invoke the xOpen method of the VFS to open the file.  If the file
> is no longer accessible, then it cannot be attached.  There is no way
> to transfer an open file from one database connection to another.
> 

Understood.  Thanks for the speedy response, and extra thanks for the 
outstanding sqlite3 project.

Erik

--
This message, and any attachments, is for the intended recipient(s) only, may 
contain information that is privileged, confidential and/or proprietary and 
subject to important terms and conditions available at 
http://www.bankofamerica.com/emaildisclaimer.   If you are not the intended 
recipient, please delete this message.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] attaching databases programmatically

2013-07-22 Thread Marc L. Allen
Perhaps I misunderstood the question.  It sounds like he has the sqlite* 
objects for the databases, but wants to be able to determine the 
database/filename associated with them so he can construct an ATTACH statement 
in another query.

So.. the question is.. given an sqlite*, can you determine the underlying 
database/filename?

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Dušan Paulovic
Sent: Monday, July 22, 2013 10:35 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] attaching databases programmatically

Perhaps you can create new connection with multiple virtual tables reading from 
all connections. But it is hard work...


2013/7/22 Nelson, Erik - 2 

> I've got an application that allows the user to create an arbitrary 
> number of databases, either in memory or not.  In my C++ program, I 
> have the handles and I'd like to attach them all together so the user 
> can execute queries against them.  However, the only way that I've 
> found to do that is to use the "ATTACH" sql.  The problem is that the 
> sqlite3* exist, but the databases aren't in any namespace accessible to the 
> "ATTACH" query.
>
> Is there some way to programmatically attach databases when all you 
> have are the sqlite3 handles?
>
> I've read the list history, most of the conversations about this are a 
> few years back.
>
> Thanks
>
> Erik
>
> --
> This message, and any attachments, is for the intended recipient(s) 
> only, may contain information that is privileged, confidential and/or 
> proprietary and subject to important terms and conditions available at
> http://www.bankofamerica.com/emaildisclaimer.   If you are not the
> intended recipient, please delete this message.
> ___
> 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


This email and any attachments are only for use by the intended recipient(s) 
and may contain legally privileged, confidential, proprietary or otherwise 
private information. Any unauthorized use, reproduction, dissemination, 
distribution or other disclosure of the contents of this e-mail or its 
attachments is strictly prohibited. If you have received this email in error, 
please notify the sender immediately and delete the original.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] attaching databases programmatically

2013-07-22 Thread Marc L. Allen
I see.  Sorry about that!

I guess the real problem is the in-memory ones.  The other ones must have a 
database file associated with them, right?

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Nelson, Erik - 2
Sent: Monday, July 22, 2013 10:51 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] attaching databases programmatically

Marc L. Allen wrote on Monday, July 22, 2013 10:47 AM
> Nelson, Erik wrote:
> > I've got an application that allows the user to create an arbitrary 
> > number of databases, either in memory or not.  In my C++ program, I 
> > have the handles and I'd like to attach them all together so the 
> > user can execute queries against them.  However, the only way that 
> > I've found to do that is to use the "ATTACH" sql.  The problem is 
> > that the
> > sqlite3* exist, but the databases aren't in any namespace accessible
> to the "ATTACH" query.
> >
> > Is there some way to programmatically attach databases when all you 
> > have are the sqlite3 handles?

> Perhaps I misunderstood the question.  It sounds like he has the
> sqlite* objects for the databases, but wants to be able to determine 
> the database/filename associated with them so he can construct an 
> ATTACH statement in another query.
> 
> So.. the question is.. given an sqlite*, can you determine the 
> underlying database/filename?

Yes, you misunderstood it the databases are programmatically generated- 
there is no file name.


Erik

--
This message, and any attachments, is for the intended recipient(s) only, may 
contain information that is privileged, confidential and/or proprietary and 
subject to important terms and conditions available at 
http://www.bankofamerica.com/emaildisclaimer.   If you are not the intended 
recipient, please delete this message.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


This email and any attachments are only for use by the intended recipient(s) 
and may contain legally privileged, confidential, proprietary or otherwise 
private information. Any unauthorized use, reproduction, dissemination, 
distribution or other disclosure of the contents of this e-mail or its 
attachments is strictly prohibited. If you have received this email in error, 
please notify the sender immediately and delete the original.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] attaching databases programmatically

2013-07-22 Thread Richard Hipp
On Mon, Jul 22, 2013 at 10:19 AM, Nelson, Erik - 2 <
erik.l.nel...@bankofamerica.com> wrote:

> I've got an application that allows the user to create an arbitrary number
> of databases, either in memory or not.  In my C++ program, I have the
> handles and I'd like to attach them all together so the user can execute
> queries against them.  However, the only way that I've found to do that is
> to use the "ATTACH" sql.  The problem is that the sqlite3* exist, but the
> databases aren't in any namespace accessible to the "ATTACH" query.
>
> Is there some way to programmatically attach databases when all you have
> are the sqlite3 handles?
>

No.  The only way to ATTACH a database is via the ATTACH command, which
will invoke the xOpen method of the VFS to open the file.  If the file is
no longer accessible, then it cannot be attached.  There is no way to
transfer an open file from one database connection to another.

-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] attaching databases programmatically

2013-07-22 Thread Dušan Paulovič
Perhaps you can create new connection with multiple virtual tables reading
from all connections. But it is hard work...


2013/7/22 Nelson, Erik - 2 

> I've got an application that allows the user to create an arbitrary number
> of databases, either in memory or not.  In my C++ program, I have the
> handles and I'd like to attach them all together so the user can execute
> queries against them.  However, the only way that I've found to do that is
> to use the "ATTACH" sql.  The problem is that the sqlite3* exist, but the
> databases aren't in any namespace accessible to the "ATTACH" query.
>
> Is there some way to programmatically attach databases when all you have
> are the sqlite3 handles?
>
> I've read the list history, most of the conversations about this are a few
> years back.
>
> Thanks
>
> Erik
>
> --
> This message, and any attachments, is for the intended recipient(s) only,
> may contain information that is privileged, confidential and/or proprietary
> and subject to important terms and conditions available at
> http://www.bankofamerica.com/emaildisclaimer.   If you are not the
> intended recipient, please delete this message.
> ___
> 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


Re: [sqlite] attaching databases programmatically

2013-07-22 Thread Nelson, Erik - 2
Marc L. Allen wrote on Monday, July 22, 2013 10:47 AM
> Nelson, Erik wrote:
> > I've got an application that allows the user to create an arbitrary
> > number of databases, either in memory or not.  In my C++ program, I
> > have the handles and I'd like to attach them all together so the user
> > can execute queries against them.  However, the only way that I've
> > found to do that is to use the "ATTACH" sql.  The problem is that the
> > sqlite3* exist, but the databases aren't in any namespace accessible
> to the "ATTACH" query.
> >
> > Is there some way to programmatically attach databases when all you
> > have are the sqlite3 handles?

> Perhaps I misunderstood the question.  It sounds like he has the
> sqlite* objects for the databases, but wants to be able to determine
> the database/filename associated with them so he can construct an
> ATTACH statement in another query.
> 
> So.. the question is.. given an sqlite*, can you determine the
> underlying database/filename?

Yes, you misunderstood it the databases are programmatically generated- 
there is no file name.


Erik

--
This message, and any attachments, is for the intended recipient(s) only, may 
contain information that is privileged, confidential and/or proprietary and 
subject to important terms and conditions available at 
http://www.bankofamerica.com/emaildisclaimer.   If you are not the intended 
recipient, please delete this message.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users