MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
Referência à classe Connection
Diagrama de heranças da classe Connection
Connection

Membros públicos

 __construct (array $params, Driver $driver, Configuration $config=null, EventManager $eventManager=null)
 
 getParams ()
 
 getDatabase ()
 
 getHost ()
 
 getPort ()
 
 getUsername ()
 
 getPassword ()
 
 getDriver ()
 
 getConfiguration ()
 
 getEventManager ()
 
 getDatabasePlatform ()
 
 connect ()
 
 fetchAssoc ($statement, array $params=array())
 
 fetchArray ($statement, array $params=array())
 
 fetchColumn ($statement, array $params=array(), $colnum=0)
 
 isConnected ()
 
 isTransactionActive ()
 
 delete ($tableName, array $identifier)
 
 close ()
 
 setTransactionIsolation ($level)
 
 getTransactionIsolation ()
 
 update ($tableName, array $data, array $identifier)
 
 insert ($tableName, array $data)
 
 setCharset ($charset)
 
 quoteIdentifier ($str)
 
 quote ($input, $type=null)
 
 fetchAll ($sql, array $params=array())
 
 prepare ($statement)
 
 executeQuery ($query, array $params=array(), $types=array())
 
 project ($query, array $params, Closure $function)
 
 query ()
 
 executeUpdate ($query, array $params=array(), array $types=array())
 
 exec ($statement)
 
 getTransactionNestingLevel ()
 
 errorCode ()
 
 errorInfo ()
 
 lastInsertId ($seqName=null)
 
 transactional (Closure $func)
 
 setNestTransactionsWithSavepoints ($nestTransactionsWithSavepoints)
 
 getNestTransactionsWithSavepoints ()
 
 beginTransaction ()
 
 commit ()
 
 rollback ()
 
 createSavepoint ($savepoint)
 
 releaseSavepoint ($savepoint)
 
 rollbackSavepoint ($savepoint)
 
 getWrappedConnection ()
 
 getSchemaManager ()
 
 setRollbackOnly ()
 
 isRollbackOnly ()
 
 convertToDatabaseValue ($value, $type)
 
 convertToPHPValue ($value, $type)
 
- Membros públicos herdados de Connection
 rollBack ()
 

Campos de Dados

const TRANSACTION_READ_UNCOMMITTED = 1
 
const TRANSACTION_READ_COMMITTED = 2
 
const TRANSACTION_REPEATABLE_READ = 3
 
const TRANSACTION_SERIALIZABLE = 4
 

Membros protegidos

 _getNestedTransactionSavePointName ()
 

Atributos Protegidos

 $_conn
 
 $_config
 
 $_eventManager
 
 $_platform
 
 $_schemaManager
 
 $_driver
 

Descrição detalhada

A wrapper around a Doctrine\DBAL\Driver\Connection that adds features like events, transaction isolation levels, configuration, emulated transaction nesting, lazy connecting and more.

@license http://www.opensource.org/licenses/lgpl-license.php LGPL 2.0 Guilherme Blanco guilh.nosp@m.erme.nosp@m.blanc.nosp@m.o@ho.nosp@m.tmail.nosp@m..com Jonathan Wage jonwa.nosp@m.ge@g.nosp@m.mail..nosp@m.com Roman Borschel roman.nosp@m.@cod.nosp@m.e-fac.nosp@m.tory.nosp@m..org Konsta Vesterinen kvest.nosp@m.eri@.nosp@m.cc.hu.nosp@m.t.fi Lukas Smith smith.nosp@m.@poo.nosp@m.teewe.nosp@m.et.o.nosp@m.rg (MDB2 library) Benjamin Eberlei konta.nosp@m.kt@b.nosp@m.eberl.nosp@m.ei.d.nosp@m.e

Definido na linha 44 do ficheiro Connection.php.

Documentação dos Construtores & Destrutor

◆ __construct()

__construct ( array $params,
Driver $driver,
Configuration $config = null,
EventManager $eventManager = null )

