Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 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: 2002 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

return: mixed  array if correct, null if not
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

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

return: bool
param: string    $dsnString

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

return: string
param: string    $dsnString

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

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

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

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

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

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

metaForeignKeys($table, $owner = FALSE, $upper = FALSE, $asociative = FALSE )   X-Ref
returns assoc array where keys are tables, and values are foreign keys

return: mixed[]            Array of foreign key information
param: string    $table
param: string    $owner        [optional][discarded]
param: bool    $upper        [optional][discarded]
param: bool    $associative[optional][discarded]

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

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

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

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

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

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

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

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

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

return: bool                Success of the operation
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.

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

return: mixed
param: string    $sql

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

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

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

return: string
param: string $value

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

return: null
param: int $caseOption

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

return: string
param: string $value

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