Home » U++ Library support » U++ SQL » ParseForArguments does not take comments in account
ParseForArguments does not take comments in account [message #26736] |
Sun, 23 May 2010 23:01 |
frankdeprins
Messages: 99 Registered: September 2008 Location: Antwerp - Belgium
|
Member |
|
|
Hi,
As I already pointed out in another thread, 'SQLITE3: Bind parameter by name', the function ParseForArguments in Sqlite3upp.cpp mistakingly counts question marks inside comments as bind variables, making it impossible to execute such statements.
I made some modifications to this function to correct this behaviour and would appreciate if you would consider it for inclusion.
int ParseForArgs(const char* sqlcmd)
{
int numargs = 0;
const char* ptr = sqlcmd;
while (*ptr)
if(*ptr == '\'')
while(*++ptr && (*ptr != '\'' || *++ptr && *ptr == '\''))
;
else if(*ptr == '-' && *++ptr && *ptr == '-')
while(*++ptr && *ptr != '\n' && *ptr != '\r')
;
else if(*ptr == '/' && *++ptr && *ptr == '*')
while(*++ptr && *ptr != '*' && *++ptr && *ptr != '/')
;
else if(*ptr++ == '?')
++numargs;
return numargs;
}
frank
|
|
|
Goto Forum:
Current Time: Thu Mar 28 12:56:55 CET 2024
Total time taken to generate the page: 0.01068 seconds
|