Initializes a new instance of the Connection class.

Parâmetros
array$paramsThe connection parameters.
Driver$driver
Configuration$config
EventManager$eventManager

Definido na linha 155 do ficheiro Connection.php.

Documentação das funções

◆ _getNestedTransactionSavePointName()

_getNestedTransactionSavePointName ( )
protected

Returns the savepoint name to use for nested transactions are false if they are not supported "savepointFormat" parameter is not set

Retorna
mixed a string with the savepoint name or false

Definido na linha 785 do ficheiro Connection.php.

◆ beginTransaction()

beginTransaction ( )

Starts a transaction by suspending auto-commit mode.

Retorna
void

Implementa Connection.

Definido na linha 795 do ficheiro Connection.php.

◆ close()

close ( )

Closes the connection.

Retorna
void

Definido na linha 401 do ficheiro Connection.php.

◆ commit()

commit ( )

Commits the current transaction.

Retorna
void
Excepções
ConnectionExceptionIf the commit failed due to no active transaction or because the transaction was marked for rollback only.

Implementa Connection.

Definido na linha 815 do ficheiro Connection.php.

◆ connect()

connect ( )

Establishes the connection with the database.

Retorna
boolean TRUE if the connection was successfully established, FALSE if the connection is already open.

Definido na linha 293 do ficheiro Connection.php.

◆ convertToDatabaseValue()

convertToDatabaseValue ( $value,
$type )

Converts a given value to its database representation according to the conversion rules of a specific DBAL mapping type.

Parâmetros
mixed$valueThe value to convert.
string$typeThe name of the DBAL mapping type.
Retorna
mixed The converted value.

Definido na linha 977 do ficheiro Connection.php.

◆ convertToPHPValue()

convertToPHPValue ( $value,
$type )

Converts a given value to its PHP representation according to the conversion rules of a specific DBAL mapping type.

Parâmetros
mixed$valueThe value to convert.
string$typeThe name of the DBAL mapping type.
Retorna
mixed The converted type.

Definido na linha 990 do ficheiro Connection.php.

◆ createSavepoint()

createSavepoint ( $savepoint)

createSavepoint creates a new savepoint

Parâmetros
string$savepointname of a savepoint to set
Retorna
void

Definido na linha 871 do ficheiro Connection.php.

◆ delete()

delete ( $tableName,
array $identifier )

Executes an SQL DELETE statement on a table.

Parâmetros
string$tableThe name of the table on which to delete.
array$identifierThe deletion criteria. An associateve array containing column-value pairs.
Retorna
integer The number of affected rows.

Definido na linha 381 do ficheiro Connection.php.

◆ errorCode()

errorCode ( )

Fetch the SQLSTATE associated with the last database operation.

Retorna
integer The last error code.

Implementa Connection.

Definido na linha 694 do ficheiro Connection.php.

◆ errorInfo()

errorInfo ( )

Fetch extended error information associated with the last database operation.

Retorna
array The last error information.

Implementa Connection.

Definido na linha 705 do ficheiro Connection.php.

◆ exec()

exec ( $statement)

Execute an SQL statement and return the number of affected rows.

Parâmetros
string$statement
Retorna
integer The number of affected rows.

Implementa Connection.

Definido na linha 673 do ficheiro Connection.php.

◆ executeQuery()

executeQuery ( $query,
array $params = array(),
$types = array() )

Executes an, optionally parameterized, SQL query.

If the query is parameterized, a prepared statement is used. If an SQLLogger is configured, the execution is logged.

Parâmetros
string$queryThe SQL query to execute.
array$paramsThe parameters to bind to the query, if any.
Retorna
Doctrine\DBAL\Driver\Statement The executed statement.

Definido na linha 559 do ficheiro Connection.php.

◆ executeUpdate()

executeUpdate ( $query,
array $params = array(),
array $types = array() )

