Casey Rodarmor wrote:> Hi all,
> unrecognized token: "x'01234'
>
> I know now that the problem was that the blob's length was not a
> multiple of two. However, the error message didn't give me an
> indication of that. Would it be possible to make the error message
> more explicit, to help users debug this error?

Blob literals are parsed in sqlite3GetToken():

    case CC_X: {
#ifndef SQLITE_OMIT_BLOB_LITERAL
      testcase( z[0]=='x' ); testcase( z[0]=='X' );
      if( z[1]=='\'' ){
        *tokenType = TK_BLOB;
        for(i=2; sqlite3Isxdigit(z[i]); i++){}
        if( z[i]!='\'' || i%2 ){
          *tokenType = TK_ILLEGAL;
          while( z[i] && z[i]!='\'' ){ i++; }
        }
        if( z[i] ) i++;
        return i;
      }
#endif

At the moment, this function has no mechanism to return an error message;
the only return value is TK_ILLEGAL (resulting in "unrecognized token").

It would be possible to add another parameter, or to introduce several
different TK_ILLEGAL_xxx codes.  However, blob literals are almost never
written by hand, so I doubt that the additional code and maintenance
effort are deemed worth the effort.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to