Use m_conn rather than PDOStatement::dbh within PDOMySqlStatement

It's possible for PDOMySqlStatement to try to access
dbh before it's initialized, but m_conn will be set by the ctor.

Closes #851
Esse commit está contido em:
Sara Golemon
2013-07-26 10:51:49 -07:00
commit 095e163a1d
+3 -4
Ver Arquivo
@@ -898,9 +898,8 @@ bool PDOMySqlStatement::support(SupportedMethod method) {
}
int PDOMySqlStatement::handleError(const char *file, int line) {
PDOMySqlConnection *conn = dynamic_cast<PDOMySqlConnection*>(dbh.get());
assert(conn);
return conn->handleError(file, line, this);
assert(m_conn);
return m_conn->handleError(file, line, this);
}
bool PDOMySqlStatement::executer() {
@@ -1100,7 +1099,7 @@ bool PDOMySqlStatement::paramHook(PDOBoundParam *param,
if (!same(buf, false)) {
param->parameter = buf;
} else {
pdo_raise_impl_error(dbh, this, "HY105",
pdo_raise_impl_error(m_conn, this, "HY105",
"Expected a stream resource");
return false;
}