MXS-1196: Handle anonymous blocks
In PL/SQL BEGIN starts a block (i.e. not a transaction). Whenever we see that, we assume it is such a block, consume all input and set the type to QUERY_TYPE_WRITE to ensure it goes to master.
This commit is contained in:
@ -86,7 +86,7 @@ typedef enum qc_field_usage
|
||||
extern void mxs_sqlite3AlterFinishAddColumn(Parse *, Token *);
|
||||
extern void mxs_sqlite3AlterBeginAddColumn(Parse *, SrcList *);
|
||||
extern void mxs_sqlite3Analyze(Parse *, SrcList *);
|
||||
extern void mxs_sqlite3BeginTransaction(Parse*, int);
|
||||
extern void mxs_sqlite3BeginTransaction(Parse*, int token, int type);
|
||||
extern void mxs_sqlite3CommitTransaction(Parse*);
|
||||
extern void mxs_sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*,
|
||||
Expr*, int, int);
|
||||
@ -308,7 +308,7 @@ cmdx ::= cmd. { sqlite3FinishCoding(pParse); }
|
||||
%ifdef MAXSCALE
|
||||
work_opt ::= WORK.
|
||||
work_opt ::= .
|
||||
cmd ::= BEGIN work_opt. {mxs_sqlite3BeginTransaction(pParse, 0);} // BEGIN [WORK]
|
||||
cmd ::= BEGIN work_opt. {mxs_sqlite3BeginTransaction(pParse, TK_BEGIN, 0);} // BEGIN [WORK]
|
||||
%endif
|
||||
%ifndef MAXSCALE
|
||||
cmd ::= BEGIN transtype(Y) trans_opt. {sqlite3BeginTransaction(pParse, Y);}
|
||||
@ -3256,7 +3256,7 @@ start_transaction_characteristics(A) ::=
|
||||
}
|
||||
|
||||
cmd ::= START TRANSACTION start_transaction_characteristics(X). {
|
||||
mxs_sqlite3BeginTransaction(pParse, X);
|
||||
mxs_sqlite3BeginTransaction(pParse, TK_START, X);
|
||||
}
|
||||
|
||||
//////////////////////// The TRUNCATE statement ////////////////////////////////////
|
||||
|
||||
@ -568,8 +568,14 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
|
||||
}
|
||||
|
||||
if (*tokenType != TK_ID) {
|
||||
extern void maxscaleKeyword(int);
|
||||
maxscaleKeyword(*tokenType);
|
||||
extern int maxscaleKeyword(int);
|
||||
if (maxscaleKeyword(*tokenType) != 0)
|
||||
{
|
||||
/* Consume the entire string. */
|
||||
while ( z[i] ) {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
|
||||
Reference in New Issue
Block a user