MXS-2398 Handle MariaDB specific comments
Same approach as with regular comments: - /*M! STMT */ are always parsed. - /*M!###### STMT */ are never parsed.
This commit is contained in:
		| @ -255,21 +255,27 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ | |||||||
|         return 1; |         return 1; | ||||||
|       } |       } | ||||||
| #ifdef MAXSCALE | #ifdef MAXSCALE | ||||||
|       if ( z[2] == '!' ){ |       if ( z[2]=='!' || (z[2]=='M' && z[3]=='!')){ | ||||||
|  |         int j = (z[2]=='M' ? 4 : 3); | ||||||
|         // MySQL-specific code |         // MySQL-specific code | ||||||
|         for (i=3, c=z[2]; (c!='*' || z[i]!='/') && (c=z[i])!=0; i++){} |         for (i=j, c=z[j-1]; (c!='*' || z[i]!='/') && (c=z[i])!=0; i++){} | ||||||
|         if (c=='*' && z[i]=='/'){ |         if (c=='*' && z[i]=='/'){ | ||||||
|           if (sqlite3Isdigit(z[3])) { |           if (sqlite3Isdigit(z[j])) { | ||||||
|             // A version specific executable comment, e.g. "/*!99999 ..." => never parsed. |             // A version specific executable comment, | ||||||
|  |             // e.g. "/*!99999 ..." or "/*M!99999 ..." => never parsed. | ||||||
|             extern void maxscaleSetStatusCap(int); |             extern void maxscaleSetStatusCap(int); | ||||||
|             maxscaleSetStatusCap(2); // QC_QUERY_PARTIALLY_PARSED, see query_classifier.h:qc_parse_result |             maxscaleSetStatusCap(2); // QC_QUERY_PARTIALLY_PARSED, see query_classifier.h:qc_parse_result | ||||||
|             ++i; // Next after the trailing '/' |             ++i; // Next after the trailing '/' | ||||||
|           } |           } | ||||||
|           else { |           else { | ||||||
|             // A non-version specific executable comment, e.g. "/*! select 1 */ => always parsed. |             // A non-version specific executable comment, | ||||||
|  |             // e.g."/*! select 1 */ or "/*M! select 1 */ => always parsed. | ||||||
|             char* znc = (char*) z; |             char* znc = (char*) z; | ||||||
|             znc[0]=znc[1]=znc[2]=znc[i-1]=znc[i]=' '; // Remove comment chars, i.e. "/*!" and "*/". |             znc[0]=znc[1]=znc[2]=znc[i-1]=znc[i]=' '; // Remove comment chars, i.e. "/*!" and "*/". | ||||||
|             for (i=3; sqlite3Isspace(z[i]); ++i){} // Jump over any space. |             if (j==4){ | ||||||
|  |               znc[3]=0; // It wasn't "/*!" but "/*M!". | ||||||
|  |             } | ||||||
|  |             for (i=j; sqlite3Isspace(z[i]); ++i){} // Jump over any space. | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
|       } else { |       } else { | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Johan Wikman
					Johan Wikman