Added binary protocol COM_STMT_PREPARE to modutil_get_SQL.
This commit is contained in:
@ -63,6 +63,23 @@ unsigned char *ptr;
|
|||||||
return ptr[4] == 0x03; // COM_QUERY
|
return ptr[4] == 0x03; // COM_QUERY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a GWBUF structure is a MySQL COM_STMT_PREPARE packet
|
||||||
|
*
|
||||||
|
* @param buf Buffer to check
|
||||||
|
* @return True if GWBUF is a COM_STMT_PREPARE packet
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
modutil_is_SQL_prepare(GWBUF *buf)
|
||||||
|
{
|
||||||
|
unsigned char *ptr;
|
||||||
|
|
||||||
|
if (GWBUF_LENGTH(buf) < 5)
|
||||||
|
return 0;
|
||||||
|
ptr = GWBUF_DATA(buf);
|
||||||
|
return ptr[4] == 0x16 ; // COM_STMT_PREPARE
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract the SQL portion of a COM_QUERY packet
|
* Extract the SQL portion of a COM_QUERY packet
|
||||||
*
|
*
|
||||||
@ -243,7 +260,7 @@ modutil_get_SQL(GWBUF *buf)
|
|||||||
unsigned int len, length;
|
unsigned int len, length;
|
||||||
char *ptr, *dptr, *rval = NULL;
|
char *ptr, *dptr, *rval = NULL;
|
||||||
|
|
||||||
if (!modutil_is_SQL(buf))
|
if (!modutil_is_SQL(buf) && !modutil_is_SQL_prepare(buf))
|
||||||
return rval;
|
return rval;
|
||||||
ptr = GWBUF_DATA(buf);
|
ptr = GWBUF_DATA(buf);
|
||||||
length = *ptr++;
|
length = *ptr++;
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#define PTR_IS_LOCAL_INFILE(b) (b[4] == 0xfb)
|
#define PTR_IS_LOCAL_INFILE(b) (b[4] == 0xfb)
|
||||||
|
|
||||||
extern int modutil_is_SQL(GWBUF *);
|
extern int modutil_is_SQL(GWBUF *);
|
||||||
|
extern int modutil_is_SQL_prepare(GWBUF *);
|
||||||
extern int modutil_extract_SQL(GWBUF *, char **, int *);
|
extern int modutil_extract_SQL(GWBUF *, char **, int *);
|
||||||
extern int modutil_MySQL_Query(GWBUF *, char **, int *, int *);
|
extern int modutil_MySQL_Query(GWBUF *, char **, int *, int *);
|
||||||
extern char *modutil_get_SQL(GWBUF *);
|
extern char *modutil_get_SQL(GWBUF *);
|
||||||
|
Reference in New Issue
Block a user