Connection
class Connection implements ServerInfoAwareConnection (View source)
Properties
| protected PDO | $connection | The underlying PDO connection. |
Methods
Execute an SQL statement.
Prepare a new SQL statement.
Execute a new query against the connection.
Get the last insert ID.
Begin a new database transaction.
Commit a database transaction.
Rollback a database transaction.
Wrap quotes around the given input.
Get the server version for the connection.
Get the wrapped PDO connection.
Details
void
__construct(PDO $connection)
Create a new PDO connection instance.
int
exec(string $statement)
Execute an SQL statement.
Statement
prepare(string $sql)
Prepare a new SQL statement.
Result
query(string $sql)
Execute a new query against the connection.
mixed
lastInsertId(string|null $name = null)
Get the last insert ID.
protected Statement
createStatement(PDOStatement $stmt)
Create a new statement instance.
void
beginTransaction()
Begin a new database transaction.
void
commit()
Commit a database transaction.
void
rollBack()
Rollback a database transaction.
string
quote(string $input, string $type = ParameterType::STRING)
Wrap quotes around the given input.
string
getServerVersion()
Get the server version for the connection.
PDO
getWrappedConnection()
Get the wrapped PDO connection.
Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.