Executes an SQL INSERT/UPDATE/DELETE query with the given parameters and returns the number of affected rows.

This method supports PDO binding types as well as DBAL mapping types.

Parâmetros
string$queryThe SQL query.
array$paramsThe query parameters.
array$typesThe parameter types.
Retorna
integer The number of affected rows.

Definido na linha 638 do ficheiro Connection.php.

◆ fetchAll()

fetchAll ( $sql,
array $params = array() )

Prepares and executes an SQL query and returns the result as an associative array.

Parâmetros
string$sqlThe SQL query.
array$paramsThe query parameters.
Retorna
array

Definido na linha 530 do ficheiro Connection.php.

◆ fetchArray()

fetchArray ( $statement,
array $params = array() )

Prepares and executes an SQL query and returns the first row of the result as a numerically indexed array.

Parâmetros
string$statementsql query to be executed
array$paramsprepared statement params
Retorna
array

Definido na linha 335 do ficheiro Connection.php.

◆ fetchAssoc()

fetchAssoc ( $statement,
array $params = array() )

Prepares and executes an SQL query and returns the first row of the result as an associative array.

Parâmetros
string$statementThe SQL query.
array$paramsThe query parameters.
Retorna
array

Definido na linha 322 do ficheiro Connection.php.

◆ fetchColumn()

fetchColumn ( $statement,
array $params = array(),
$colnum = 0 )

Prepares and executes an SQL query and returns the value of a single column of the first row of the result.

Parâmetros
string$statementsql query to be executed
array$paramsprepared statement params
int$colnum0-indexed column number to retrieve
Retorna
mixed

Definido na linha 349 do ficheiro Connection.php.

◆ getConfiguration()

getConfiguration ( )

Gets the Configuration used by the Connection.

Retorna
Doctrine\DBAL\Configuration

Definido na linha 262 do ficheiro Connection.php.

◆ getDatabase()

getDatabase ( )

Gets the name of the database this Connection is connected to.

Retorna
string $database

Definido na linha 202 do ficheiro Connection.php.

◆ getDatabasePlatform()

getDatabasePlatform ( )

Gets the DatabasePlatform for the connection.

Retorna
Doctrine\DBAL\Platforms\AbstractPlatform

Definido na linha 282 do ficheiro Connection.php.

◆ getDriver()

getDriver ( )

Gets the DBAL driver instance.

Retorna
Doctrine\DBAL\Driver

Definido na linha 252 do ficheiro Connection.php.

◆ getEventManager()

getEventManager ( )

Gets the EventManager used by the Connection.

Retorna
Doctrine\Common\EventManager

Definido na linha 272 do ficheiro Connection.php.

◆ getHost()

getHost ( )

Gets the hostname of the currently connected database.

Retorna
string

Definido na linha 212 do ficheiro Connection.php.

◆ getNestTransactionsWithSavepoints()

getNestTransactionsWithSavepoints ( )

Get if nested transactions should use savepoints

Retorna
boolean

Definido na linha 774 do ficheiro Connection.php.

◆ getParams()

getParams ( )

Gets the parameters used during instantiation.

Retorna
array $params

Definido na linha 192 do ficheiro Connection.php.

◆ getPassword()

getPassword ( )

Gets the password used by this connection.

Retorna
string

Definido na linha 242 do ficheiro Connection.php.

◆ getPort()

getPort ( )

Gets the port of the currently connected database.

Retorna
mixed

Definido na linha 222 do ficheiro Connection.php.

◆ getSchemaManager()

getSchemaManager ( )

Gets the SchemaManager that can be used to inspect or change the database schema through the connection.

Retorna
Doctrine\DBAL\Schema\SchemaManager

Definido na linha 932 do ficheiro Connection.php.

◆ getTransactionIsolation()

getTransactionIsolation ( )

Gets the currently active transaction isolation level.

Retorna
integer The current transaction isolation level.

Definido na linha 425 do ficheiro Connection.php.

◆ getTransactionNestingLevel()

