Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[php7] add native mysqli error message when throwing an exception #6390

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions std/php7/_std/sys/db/Mysql.hx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private class MysqlConnection implements Connection {

public function request( s : String ) : ResultSet {
var result = db.query(s);
if (result == false) throw 'Failed to perform db query';
if (result == false) throw 'Failed to perform db query: ' + db.error;
if (result == true) return null;

return new MysqlResultSet(result);
Expand Down Expand Up @@ -103,17 +103,17 @@ private class MysqlConnection implements Connection {

public function startTransaction() : Void {
var success = db.begin_transaction();
if (!success) throw 'Failed to start transaction';
if (!success) throw 'Failed to start transaction: ' + db.error;
}

public function commit() : Void {
var success = db.commit();
if (!success) throw 'Failed to commit transaction';
if (!success) throw 'Failed to commit transaction: ' + db.error;
}

public function rollback() : Void {
var success = db.rollback();
if (!success) throw 'Failed to rollback transaction';
if (!success) throw 'Failed to rollback transaction: ' + db.error;
}

}
Expand Down