Documentation

Connection

Connection is an abstract class for database connections. Extension to the class Data\Connection.

Specific connection classes inherit this abstract class and provide low level database handling. Various specific classes are used to different database types.

Method Description Available from version
Constructor Class constructor.
add Adds row to table and returns ID of the added row.
clearCaches Clears all internal caches.
commitTransaction Commits started database transaction.
connect Connects to the database.
createIndex Creates index of columns.
createPrimaryIndex Creates primary index of column (s).
disableQueryExecuting Temporary disables query executing.
disconnect Disconnects from the database.
dropColumn Deletes a column
dropTable Deletes a table.
enableQueryExecuting Enables query executing after it has been temporary disabled.
executeSqlBatch Parses the string containing multiple queries and executes the queries one by one.
getAffectedRowsCount Returns affected rows count from last executed query.
getDbHost Returns database host.
getDbLogin Returns database login.
getDbName Returns database name.
getDisabledQueryExecutingDump Returns queries that were collected while query executing was disabled.
getIndexName Returns an index name.
getNodeId Returns connection node identifier.
getSqlHelper Returns database depended SqlHelper object.
getTableField Returns an object for the single column according to the column type..
getTableFields Returns fields objects according to the columns of a table.
getTracker
getType Returns database type.
getVersion Returns connected database version.
isIndexExists Checks if an index exists.
isTableExists Checks if a table exists.
query Executes a query to the database.
queryExecute Executes a query without returning result.
queryScalar Executes a query, fetches a row and returns single field value from the first column of the result.
renameTable Renames the table.
rollbackTransaction Rollbacks started database transaction.
setConnectionResourceNoDemand Sets the connection resource directly.
setNodeId Sets connection node identifier.
setTracker Sets new SQL tracker.
startTracker Starts collecting information about all queries executed.
stopTracker Stops collecting information about all queries executed.
truncateTable Truncates all table data.
startTransaction Starts new database transaction.

It is not recommended to handle database via direct queries, but such option is available. In this case the access is established via Bitrix\Main\DB\Connection instead of the global object $DB of class CDatabase.



© «Bitrix24», 2001-2024
Up