Evaluate enforce_autocommit_on_reads on PS #899

Variable mysql-enforce_autocommit_on_reads wasn't evaluate for prepared statements.
v1.4.0-955
René Cannaò 9 years ago
parent 65c9735aa1
commit 2f65c2e48b

@ -62,6 +62,7 @@ class MySQL_STMT_Global_info {
int timeout;
int delay;
} properties;
bool is_select_NOT_for_update;
MYSQL_BIND **params; // seems unused (?)
MySQL_STMT_Global_info(uint32_t id, unsigned int h, char *u, char *s, char *q, unsigned int ql, MYSQL_STMT *stmt, uint64_t _h);
~MySQL_STMT_Global_info();

@ -322,6 +322,22 @@ MySQL_STMT_Global_info::MySQL_STMT_Global_info(uint32_t id, unsigned int h, char
compute_hash();
}
is_select_NOT_for_update=false;
{ // see bug #899 . Most of the code is borrowed from Query_Info::is_select_NOT_for_update()
if (ql>=7) {
if (strncasecmp(q,(char *)"SELECT ",7)==0) { // is a SELECT
is_select_NOT_for_update=true;
if (ql>=17) {
char *p=(char *)q;
p+=ql-11;
if (strncasecmp(p," FOR UPDATE",11)==0) { // is a SELECT FOR UPDATE
is_select_NOT_for_update=false;
}
}
}
}
}
// set default properties:
properties.cache_ttl=-1;
properties.timeout=-1;

@ -187,6 +187,9 @@ char * Query_Info::get_digest_text() {
}
bool Query_Info::is_select_NOT_for_update() {
if (stmt_info) { // we are processing a prepared statement. We already have the information
return stmt_info->is_select_NOT_for_update;
}
// to avoid an expensive strlen() on the digest_text, we consider only the real query
if (QueryPointer==NULL) {
return false;

Loading…
Cancel
Save