Merge branch '2.3' into develop

This commit is contained in:
Markus Mäkelä
2019-04-12 13:23:49 +03:00
31 changed files with 625 additions and 243 deletions

View File

@ -1586,18 +1586,16 @@ public:
}
}
void mxs_sqlite3BeginTrigger(Parse* pParse, /* The parse context of the CREATE TRIGGER statement
* */
Token* pName1, /* The name of the trigger */
Token* pName2, /* The name of the trigger */
int tr_tm, /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */
int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */
IdList* pColumns, /* column list if this is an UPDATE OF trigger */
SrcList* pTableName, /* The name of the table/view the trigger applies to
* */
Expr* pWhen, /* WHEN clause */
int isTemp, /* True if the TEMPORARY keyword is present */
int noErr) /* Suppress errors if the trigger already exists */
void mxs_sqlite3BeginTrigger(Parse* pParse, /* The parse context of the CREATE TRIGGER statement */
Token* pName1, /* The name of the trigger */
Token* pName2, /* The name of the trigger */
int tr_tm, /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */
int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */
IdList* pColumns, /* column list if this is an UPDATE OF trigger */
SrcList* pTableName, /* The name of the table/view the trigger applies to */
Expr* pWhen, /* WHEN clause */
int isTemp, /* True if the TEMPORARY keyword is present */
int noErr) /* Suppress errors if the trigger already exists */
{
mxb_assert(this_thread.initialized);
@ -2643,6 +2641,11 @@ public:
m_type_mask = (QUERY_TYPE_WRITE | QUERY_TYPE_COMMIT);
break;
case TK_XA:
m_status = QC_QUERY_TOKENIZED;
m_type_mask = QUERY_TYPE_WRITE;
break;
default:
;
}

View File

@ -639,6 +639,7 @@ columnid(A) ::= nm(X). {
VALUE VIEW /*VIRTUAL*/
/*WITH*/
WORK
XA
%endif
.
%wildcard ANY.

View File

@ -626,6 +626,22 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
/* If it is not a BLOB literal, then it must be an ID, since no
** SQL keywords start with the letter 'x'. Fall through */
}
#endif
#ifdef MAXSCALE
// It may be the "XA" keyword.
// If the next character is 'a' or 'A', followed by whitespace or a
// comment, then we are indeed dealing with the "XA" keyword.
if (( z[1]=='a' || z[1]=='A' ) &&
(sqlite3Isspace(z[2]) || // Whitespace
(z[2]=='/' && z[3]=='*') || // Beginning of /* comment
(z[2]=='#') || // # eol comment
(z[2]=='-' && z[3]=='-' && sqlite3Isspace(z[4])))) { // -- eol comment
extern int maxscaleKeyword(int);
*tokenType = TK_XA;
maxscaleKeyword(*tokenType);
return 2;
}
#endif
case CC_ID: {
i = 1;

View File

@ -500,6 +500,7 @@ static Keyword aKeywordTable[] = {
#ifdef MAXSCALE
{ "WORK", "TK_WORK", ALWAYS },
{ "WRITE", "TK_WRITE", ALWAYS },
{ "XA", "TK_XA", ALWAYS },
#endif
{ "ZEROFILL", "TK_ZEROFILL", ALWAYS },
};

View File

@ -121,3 +121,11 @@ SELECT X(coordinates), Y(coordinates), ST_X(coordinates), ST_Y(coordinates) FROM
# MXS-2248
SELECT curdate() + interval '60' day;
# MXS-2431
XA BEGIN 'xid';
XA END 'xid';
XA PREPARE 'xid';
XA COMMIT 'xid';
XA ROLLBACK 'xid'
XA RECOVER 'xid';