\C_Database

Class C_Database Connect to the Database

Using this DB layer, the system can be connected with following DB Servers

  • Access
  • ODBC MSSQL Native
  • ODBC MSSQL
  • Postgres
  • DB2 DSNLESS
  • IBASE
  • OCI805
  • SQLITE
  • Informix
  • Informix72
  • ODBC
  • MySQL
  • MySQLi

Summary

Methods
Properties
Constants
__construct()
_db_connect()
db_query()
select_limit()
select_limit_array()
fetch_row()
fetch_array()
fetch_array_assoc()
num_rows()
query_then_fetch_array_first()
field_name()
field_nativetype()
field_index()
$hostName
$userName
$password
$databaseName
$tableName
$link
$dbType
$charset
$db
$result
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$hostName

$hostName : string

Type

string — hostname

$userName

$userName : string

Type

string — username

$password

$password : string

Type

string — password

$databaseName

$databaseName : string

Type

string — name of the database

$tableName

$tableName : string

Type

string — name of the DB table

$link

$link : string

Type

string — database link

$dbType

$dbType : string

Type

string — Database Type, by default it is MySQL

$charset

$charset : string

Type

string — Character Set of DB

$db

$db : object

Type

object — Database object

$result

$result : object

Type

object — Database query result set

Methods

__construct()

__construct(mixed $host, mixed $user, mixed $pass, mixed $dbName, string $db_type, string $charset)

Constructs DB object By default it creates mysql DB object with necessary credentials provided

Parameters

mixed $host
mixed $user
mixed $pass
mixed $dbName
string $db_type
string $charset

_db_connect()

_db_connect()

db_query()

db_query(mixed $query_str) : mixed

Executes Database SQL Desc: query database, shows errors in details if any

Parameters

mixed $query_str

Returns

mixed

select_limit()

select_limit(mixed $query_str, mixed $size, mixed $starting_row) : mixed

Selects from a result set with limit option Selects from a result set with limit option

Parameters

mixed $query_str
mixed $size
mixed $starting_row

Returns

mixed

select_limit_array()

select_limit_array(mixed $query_str, mixed $size, mixed $starting_row) : mixed

helper function to get array from select_limit function Desc: helper function to get array from select_limit function

Parameters

mixed $query_str
mixed $size
mixed $starting_row

Returns

mixed

fetch_row()

fetch_row(mixed $result) : mixed

fetch a SINGLE record from database as row Desc: fetch a SINGLE record from database as row Note: the parameter is passed as reference

Parameters

mixed $result

Returns

mixed

fetch_array()

fetch_array(mixed $result) : mixed

Desc: fetch a SINGLE record from database as array Note: the parameter is passed as reference

Parameters

mixed $result

Returns

mixed

fetch_array_assoc()

fetch_array_assoc(mixed $result) : mixed

Desc: fetch a SINGLE record from database as associative array Note: the parameter is passed as reference

Parameters

mixed $result

Returns

mixed

num_rows()

num_rows(mixed $result) : mixed

number of rows query returned Desc: number of rows query returned

Parameters

mixed $result

Returns

mixed

query_then_fetch_array_first()

query_then_fetch_array_first(mixed $query_str) : mixed

Helper function. query then, fetch the FIRST record from database as associative array

Desc: helper function. query then, fetch the FIRST record from database as associative array

Parameters

mixed $query_str

Returns

mixed

field_name()

field_name(mixed $result, mixed $index) : string

A specific field name (column name) with that index in the recordset Desc: a specific field name (column name) with that index in the recordset

Parameters

mixed $result
mixed $index

Returns

string

field_nativetype()

field_nativetype(mixed $result, mixed $index) : string

The type of a specific field name (column name) with that index in the recordset Desc: the type of a specific field name (column name) with that index in the recordset

Parameters

mixed $result
mixed $index

Returns

string

field_index()

field_index(mixed $result, mixed $field_name) : int

Return corresponding field index by field name Desc: return corresponding field index by field name

Parameters

mixed $result
mixed $field_name

Returns

int