Skip to content

icms_db_Connection

Raimondas Rimkevičius edited this page Mar 9, 2020 · 1 revision
Notice: Wiki was automatic generated from project sources as project API documentation. Do not edit manually!

icms_db_Connection

Database connection

Properties

$prefix

protected string $prefix

Database prefix

  • Visibility: protected

$lastRowCount

protected int $lastRowCount

Last row count

  • Visibility: protected

Methods

escape

mixed icms_db_IConnection::escape(mixed string)

Safely escape the string, but strips the outer quotes This is a legacy method

Arguments

  • string mixed

query

\icms_db_Statement icms_db_IConnection::query(mixed statement, mixed fetch)

Executes an SQL statement and returns a result set as a IStatement object.

Arguments

  • statement mixed
  • fetch mixed

queryF

resource icms_db_legacy_IDatabase::queryF(string sql, int limit, int start)

perform a query on the database

Arguments

  • sql string - <p>a valid MySQL query</p>
  • limit int - <p>number of records to return</p>
  • start int - <p>offset of first record to return</p>

setLogger

mixed icms_db_legacy_IDatabase::setLogger(\icms_core_Logger logger)

assign a logger to the database

Arguments

setPrefix

mixed icms_db_legacy_IDatabase::setPrefix(string value)

set the prefix for tables in the database

Arguments

  • value string - <p>table prefix</p>

prefix

string icms_db_legacy_IDatabase::prefix(string tablename)

attach the prefix.'_' to a given tablename.

if tablename is empty, only prefix will be returned

Arguments

  • tablename string - <p>tablename</p>

genId

int icms_db_legacy_IDatabase::genId(string sequence)

generate an ID for a new row

This is for compatibility only. Will always return 0, because MySQL supports autoincrement for primary keys.

Arguments

  • sequence string - <p>name of the sequence from which to get the next ID</p>

fetchRow

array icms_db_legacy_IDatabase::fetchRow(resource result)

Get a result row as an enumerated array

Arguments

  • result resource

fetchArray

array icms_db_legacy_IDatabase::fetchArray(mixed result)

Fetch a result row as an associative array

Arguments

  • result mixed

fetchBoth

array icms_db_legacy_IDatabase::fetchBoth(mixed result)

Fetch a result row as an associative array and numerical array

Arguments

  • result mixed

getInsertId

int icms_db_legacy_IDatabase::getInsertId()

Get the ID generated from the previous INSERT operation

getRowsNum

int icms_db_legacy_IDatabase::getRowsNum(mixed result)

Get number of rows in result

Arguments

  • result mixed

getAffectedRows

int icms_db_legacy_IDatabase::getAffectedRows()

Get number of affected rows

close

mixed icms_db_legacy_IDatabase::close()

Closes MySQL connection

freeRecordSet

bool icms_db_legacy_IDatabase::freeRecordSet(mixed result)

will free all memory associated with the result identifier result.

Arguments

  • result mixed

error

string icms_db_legacy_IDatabase::error()

Returns the text of the error message from previous MySQL operation

errno

int icms_db_legacy_IDatabase::errno()

Returns the numerical value of the error message from previous MySQL operation

quoteString

string icms_db_legacy_IDatabase::quoteString(string str)

Returns escaped string text with single quotes around it to be safely stored in database

Arguments

  • str string - <p>unescaped string text</p>

getFieldName

string icms_db_legacy_IDatabase::getFieldName(resource result, mixed offset)

Get field name

Arguments

  • result resource - <p>query result</p>
  • offset mixed

getFieldType

string icms_db_legacy_IDatabase::getFieldType(resource result, int offset)

Get field type

Arguments

  • result resource - <p>query result</p>
  • offset int - <p>numerical field index</p>

getFieldsNum

int icms_db_legacy_IDatabase::getFieldsNum(resource result)

Get number of fields in result

Arguments

  • result resource - <p>query result</p>

getServerVersion

string icms_db_Connection::getServerVersion()

Gets server version

  • Visibility: public

setAttribute

bool icms_db_IConnection::setAttribute(int attribute, mixed value)

Set the value of a database connection attribute.

Arguments

  • attribute int
  • value mixed

getAttribute

mixed icms_db_IConnection::getAttribute(int attribute)

Return the value of a database connection attribute.

Arguments

  • attribute int

errorCode

mixed icms_db_IConnection::errorCode()

Last error as an SQLSTATE, a five characters alphanumeric identifier.

errorInfo

array icms_db_IConnection::errorInfo()

Get an array of error information about the last operation.

quote

string icms_db_legacy_IDatabase::quote(mixed string)

Quotes a string for use in a query using mysql_real_escape_string.

Arguments

  • string mixed

beginTransaction

bool icms_db_IConnection::beginTransaction()

Turns off autocommit mode and starts recording transaction.

commit

bool icms_db_IConnection::commit()

Commits current transaction.

rollBack

bool icms_db_IConnection::rollBack()

Rolls back current transaction.

prepare

\icms_db_Statement icms_db_IConnection::prepare(string sql, array options)

Prepares an SQL statement

Arguments

  • sql string
  • options array

exec

int icms_db_IConnection::exec(string sql)

Executes an SQL statement and returns the number of affected rows.

Arguments

  • sql string

lastInsertId

string icms_db_IConnection::lastInsertId(string name)

Returns the ID of the last inserted row or the last value from a sequence object.

Arguments

  • name string
Clone this wiki locally