Interested in improving this site? Please check the To Do page.

Back to MySQL Verbs

mysql.getErrorMessage

Get the last MySQL error code as a string

Syntax

mysql.getErrorMessage(dbid)

Params

A database connection ID

Returns

The error message as a string, empty string (or the previous error message) if no error.

Examples

on connect () {
	local (id, result);
	try {
		id = mysql.connect("127.0.0.1", "root", "frontier", "frontier", 3306)}
	else {
		dialog.alert(mysql.getErrorMessage(id));
		dialog.alert(mysql.getErrorNumber(id))};
	result = mysql.close(id);
	return result};
local (i);
mysql.init();
for i = 1 to 1000000 {
	msg( i + ": " + connect() + " (" + sys.memavail() + ")")};
mysql.end()

Notes

If a function didn’t fail, the return value of mysql.getErrorMessage may be the previous error or an empty string to indicate no error. It’s important to only use the error message when you’ve gotten an error return from a MySQL function.

See Also


Personal Tools