Blog de programación, errores, soluciones

Chose Language:
comments
Author: Admin/Publisher |finished | checked

PHP mysqli_sql_exception class

PHP mysqli_sql_exception is the class that manages exceptions within the mysqli extension.

Sinopsis / Synopsis
 final class mysqli_sql_exception extends RuntimeException {
/* Properties */
protected string $sqlstate = "00000";
/* Inherited properties */
protected string $message = "";
private string $string = "";
protected int $code;
protected string $file = "";
protected int $line;
private array $trace = [];
private ?Throwable $previous = null;
/* Methods */
public getSqlState(): string
/* Inherited methods */
final public Exception::getMessage(): string
final public Exception::getPrevious(): ?Throwable
final public Exception::getCode(): int
final public Exception::getFile(): string
final public Exception::getLine(): int
final public Exception::getTrace(): array
final public Exception::getTraceAsString(): string
public Exception::__toString(): string
private Exception::__clone(): void
}
contenido
Puedes cerrar o abrir este menú cliqueando sobre el boton contenido

Properties

https://blastcoding.com/php-mysqli_sql_exception/#propiedades

$sqlstate – SQLSTATE error code.

$message – the message of the exception (inherited from Exception).

$string – The string representation of the stack trace (inherited from Exception).

$code – the exception code (inherited from Exception).

$file – the name of the file where the exception was created (inherited from Exception).

$line – Line where the exception was created (inherited from Exception).

$trace – The stack trace as an array (inherited from Exception).

$previous – The previous exception thrown (inherited from Exception).

Methods

https://blastcoding.com/php-mysqli_sql_exception/#metodos

The following methods were created to be able to obtain the values of the previously mentioned properties; keep in mind that at the time the class was created, readonly could not be used directly on the property.

getSqlState()

https://blastcoding.com/php-mysqli_sql_exception/#getSqlState

Returns a string containing the SQLSTATE error code for the last error. This code consists of 5 characters.

 http://dev.mysql.com/doc/mysql/en/error-handling.html.

Description / Descripción
 public mysqli_sql_exception::getSqlState(): string

getMessage()

https://blastcoding.com/php-mysqli_sql_exception/#getMessage

Gets the exception message as a string; this method is inherited from the Exception class.

Description / Descripción
final public Exception::getMessage(): string

getCode()

https://blastcoding.com/php-mysqli_sql_exception/#getCode

The exception code obtained from $code; this method is inherited from the Exception class.

Description / Descripción
final public Exception::getCode(): int

getFile()

https://blastcoding.com/php-mysqli_sql_exception/#getFile

It will return the file where the exception was created as a string; this method is inherited from the Exception class.

Description / Descripción
final public Exception::getFile(): string

getLine()

https://blastcoding.com/php-mysqli_sql_exception/#getLine

Returns the line where the exception was created; this method is inherited from the Exception class.

Description / Descripción
final public Exception::getLine(): int

getTrace()

https://blastcoding.com/php-mysqli_sql_exception/#getTrace

Gets the stack trace; this method is inherited from the Exception class.

Description / Descripción
final public Exception::getTrace(): array

In the returned associative array, you can see the following values: file, line, function, args, class, object.

getTraceAsString()

https://blastcoding.com/php-mysqli_sql_exception/#getTraceAsString

Gets the stack trace as a string, this method is inherited from the Exception class

Description / Descripción
final public Exception::getTraceAsString(): string
Category: en-php
Something wrong? If you found an error or mistake in the content you can contact me on Twitter | @luisg2249_luis.
Last 4 post in same category

Comments