Overview

Packages

  • Auth
    • Ads
    • Ldap
    • Xoops
  • Autotasks
  • Config
    • Category
    • Item
    • Option
  • Core
    • Filesystem
    • Filters
    • Logger
    • Mail
    • Message
    • Password
    • Security
    • StopSpammer
    • Template
    • Textsanitizer
    • VersionChecker
  • Data
    • Avatar
    • Comment
  • Database
    • Connection
    • Criteria
    • Legacy
    • MySQL
    • PDO
    • Updater
  • Feeds
    • RSS
  • File
  • Form
    • Base
    • Elements
  • ICMS
    • IPF
      • View
  • Image
    • Category
  • Ipf
    • Category
    • Controller
    • Export
    • form
    • Keyhighlighter
    • Member
    • Object
    • Permission
    • richfile
    • Tree
    • urllink
    • View
  • kernel
    • Set
  • Member
    • Group
    • GroupMembership
    • GroupPermission
    • User
  • Messaging
  • Module
  • None
  • Notification
  • Page
  • Plugins
    • Editor
  • Preload
    • Libraries
  • Privmessage
  • Session
  • SmartObject
  • View
    • Block
    • Breadcrumb
    • PageNav
    • PrinterFriendly
    • Template
    • Templates
    • Theme
    • Tree

Classes

  • icms_db_legacy_PdoDatabase
  • Overview
  • Package
  • Class

Class icms_db_legacy_PdoDatabase

Create and interact with a database connection using PDO

icms_db_legacy_Database implements icms_db_legacy_IDatabase
Extended by icms_db_legacy_PdoDatabase implements icms_db_legacy_IDatabase
Package: Database\PDO
Category: ICMS
Copyright: http://www.impresscms.org/ The ImpressCMS Project
License: GNU General Public License (GPL)
Located at db/legacy/PdoDatabase.php
Methods summary
public
# __construct( string $connection, string $allowWebChanges = FALSE )

Create a legacy database object

Create a legacy database object

Parameters

$connection
Database connection resource
$allowWebChanges
set tp TRUE to allow inserts, updates or deletes

Overrides

icms_db_legacy_Database::__construct()
public boolean
# connect( boolean $selectdb = TRUE )

connect to the database

connect to the database

Parameters

$selectdb
select the database now?

Returns

boolean
successful?

Implementation of

icms_db_legacy_IDatabase::connect()
public
# close( )

Closes MySQL connection

Closes MySQL connection

Implementation of

icms_db_legacy_IDatabase::close()
public string
# quoteString( string $string )

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

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

Parameters

$string
$str unescaped string text

Returns

string
escaped string text with single quotes around

Implementation of

icms_db_legacy_IDatabase::quoteString()
public string
# quote( string $string )

Quotes a string for use in a query using mysql_real_escape_string.

Quotes a string for use in a query using mysql_real_escape_string.

Parameters

$string
$str unescaped string text

Returns

string
escaped string text using mysql_real_escape_string

Implementation of

icms_db_legacy_IDatabase::quote()
public
# escape( $string )
public string
# error( )

Returns the text of the error message from previous MySQL operation

Returns the text of the error message from previous MySQL operation

Returns

string
Returns the error text from the last MySQL function, or '' (the empty string) if no error occurred.

Implementation of

icms_db_legacy_IDatabase::error()
public integer
# errno( )

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

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

Returns

integer
Returns the error number from the last MySQL function, or 0 (zero) if no error occurred.

Implementation of

icms_db_legacy_IDatabase::errno()
public integer
# genId( string $sequence )

generate an ID for a new row

generate an ID for a new row

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

Parameters

$sequence
name of the sequence from which to get the next ID

Returns

integer
always 0, because mysql has support for autoincrement

Implementation of

icms_db_legacy_IDatabase::genId()
public
# query( string $sql, integer $limit = 0, integer $start = 0 )

perform a query

perform a query

This method is empty and does nothing! It should therefore only be used if nothing is exactly what you want done! ;-)

Parameters

$sql
a valid MySQL query
$limit
number of records to return
$start
offset of first record to return

Implementation of

icms_db_legacy_IDatabase::query()
public resource
# queryF( string $sql, integer $limit = 0, integer $start = 0 )

perform a query on the database

perform a query on the database

Parameters

$sql
a valid MySQL query
$limit
number of records to return
$start
offset of first record to return

Returns

resource

query result or FALSE if successful or TRUE if successful and no result

Implementation of

icms_db_legacy_IDatabase::queryF()
public integer
# getInsertId( )

