kawasin73 / prsqlite

Pure Rust implementation of SQLite
Apache License 2.0
563 stars 23 forks source link

Parse blob literal #18

Closed kawasin73 closed 1 year ago

kawasin73 commented 1 year ago

https://www.sqlite.org/lang_expr.html#literal_values_constants_

kawasin73 commented 1 year ago
    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
      /* If it is not a BLOB literal, then it must be an ID, since no
      ** SQL keywords start with the letter 'x'.  Fall through */
      /* no break */ deliberate_fall_through
    }