getTransactionNestingLevel ( )

Returns the current transaction nesting level.

Retorna
integer The nesting level. A value of 0 means there's no active transaction.

Definido na linha 684 do ficheiro Connection.php.

◆ getUsername()

getUsername ( )

Gets the username used by this connection.

Retorna
string

Definido na linha 232 do ficheiro Connection.php.

◆ getWrappedConnection()

getWrappedConnection ( )

Gets the wrapped driver connection.

Retorna
Doctrine\DBAL\Driver\Connection

Definido na linha 919 do ficheiro Connection.php.

◆ insert()

insert ( $tableName,
array $data )

Inserts a table row with specified data.

Parâmetros
string$tableThe name of the table to insert data into.
array$dataAn associative array containing column-value pairs.
Retorna
integer The number of affected rows.

Definido na linha 461 do ficheiro Connection.php.

◆ isConnected()

isConnected ( )

Whether an actual connection to the database is established.

Retorna
boolean

Definido na linha 359 do ficheiro Connection.php.

◆ isRollbackOnly()

isRollbackOnly ( )

Check whether the current transaction is marked for rollback only.

Retorna
boolean
Excepções
ConnectionExceptionIf no transaction is active.

Definido na linha 961 do ficheiro Connection.php.

◆ isTransactionActive()

isTransactionActive ( )

Checks whether a transaction is currently active.

Retorna
boolean TRUE if a transaction is currently active, FALSE otherwise.

Definido na linha 369 do ficheiro Connection.php.

◆ lastInsertId()

lastInsertId ( $seqName = null)

Returns the ID of the last inserted row, or the last value from a sequence object, depending on the underlying driver.

Note: This method may not return a meaningful or consistent result across different drivers, because the underlying database may not even support the notion of AUTO_INCREMENT/IDENTITY columns or sequences.

Parâmetros
string$seqNameName of the sequence object from which the ID should be returned.
Retorna
string A string representation of the last inserted ID.

Implementa Connection.

Definido na linha 722 do ficheiro Connection.php.

◆ prepare()

prepare ( $statement)

Prepares an SQL statement.

Parâmetros
string$statementThe SQL statement to prepare.
Retorna
Doctrine\DBAL\Driver\Statement The prepared statement.

Implementa Connection.

Definido na linha 541 do ficheiro Connection.php.

◆ project()

project ( $query,
array $params,
Closure $function )

Executes an, optionally parameterized, SQL query and returns the result, applying a given projection/transformation function on each row of the result.

Parâmetros
string$queryThe SQL query to execute.
array$paramsThe parameters, if any.
Closure$mapperThe transformation function that is applied on each row. The function receives a single paramater, an array, that represents a row of the result set.
Retorna
mixed The projected result of the query.

Definido na linha 598 do ficheiro Connection.php.

◆ query()

query ( )

Executes an SQL statement, returning a result set as a Statement object.

Parâmetros
string$statement
integer$fetchType
Retorna
Doctrine\DBAL\Driver\Statement

Implementa Connection.

Definido na linha 619 do ficheiro Connection.php.

◆ quote()

quote ( $input,
$type = null )

Quotes a given input parameter.

Parâmetros
mixed$inputParameter to be quoted.
string$typeType of the parameter.
Retorna
string The quoted parameter.

Implementa Connection.

Definido na linha 516 do ficheiro Connection.php.

◆ quoteIdentifier()

quoteIdentifier ( $str)

Quote a string so it can be safely used as a table or column name, even if it is a reserved name.

Delimiting style depends on the underlying database platform that is being used.

NOTE: Just because you CAN use quoted identifiers does not mean you SHOULD use them. In general, they end up causing way more problems than they solve.

Parâmetros
string$strThe name to be quoted.
Retorna
string The quoted name.

Definido na linha 504 do ficheiro Connection.php.

◆ releaseSavepoint()

releaseSavepoint ( $savepoint)

