Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402] [Versions 402 and 403]

IBM DB2 Native Client driver.

Author: Mark Newnham
Copyright: 2000-2013 John Lim
Copyright: 2014 Damien Regad, Mark Newnham and the ADOdb community
License: BSD-3-Clause
License: LGPL-2.1-or-later
File Size: 1995 lines (45 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

ADODB_db2:: (40 methods):
  __construct()
  _insertID()
  _connect()
  _pconnect()
  doDB2Connect()
  unpackParameters()
  isDsn()
  getDatabasenameFromDsn()
  dbTimeStamp()
  sqlDate()
  serverInfo()
  createSequence()
  dropSequence()
  selectLimit()
  errorMsg()
  errorNo()
  beginTrans()
  CommitTrans()
  RollbackTrans()
  metaPrimaryKeys()
  metaForeignKeys()
  metaTables()
  metaIndexes()
  metaProcedures()
  metaDatabases()
  DB2Types()
  metaColumns()
  prepareSp()
  storedProcedureParameter()
  executeStoredProcedure()
  parameter()
  prepare()
  _query()
  updateBlob()
  _close()
  _affectedrows()
  getMetaCasedValue()
  setTableCasing()
  getTableCasing()
  getTableCasedValue()

Name:: (0 methods):

ADORecordSet_db2:: (11 methods):
  __construct()
  fetchField()
  fields()
  _initrs()
  _seek()
  getArrayLimit()
  moveNext()
  processCoreFetch()
  processMoveRecord()
  _fetch()
  _close()


Class: ADODB_db2  - X-Ref

__construct()   X-Ref
No description

_insertID($table = '', $column = '')   X-Ref
No description

_connect($argDSN, $argUsername, $argPassword, $argDatabasename)   X-Ref
No description

_pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)   X-Ref
No description

doDB2Connect($argDSN, $argUsername, $argPassword, $argDatabasename, $persistent=false)   X-Ref
No description

unpackParameters($argDSN, $argUsername, $argPassword, $argDatabasename)   X-Ref
Validates and preprocesses the passed parameters for consistency

param: string    $argDSN                Either DSN or database
param: string    $argUsername        User name or null
param: string    $argPassword        Password or null
param: string    $argDatabasename    Either DSN or database
return: mixed  array if correct, null if not

isDsn($dsnString)   X-Ref
Does the provided string look like a DSN

param: string    $dsnString
return: bool

getDatabasenameFromDsn($dsnString)   X-Ref
Gets the database name from the DSN

param: string    $dsnString
return: string

dbTimeStamp($ts,$isField=false)   X-Ref
format and return date string in database timestamp format

param: mixed    $ts        either a string or a unixtime
param: bool    $isField    discarded
return: string

sqlDate($fmt, $col=false)   X-Ref
Format date column in sql string given an input format that understands Y M D

param: string    $fmt
param: bool    $col
return: string

serverInfo()   X-Ref
No description

createSequence($seqname='adodbseq',$start=1)   X-Ref
No description

dropSequence($seqname='adodbseq')   X-Ref
No description

selectLimit($sql,$nrows=-1,$offset=-1,$inputArr=false,$secs2cache=0)   X-Ref
No description

errorMsg()   X-Ref
No description

errorNo()   X-Ref
No description

beginTrans()   X-Ref
No description

CommitTrans($ok=true)   X-Ref
No description

RollbackTrans()   X-Ref
No description

metaPrimaryKeys($table,$owner=false)   X-Ref
Return a list of Primary Keys for a specified table

We don't use db2_statistics as the function does not seem to play
well with mixed case table names

param: string   $table
param: bool     $primary    (optional) only return primary keys
param: bool     $owner      (optional) not used in this driver
return: string[]    Array of indexes

metaForeignKeys($table, $owner = '', $upper = false, $associative = false)   X-Ref
Returns a list of Foreign Keys associated with a specific table.

param: string $table
param: string $owner       discarded
param: bool   $upper       discarded
param: bool   $associative discarded
return: string[]|false An array where keys are tables, and values are foreign keys;

