Class CI_DB_pdo_driver - echiong/testRepo GitHub Wiki

##Class CI_DB_pdo_driver

PDO Database Adapter Class

Note: _DB is an extender class that the app controller creates dynamically based on whether the active record class is being used or not.

Package: [[CodeIgniter<a href="Package CodeIgniter.Drivers.md">Drivers]]
Category: Database
Author: EllisLab Dev Team
Link: http://codeigniter.com/user_guide/database/
Located at system/database/drivers/pdo/pdo_driver.php

##Methods summary


public __construct ( mixed $params )


public resource db_connect ( )

Non-persistent database connection

Returns resource


public resource db_pconnect ( )

Persistent database connection

Returns resource


public reconnect ( )

Reconnect

Keep / reestablish the db connection if no queries have been sent for a length of time exceeding the server's idle timeout


public resource db_select ( )

Select the database

Returns resource


public resource db_set_charset ( string $charset, string $collation )

Set client character set

Parameters

$charset string

$collation string

Returns resource


public string _version ( )

Version number query string

Returns string


public object _execute ( string $sql )

Execute the query

Parameters

$sql string
an SQL query

Returns object


public string _prep_query ( string $sql )

Prep the query

If needed, each database adapter can prep the query string

Parameters

$sql string
an SQL query

Returns string


public boolean trans_begin ( mixed $test_mode = FALSE )

Begin Transaction

Returns boolean


public boolean trans_commit ( )

Commit Transaction

Returns boolean


public boolean trans_rollback ( )

Rollback Transaction

Returns boolean


public string escape_str ( string $str, boolean $like = FALSE )

Escape String

Parameters

$str string

$like boolean
whether or not the string will be used in a LIKE condition

Returns string


public integer affected_rows ( )

Affected Rows

Returns integer


public integer insert_id ( mixed $name = NULL )

Insert ID

Returns integer


public string count_all ( string $table = '' )

"Count All" query

Generates a platform-specific query string that counts all records in the specified database

Parameters

$table string

Returns string


public string _list_tables ( boolean $prefix_limit = FALSE )

Show table query

Generates a platform-specific query string so that the table names can be fetched

Parameters

$prefix_limit boolean

Returns string


public string _list_columns ( string $table = '' )

Show column query

Generates a platform-specific query string so that the column names can be fetched

Parameters

$table string
the table name

Returns string


public object _field_data ( string $table )

Field data query

Generates a platform-specific query so that the column data can be retrieved

Parameters

$table string
the table name

Returns object


public string _error_message ( )

The error message string

Returns string


public integer _error_number ( )

The error message number

Returns integer


public string _escape_identifiers ( string $item )

Escape the SQL Identifiers

This function escapes column and table names

Parameters

$item string

Returns string


public type _from_tables ( type $tables )

From Tables

This function implicitly groups FROM tables so there is no confusion about operator precedence in harmony with SQL standards

Parameters

$tables type

Returns type


public string _insert ( string $table, array $keys, array $values )

Insert statement

Generates a platform-specific insert string from the supplied data

Parameters

$table string
the table name

$keys array
the insert keys

$values array
the insert values

Returns string


public string _insert_batch ( string $table, array $keys, array $values )

Insert_batch statement

Generates a platform-specific insert string from the supplied data

Parameters

$table string
the table name

$keys array
the insert keys

$values array
the insert values

Returns string


public string _update ( string $table, array $values, array $where, array $orderby = array(), array $limit = FALSE )

Update statement

Generates a platform-specific update string from the supplied data

Parameters

$table string
the table name

$values array
the update data

$where array
the where clause

$orderby array
the orderby clause

$limit array
the limit clause

Returns string


public string _update_batch ( string $table, array $values, array $index, mixed $where = NULL )

Update_Batch statement

Generates a platform-specific batch update string from the supplied data

Parameters

$table string
the table name

$values array
the update data

$index array
the where clause

$where

Returns string


public string _truncate ( string $table )

Truncate statement

Generates a platform-specific truncate string from the supplied data If the database does not support the truncate() command This function maps to "DELETE FROM table"

Parameters

$table string
the table name

Returns string


public string _delete ( string $table, array $where = array(), string $like = array(), mixed $limit = FALSE )

Delete statement

Generates a platform-specific delete string from the supplied data

Parameters

$table string
the table name

$where array
the where clause

$like string
the limit clause

$limit

Returns string


public string _limit ( string $sql, integer $limit, integer $offset )

Limit string

Generates a platform-specific LIMIT clause

Parameters

$sql string
the sql query string

$limit integer
the number of rows to limit the query to

$offset integer
the offset value

Returns string


public _close ( resource $conn_id )

Close DB Connection

Parameters

$conn_id resource

<table class="summary" id="properties">
<caption>Properties summary</caption>
<tr data-order="dbdriver" id="$dbdriver">
	<td class="attributes"><code>
		public  
		string
	</code></td>

	<td class="name">

$dbdriver

'pdo'
#
		<div class="description detailed">
			

		</div>
	</div></td>
</tr>
<tr data-order="_escape_char" id="$_escape_char">
	<td class="attributes"><code>
		public  
		string
	</code></td>

	<td class="name">

$_escape_char

''
#
		<div class="description detailed">
			

		</div>
	</div></td>
</tr>
<tr data-order="_like_escape_str" id="$_like_escape_str">
	<td class="attributes"><code>
		public  
		mixed
	</code></td>

	<td class="name">

$_like_escape_str

#
		<div class="description detailed">
			

		</div>
	</div></td>
</tr>
<tr data-order="_like_escape_chr" id="$_like_escape_chr">
	<td class="attributes"><code>
		public  
		mixed
	</code></td>

	<td class="name">

$_like_escape_chr

#
		<div class="description detailed">
			

		</div>
	</div></td>
</tr>
<tr data-order="_count_string" id="$_count_string">
	<td class="attributes"><code>
		public  
		string
	</code></td>

	<td class="name">

$_count_string

"SELECT COUNT(*) AS "
#
		<div class="description detailed">

The syntax to count rows is slightly different across different database engines, so this string appears in each driver and is used for the count_all() and count_all_results() functions.

		</div>
	</div></td>
</tr>
<tr data-order="_random_keyword" id="$_random_keyword">
	<td class="attributes"><code>
		public  
		mixed
	</code></td>

	<td class="name">

$_random_keyword

#
		<div class="description detailed">
			

		</div>
	</div></td>
</tr>
<tr data-order="options" id="$options">
	<td class="attributes"><code>
		public  
		array
	</code></td>

	<td class="name">

$options

array()
#
		<div class="description detailed">
			

		</div>
	</div></td>
</tr>
</table>
⚠️ **GitHub.com Fallback** ⚠️