MXS-1719 Treat # comments the same way as -- comments
sqlite does not treat # as the start of a to-end-of-line comment. It cannot trivially be treated as such because at startup sqlite parses statements containing the #-character. Thus, only after sqlite has been initialized can it be treated the same way as --.
This commit is contained in:
parent
f5f454a29b
commit
776f199d01
@ -2110,15 +2110,25 @@ public:
|
||||
update_names(zDatabase, table, NULL, NULL);
|
||||
}
|
||||
|
||||
void maxscaleComment()
|
||||
int maxscaleComment()
|
||||
{
|
||||
ss_dassert(this_thread.initialized);
|
||||
// We are regularily parsing if the thread has been initialized.
|
||||
// In that case # should be interpreted as the start of a comment,
|
||||
// otherwise it should not.
|
||||
int regular_parsing = false;
|
||||
|
||||
if (m_status == QC_QUERY_INVALID)
|
||||
if (this_thread.initialized)
|
||||
{
|
||||
m_status = QC_QUERY_PARSED;
|
||||
m_type_mask = QUERY_TYPE_READ;
|
||||
regular_parsing = true;
|
||||
|
||||
if (m_status == QC_QUERY_INVALID)
|
||||
{
|
||||
m_status = QC_QUERY_PARSED;
|
||||
m_type_mask = QUERY_TYPE_READ;
|
||||
}
|
||||
}
|
||||
|
||||
return regular_parsing;
|
||||
}
|
||||
|
||||
void maxscaleDeclare(Parse* pParse)
|
||||
|
@ -198,6 +198,7 @@ int sqlite3IsIdChar(u8 c){ return IdChar(c); }
|
||||
** Store the token type in *tokenType before returning.
|
||||
*/
|
||||
#ifdef MAXSCALE
|
||||
extern int maxscaleComment();
|
||||
int sqlite3GetToken(Parse* pParse, const unsigned char *z, int *tokenType){
|
||||
#else
|
||||
int sqlite3GetToken(const unsigned char *z, int *tokenType){
|
||||
@ -219,8 +220,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
|
||||
case CC_MINUS: {
|
||||
if( z[1]=='-' ){
|
||||
#ifdef MAXSCALE
|
||||
extern void maxscaleComment();
|
||||
maxscaleComment();
|
||||
maxscaleComment();
|
||||
#endif
|
||||
for(i=2; (c=z[i])!=0 && c!='\n'; i++){}
|
||||
*tokenType = TK_SPACE; /* IMP: R-22934-25134 */
|
||||
@ -466,6 +466,13 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
|
||||
testcase( z[0]=='$' ); testcase( z[0]=='@' );
|
||||
testcase( z[0]==':' ); testcase( z[0]=='#' );
|
||||
#ifdef MAXSCALE
|
||||
if (z[0]=='#') {
|
||||
if (maxscaleComment()) {
|
||||
for(i=1; (c=z[i])!=0 && c!='\n'; i++){}
|
||||
*tokenType = TK_SPACE;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
if (z[0]==':' && z[1]=='=') {
|
||||
*tokenType = TK_EQ;
|
||||
return 2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user