metaTables($ttype=false,$schema=false,$mask=false)   X-Ref
Returns a list of tables

param: string    $ttype (optional)
param: string    $schema    (optional)
param: string    $mask    (optional)
return: array

metaIndexes($table, $primary = false, $owner = false)   X-Ref
Return a list of indexes for a specified table

We don't use db2_statistics as the function does not seem to play
well with mixed case table names

param: string   $table
param: bool     $primary    (optional) only return primary keys
param: bool     $owner      (optional) not used in this driver
return: string[]    Array of indexes

metaProcedures($procedureNamePattern = null, $catalog = null, $schemaPattern = null)   X-Ref
List procedures or functions in an array.

We interrogate syscat.routines instead of calling the PHP
function procedures because ADOdb requires the type of procedure
this is not available in the php function

param: string $procedureNamePattern (optional)
param: string $catalog                 (optional)
param: string $schemaPattern         (optional)
return: array of procedures on current database.

metaDatabases()   X-Ref
Lists databases. Because instances are independent, we only know about
the current database name

return: string[]

DB2Types($t)   X-Ref
No description

metaColumns($table, $normalize=true)   X-Ref
No description

prepareSp($procedureName,$parameters=false)   X-Ref
In this version if prepareSp, we just check to make sure
that the name of the stored procedure is correct
If true, we returns an array
else false

param: string    $procedureName
param: mixed   $parameters (not used in db2 connections)
return: mixed[]

storedProcedureParameter(&$stmt,&$var,$name,$isOutput=false,$maxLen=4000,$type=false)   X-Ref
No description

executeStoredProcedure()   X-Ref
Executes a prepared stored procedure.

The function uses the previously accumulated information and
resources in the $storedProcedureParameters array

return: mixed    The statement id if successful, or false

parameter(&$stmt, &$var, $name, $isOutput=false, $maxLen=4000, $type=false)   X-Ref
Accepts an input or output parameter to bind to either a stored
or prepared statements. For DB2, this should not be called as an
API. always wrap with inParameter and outParameter

param: mixed[] $stmt         Statement returned by Prepare() or PrepareSP().
param: mixed   $var         PHP variable to bind to. Can set to null (for isNull support).
param: string  $name         Name of stored procedure variable name to bind to.
param: int     $isOutput     optional) Indicates direction of parameter
param: int    $maxLen        (optional)Holds an maximum length of the variable.
param: int    $type         (optional) The data type of $var.
return: bool                Success of the operation

prepare($sql)   X-Ref
Prepares a prepared SQL statement, not used for stored procedures

param: string    $sql
return: mixed

_query(&$sql,$inputarr=false)   X-Ref
Executes a query

param: mixed $sql
param: mixed $inputarr    An optional array of parameters
return: mixed                either the queryID or false

updateBlob($table,$column,$val,$where,$blobtype='BLOB')   X-Ref
No description

_close()   X-Ref
No description

_affectedrows()   X-Ref
No description

getMetaCasedValue($value)   X-Ref
Gets a meta cased parameter

Receives an input variable to be processed per the metaCasing
rule, and returns the same value, processed

param: string $value
return: string

setTableCasing($caseOption)   X-Ref
Sets the table case parameter

param: int $caseOption
return: null

getTableCasing()   X-Ref
Gets the table casing parameter

return: int $caseOption

getTableCasedValue($value)   X-Ref
Gets a table cased parameter

Receives an input variable to be processed per the tableCasing
rule, and returns the same value, processed

param: string $value
return: string

Class: Name  - X-Ref

Class: ADORecordSet_db2  - X-Ref

__construct($id,$mode=false)   X-Ref
No description

fetchField($offset = 0)   X-Ref
No description

fields($colname)   X-Ref
No description

_initrs()   X-Ref
No description

_seek($row)   X-Ref
No description

getArrayLimit($nrows,$offset=0)   X-Ref
No description

moveNext()   X-Ref
No description

processCoreFetch()   X-Ref
No description

processMoveRecord()   X-Ref
No description

_fetch()   X-Ref
No description

_close()   X-Ref
No description