FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DBIException: near "u": syntax error

 
Post new topic   Reply to topic     Forum Index -> DDBI
View previous topic :: View next topic  
Author Message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Wed Mar 21, 2007 11:35 pm    Post subject: DBIException: near "u": syntax error Reply with quote

Greetings!

After I updated my system to 2.5r62 using SqliteDatabase, I have been getting these annoying syntax errors,
Code:
DBIException: near "u": syntax error

which happen all the time. I have not figured out why or how to replicate it constantly, but they do happen usually. Any ideas? Here is the one that caused this one post...

INSERT INTO LSOpenJobs ( ProjID, parent, children, login, cust, proj, PClass, PSubClass, bdate, ddate, edate, pm, pmuk, lang, vendor, vEmail, invoice, ProjFund, PMTime, A_No, wDir, BiliDir, TMDir, DeliveryDir, paid, notes, status ) values ('254', '254', '', 'us319318', 'Merrimack', '3.0 Quick Cards', 'Technical', 'XTranslate', '2007-02-21', '2007-02-21', '', 'us319318', 'piva, karina', 'en2es,en2br', '', 'karina@x.com', '', '', '', 'A36XPP02', 'D:\Projects\Analysis\Merrimack\07-02-21-Merrimack-3.0-Quick-Cards_254', '', '', '', 'n', ' - ProjID 166 copy. - ProjID 254 copy. - ProjID 264 copy.', 'o' );

The INSERT works and so this message is bogus, but why is this complaining so much? I am sending it with the
Code:
db.execute (cmd);

which never had a problem before I upgraded to 2.5r62.

Any help would be greatly appreciated.

thanks,

jose
Back to top
View user's profile Send private message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Tue Mar 27, 2007 12:16 am    Post subject: Reply with quote

I guess no one has seen this problem?
Back to top
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Tue Mar 27, 2007 8:55 am    Post subject: Reply with quote

Well, I don't use SQLite, but if I had to take a stab at it I would try using the query in a query analyzer (if possible), to remove D and DDBI from the equation.

Failing that, we must dig deeper - look at where the letter 'u' comes up in the query. Do you get this error with different data?

To me, this looks like a query parser/syntax issue. The first token-boundary that starts with 'u' is the value 'us319318'. If you back up a bit you'll see that you have two single-quotes for the empty-value before it:

Code:
'', 'us319318'


It might be possible that SQLite mis-interprets the back-to-back single quotes here (read: a bug), and is reading that as an escaped single-quote token. That would yield the following token sequence:

Code:
<single-quote> <comma> <single-quote> "us319318" <single-quote>

instead of:
Code:
<single-quote> <single-quote> <comma> <single-quote> "us319318" <single-quote>

Subtle, but significant. The former would throw a syntax error at the "u" in your column value, since it would expect to see a comma or a right paren.

This would suggest that if you try an insert with no empty values, the problem would suddenly go away and there is indeed a bug. Alternately, try inserting against a smaller table with empty values in this way, to see what results you get.
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Fri Mar 30, 2007 3:44 pm    Post subject: Reply with quote

Sorry, busy as heck...

pragma wrote:
Well, I don't use SQLite, but if I had to take a stab at it I would try using the query in a query analyzer (if possible), to remove D and DDBI from the equation.


I'll ask the SQLite forum. Thanks.

pragma wrote:
Failing that, we must dig deeper - look at where the letter 'u' comes up in the query. Do you get this error with different data?


Yes. I have been playing with this for a while, now. This is a perfectly defined SQLite UPDATE. The funny part is, I try it again, and it works after a few times. I don't think the DB is busy or anything like that. I am trying to figure out how to use ErrorCode to see what error it is giving.

pragma wrote:
To me, this looks like a query parser/syntax issue. The first token-boundary that starts with 'u' is the value 'us319318'. If you back up a bit you'll see that you have two single-quotes for the empty-value before it:

Code:
'', 'us319318'




Yeah, but this is what all of the UPDATEs look like.

pragma wrote:
It might be possible that SQLite mis-interprets the back-to-back single quotes here (read: a bug), and is reading that as an escaped single-quote token. That would yield the following token sequence:

Code:
<single-quote> <comma> <single-quote> "us319318" <single-quote>

instead of:
Code:
<single-quote> <single-quote> <comma> <single-quote> "us319318" <single-quote>

Subtle, but significant. The former would throw a syntax error at the "u" in your column value, since it would expect to see a comma or a right paren.


I'll take a look at it...

pragma wrote:
This would suggest that if you try an insert with no empty values, the problem would suddenly go away and there is indeed a bug. Alternately, try inserting against a smaller table with empty values in this way, to see what results you get.


Thanks for the help. I'll come back, but I have a hunch that something else is going on...

thanks.

jose
Back to top
View user's profile Send private message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Wed May 09, 2007 3:10 pm    Post subject: Reply with quote

I am starting to figure out that I may be sending a command when sqlite is busy. How do use

SQLITE_OK

with ddbi? I see all of these options in the imp.d, but how do I use them? There is no example available. Any help would be greatly appreciated.

thanks,

jose
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DDBI All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group