Unable to prepare a statement

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to prepare a statement

Sam Carleton-2
When I use the SQLite Manager, I am able to run this query just fine:

    UPDATE EventNode
       SET IsActive = 1
     WHERE EventNodeId IN (SELECT w.EventNodeId
                             FROM EventNode as w, EventNode as m on
m.objectId = 'a09f0f8a-a37c-44c2-846f-16a59b1c34c1'
                             WHERE w.lft BETWEEN m.lft AND m.rgt )

But when I try to prepare the same statement to be used with my C++ code:

    const char * updateString =
        "UPDATE EventNode "
           "SET IsActive = @isActive "
         "WHERE EventNodeId IN (SELECT w.EventNodeId "
                                 "FROM EventNode AS w, EventNode AS m ON
m.objectId = @objectId "
                                "WHERE w.lft BETWEEN m.lft AND m.rgt)";

I get an error where sqlite3_errmsg() returns: no such table: EventNode

Now the code that is opening the DB is in a base class which is used other
places to access the EventNode table, so I am a bit mystified as to what
exactly is going on.  Any thoughts?


--
Pax vobiscum,
Sam Carleton
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Unable to prepare a statement

Dan Kennedy-4
On 10/15/2014 07:19 AM, Sam Carleton wrote:

> When I use the SQLite Manager, I am able to run this query just fine:
>
>      UPDATE EventNode
>         SET IsActive = 1
>       WHERE EventNodeId IN (SELECT w.EventNodeId
>                               FROM EventNode as w, EventNode as m on
> m.objectId = 'a09f0f8a-a37c-44c2-846f-16a59b1c34c1'
>                               WHERE w.lft BETWEEN m.lft AND m.rgt )
>
> But when I try to prepare the same statement to be used with my C++ code:
>
>      const char * updateString =
>          "UPDATE EventNode "
>             "SET IsActive = @isActive "
>           "WHERE EventNodeId IN (SELECT w.EventNodeId "
>                                   "FROM EventNode AS w, EventNode AS m ON
> m.objectId = @objectId "
>                                  "WHERE w.lft BETWEEN m.lft AND m.rgt)";
>
> I get an error where sqlite3_errmsg() returns: no such table: EventNode
>
> Now the code that is opening the DB is in a base class which is used other
> places to access the EventNode table, so I am a bit mystified as to what
> exactly is going on.  Any thoughts?

Perhaps it's opening a different database file.

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Unable to prepare a statement

Sam Carleton-2
Yes, that was the case.  The app has two databases, a system wide DB and
the active data DB.  The system points to the active data DB but wasn't
configured to point to the active data.  Live and learn:)

Pax vobiscum,
Sam Carleton

On Wed, Oct 15, 2014 at 6:01 AM, Dan Kennedy <[hidden email]> wrote:

> On 10/15/2014 07:19 AM, Sam Carleton wrote:
>
>> When I use the SQLite Manager, I am able to run this query just fine:
>>
>>      UPDATE EventNode
>>         SET IsActive = 1
>>       WHERE EventNodeId IN (SELECT w.EventNodeId
>>                               FROM EventNode as w, EventNode as m on
>> m.objectId = 'a09f0f8a-a37c-44c2-846f-16a59b1c34c1'
>>                               WHERE w.lft BETWEEN m.lft AND m.rgt )
>>
>> But when I try to prepare the same statement to be used with my C++ code:
>>
>>      const char * updateString =
>>          "UPDATE EventNode "
>>             "SET IsActive = @isActive "
>>           "WHERE EventNodeId IN (SELECT w.EventNodeId "
>>                                   "FROM EventNode AS w, EventNode AS m ON
>> m.objectId = @objectId "
>>                                  "WHERE w.lft BETWEEN m.lft AND m.rgt)";
>>
>> I get an error where sqlite3_errmsg() returns: no such table: EventNode
>>
>> Now the code that is opening the DB is in a base class which is used other
>> places to access the EventNode table, so I am a bit mystified as to what
>> exactly is going on.  Any thoughts?
>>
>
> Perhaps it's opening a different database file.
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users