Overview

Namespaces

  • None
  • PHP

Classes

  • AbstractTest
  • AMysql
  • AMysql_Abstract
  • AMysql_Expr
  • AMysql_Iterator
  • AMysql_Profiler
  • AMysql_Select
  • AMysql_Statement
  • AMysql_TestCase
  • ExceptionTest
  • ExprTest
  • IteratorTest
  • SelectTest
  • StatementTest

Exceptions

  • AMysql_Exception
  • Overview
  • Namespace
  • Class
  • Tree

Class AMysql_Exception

MySQL exception class

A list of error codes can be found below. Anything in ($#), where # is a number which represents the index the substring is captured in in the array $this->getParams() returns.
CODE_DUPLICATE_ENTRY (1062): Duplicate entry '($0)' for key '($1)' CODE_PARENT_FOREIGN_KEY_CONSTRAINT_FAILS (1451): Cannot delete or update a parent row: a foreign key constraint fails ($0) CODE_CHILD_FOREIGN_KEY_CONSTRAINT_FAILS (1452): Cannot add or update a child row: a foreign key constraint fails (%0) CODE_SERVER_GONE_AWAY (2006): Mysql server has gone away

List of official MySQL error codes can be found on these links:

Exception
Extended by RuntimeException
Extended by AMysql_Exception
License: License; http://www.opensource.org/licenses/mit-license.php
Author: Szerémi Attila
Link: http://dev.mysql.com/doc/refman/5.7/en/error-messages-server.html
Link: Visit https://github.com/amcsi/amysql
Located at AMysql/Exception.php
Methods summary
public
# __construct( string $msg, integer $errno, string $query, Exception $previous = null )

__construct

__construct

Parameters

$msg
string
$msg The mysql error message or custom message
$errno
integer
$errno The mysql error code or custom error code
$query
string
$query The mysql query string used or a message hinting the action taken
$previous
Exception
$previous The previous exception

Overrides

Exception::__construct()
public
# getDetails( )
public
# getLogMessage( )
public array|string
# getParams( integer $index = null )

Parses the mysql error message for variables based on the error code. Only a subset of error codes/messages are supported. It is recommended that you always check the exception's error code before calling this method.

Parses the mysql error message for variables based on the error code. Only a subset of error codes/messages are supported. It is recommended that you always check the exception's error code before calling this method.

For requests for including support for specific error codes/messages in the codebase, please visit @link https://github.com/amcsi/amysql/issues

Parameters

$index
integer
$index (Optional) Returns the $index element of the returning array instead

Returns

array|string
An array of the parsed variables. Empty array if the error code's message doesn't have variables, or if the error code/message is not supported. If $index was set, a string will be returned if found, otherwise NULL is returned and an E_NOTICE is raised.
public
# triggerErrorOnce( )

Performs a trigger_error on this exception. Does nothing if this method has already been called on this object.

Performs a trigger_error on this exception. Does nothing if this method has already been called on this object.

public
# __toString( )

The details of the exception described in a string.

The details of the exception described in a string.

Overrides

Exception::__toString()
Methods inherited from Exception
getCode(), getFile(), getLine(), getMessage(), getPrevious(), getTrace(), getTraceAsString()
Constants summary
integer CODE_DUPLICATE_ENTRY 1062
#
integer CODE_PARENT_FOREIGN_KEY_CONSTRAINT_FAILS 1451
#
integer CODE_CHILD_FOREIGN_KEY_CONSTRAINT_FAILS 1452
#
integer CODE_SERVER_GONE_AWAY 2006
#
Properties summary
public string $query
#

The query string mysql had a problem with (if there is one).

The query string mysql had a problem with (if there is one).

protected integer $errorTriggered 0
#
protected mixed $params
#
Properties inherited from Exception
$code, $file, $line, $message
API documentation generated by ApiGen 2.8.0