Get the ID generated from the previous INSERT operation

Get the ID generated from the previous INSERT operation

Returns

integer

Implementation of

icms_db_legacy_IDatabase::getInsertId()
public integer
# getAffectedRows( )

Get number of affected rows

Get number of affected rows

Returns

integer
number of affected rows

Implementation of

icms_db_legacy_IDatabase::getAffectedRows()
public string
# getFieldName( resource $result, integer $offset )

Get field name

Get field name

Parameters

$result
query result
$offset
field index

Returns

string
the fieldname

Implementation of

icms_db_legacy_IDatabase::getFieldName()
public string
# getFieldType( resource $result, integer $offset )

Get field type

Get field type

Parameters

$result
query result
$offset
numerical field index

Returns

string
the fieldtype

Implementation of

icms_db_legacy_IDatabase::getFieldType()
public integer
# getFieldsNum( resource $result )

Get number of fields in result

Get number of fields in result

Parameters

$result
query result

Returns

integer
number of fields in the resultset

Implementation of

icms_db_legacy_IDatabase::getFieldsNum()
public array
# fetchRow( resource $result )

Get a result row as an enumerated array

Get a result row as an enumerated array

Parameters

$result

Returns

array
the fetched rows

Implementation of

icms_db_legacy_IDatabase::fetchRow()
public array
# fetchArray( $result )

Fetch a result row as an associative array

Fetch a result row as an associative array

Returns

array
the fetched associative array

Implementation of

icms_db_legacy_IDatabase::fetchArray()
public array
# fetchBoth( $result )

Fetch a result row as an associative array and numerical array

Fetch a result row as an associative array and numerical array

Returns

array
the associative and numerical array

Implementation of

icms_db_legacy_IDatabase::fetchBoth()
public integer
# getRowsNum( resource $result )

Get number of rows in result

Get number of rows in result

Parameters

$result
result

Returns

integer
the number of rows in the resultset

Implementation of

icms_db_legacy_IDatabase::getRowsNum()
public boolean
# freeRecordSet( resource $result )

will free all memory associated with the result identifier result.

will free all memory associated with the result identifier result.

Parameters

$result
result

Returns

boolean
TRUE on success or FALSE on failure.

Implementation of

icms_db_legacy_IDatabase::freeRecordSet()
public integer
# exec( string $sql )

Executa uma sql e retorna o nro. de linhas afetadas por update ou delete Executes a sql and returns the number of rows affected by update or delete

Executa uma sql e retorna o nro. de linhas afetadas por update ou delete Executes a sql and returns the number of rows affected by update or delete

This is not a legacy method and should only be implemented in the new PDO class

Parameters

$sql

Returns

integer
  • nro. de linhas afetadas ou false // number of rows affected, or FALSE
public object
# fetchObject( resource $result, string $class = 'stdClass', array $params = array() )

Fetch a result row as an object

Fetch a result row as an object

This is not a legacy method and should only be implemented in the new PDO class

Parameters

$result
$class

O nome de classe para instanciar, definir as propriedades e retornar. Se n�o for especificado, um objeto stdClass � retornado. The name of the class to instantiate, set the properties and return. If none is specified, a stdClass object returned.

$params

Um array opcional de par�metros para passar para o construtor do objeto class_name . An optional array of parameters to pass to the constructor for class_name objects.

Returns

object
Inserida por Claudia // added by Claudia (ImpressCMS)
public boolean
# queryFromFile( string $file )

perform queries from SQL dump file in a batch

perform queries from SQL dump file in a batch

Parameters

$file
file path to an SQL dump file

Returns

boolean
FALSE if failed reading SQL file or TRUE if the file has been read and queries executed
public
# getConnection( )
public mixed
# getServerVersion( obj $connection = NULL )

Retrieve the MySQL server version information

Retrieve the MySQL server version information

Parameters

$connection
MySQL database connection link

Returns

mixed
Methods inherited from icms_db_legacy_Database
prefix(), setLogger(), setPrefix()
Properties summary
protected icms_db_IConnection $pdo

The PDO connection that performs operations behind the scenes

The PDO connection that performs operations behind the scenes

#
public resource $conn

Legacy database connection var - to be replaced by $pdo

Legacy database connection var - to be replaced by $pdo

#
protected integer $rowCount

Row count of the most recent statement

Row count of the most recent statement

# 0
Properties inherited from icms_db_legacy_Database
$allowWebChanges, $logger, $prefix
API documentation generated by ApiGen