releaseSavePoint releases given savepoint

Parâmetros
string$savepointname of a savepoint to release
Retorna
void

Definido na linha 887 do ficheiro Connection.php.

◆ rollback()

rollback ( )

Cancel any database changes done during the current transaction.

this method can be listened with onPreTransactionRollback and onTransactionRollback eventlistener methods

Excepções
ConnectionExceptionIf the rollback operation failed.

Definido na linha 843 do ficheiro Connection.php.

◆ rollbackSavepoint()

rollbackSavepoint ( $savepoint)

rollbackSavePoint releases given savepoint

Parâmetros
string$savepointname of a savepoint to rollback to
Retorna
void

Definido na linha 905 do ficheiro Connection.php.

◆ setCharset()

setCharset ( $charset)

Sets the given charset on the current connection.

Parâmetros
string$charsetThe charset to set.

Definido na linha 486 do ficheiro Connection.php.

◆ setNestTransactionsWithSavepoints()

setNestTransactionsWithSavepoints ( $nestTransactionsWithSavepoints)

Set if nested transactions should use savepoints

Parâmetros
boolean
Retorna
void

Definido na linha 756 do ficheiro Connection.php.

◆ setRollbackOnly()

setRollbackOnly ( )

Marks the current transaction so that the only possible outcome for the transaction to be rolled back.

Excepções
ConnectionExceptionIf no transaction is active.

Definido na linha 947 do ficheiro Connection.php.

◆ setTransactionIsolation()

setTransactionIsolation ( $level)

Sets the transaction isolation level.

Parâmetros
integer$levelThe level to set.

Definido na linha 413 do ficheiro Connection.php.

◆ transactional()

transactional ( Closure $func)

Executes a function in a transaction.

The function gets passed this Connection instance as an (optional) parameter.

If an exception occurs during execution of the function or transaction commit, the transaction is rolled back and the exception re-thrown.

Parâmetros
Closure$funcThe function to execute transactionally.

Definido na linha 738 do ficheiro Connection.php.

◆ update()

update ( $tableName,
array $data,
array $identifier )

Executes an SQL UPDATE statement on a table.

Parâmetros
string$tableThe name of the table to update.
array$identifierThe update criteria. An associative array containing column-value pairs.
Retorna
integer The number of affected rows.

Definido na linha 437 do ficheiro Connection.php.

Documentação dos campos e atributos

◆ $_config

$_config
protected

Definido na linha 76 do ficheiro Connection.php.

◆ $_conn

$_conn
protected

Definido na linha 71 do ficheiro Connection.php.

◆ $_driver

$_driver
protected

Definido na linha 138 do ficheiro Connection.php.

◆ $_eventManager

$_eventManager
protected

Definido na linha 81 do ficheiro Connection.php.

◆ $_platform

$_platform
protected

Definido na linha 124 do ficheiro Connection.php.

◆ $_schemaManager

$_schemaManager
protected

Definido na linha 131 do ficheiro Connection.php.

◆ TRANSACTION_READ_COMMITTED

const TRANSACTION_READ_COMMITTED = 2

Constant for transaction isolation level READ COMMITTED.

Definido na linha 54 do ficheiro Connection.php.

◆ TRANSACTION_READ_UNCOMMITTED

const TRANSACTION_READ_UNCOMMITTED = 1

Constant for transaction isolation level READ UNCOMMITTED.

Definido na linha 49 do ficheiro Connection.php.

◆ TRANSACTION_REPEATABLE_READ

const TRANSACTION_REPEATABLE_READ = 3

Constant for transaction isolation level REPEATABLE READ.

Definido na linha 59 do ficheiro Connection.php.

◆ TRANSACTION_SERIALIZABLE

const TRANSACTION_SERIALIZABLE = 4

Constant for transaction isolation level SERIALIZABLE.

Definido na linha 64 do ficheiro Connection.php.


A documentação para esta classe foi gerada a partir do seguinte ficheiro: