The problem was that I'd started a transaction prior to attaching the
second database. Apparently that's not legal in SQLite3.
On a related issue, does anyone know if nested transactions are
planned for SQLite?
Thanks again to all those who tried to help!
-Greg
On Aug 19, 2005, at 10:08 AM, Puneet Kishor wrote:
Greg Stark wrote:
On Aug 19, 2005, at 9:37 AM, Puneet Kishor wrote:
Greg Stark wrote:
Tom,
I appreciate you're help but I'm pretty sure that the semicolon
has to be there (well. at least it's required in all the other
statements I've written to date -- this one statement is part
of a much large program that's working fine other than for
this one ATTACH).
My guess is that SQLite3 doesn't know where to find my
database, but I'm not sure how to tell it where to look.
well, have you tried giving it the full path name to the database?
You may have a good point. I've been entering the full path the
same way as I would in unix ('/Users/bsllc/Development/databases/
window_5.sdb'), but is this proper syntax for a path within SQLite3?
yeah, that is fine if you are on a Unix box. Change it to the
Windows path if you are on a Windows box (C:\\foo\\bar\\window_5.mdb).
>('/Users/bsllc/Development/databases/ window_5.sdb')
But you have a space above... (at least that is what seems to me in
my email.
-Greg
On Aug 19, 2005, at 6:07 AM, Thomas Briggs wrote:
I think that the semi-colon at the end of the statement is
what's
causing your problem. The command shell requires the semi-
colon to mark
the end of a statement; in code, your statement ends at the
end of the
string.
-Tom
-----Original Message-----
From: Greg Stark [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 18, 2005 7:38 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] How do I attach a database from C++?
I'm having difficulty attaching a database from C++.
Within my code, I'm using an sqlite3_prepare call:
prepareResult = pSqlBundle->sqlite3_prepare (db_,
"ATTACH
DATABASE 'window_5.sdb' AS W5;", -1, &attachSqlStmt,
&tailOfSqlStmt);
but it returns an error (i.e., prepareResult comes back as
SQLITE_ERROR).
Just to make sure that there were no problems with the
databases or
my syntax, I tried the attach command (i.e., ATTACH DATABASE
'window_5.sdb' AS W5;) from the command line, and everything
worked
fine. I tried using the full path name for the database-
filename,
but that didn't work either.
I'm sure it's something simple, but what I'm I doing wrong?
Thanks,
Greg