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]

Native MSSQL driver.

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: 1341 lines (36 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 4 classes

ADODB_mssqlnative:: (40 methods):
  __construct()
  ServerVersion()
  ServerInfo()
  IfNull()
  enableLastInsertID()
  _insertID()
  _affectedrows()
  GenID()
  CreateSequence()
  CreateSequence2008()
  CreateSequence2012()
  GenID2008()
  GenID2012()
  SQLDate()
  BeginTrans()
  CommitTrans()
  RollbackTrans()
  SetTransactionMode()
  RowLock()
  SelectDB()
  ErrorMsg()
  ErrorNo()
  _connect()
  _pconnect()
  Prepare()
  Concat()
  UpdateBlob()
  _query()
  _close()
  MetaIndexes()
  metaForeignKeys()
  MetaDatabases()
  MetaPrimaryKeys()
  MetaTables()
  MetaColumns()
  substr()
  charMax()
  textMax()
  metaProcedures()
  offsetDate()

Name:: (0 methods):

ADORecordset_mssqlnative:: (10 methods):
  __construct()
  _initrs()
  NextRecordSet()
  Fields()
  _fetchField()
  fetchField()
  _seek()
  MoveNext()
  _fetch()
  _close()

ADORecordSet_array_mssqlnative:: (0 methods):

Defines 0 functions


Class: ADODB_mssqlnative  - X-Ref

__construct()   X-Ref
No description

ServerVersion()   X-Ref
Initializes the SQL Server version.
Dies if connected to a non-supported version (2000 and older)


ServerInfo()   X-Ref
No description

IfNull( $field, $ifNull )   X-Ref
No description

enableLastInsertID($enable = true)   X-Ref
No description

_insertID($table = '', $column = '')   X-Ref
Get the last value inserted into an IDENTITY column.

The value will actually be set in {@see _query()} when executing an
INSERT statement, but only if the connection's $hasInsertId property
is true; this can be set with {@see enableLastInsertId()}.


_affectedrows()   X-Ref
No description

GenID($seq='adodbseq',$start=1)   X-Ref
No description

CreateSequence($seq='adodbseq',$start=1)   X-Ref
No description

CreateSequence2008($seq='adodbseq',$start=1)   X-Ref
For Server 2005,2008, duplicate a sequence with an identity table


CreateSequence2012($seq='adodbseq',$start=1)   X-Ref
Proper Sequences Only available to Server 2012 and up


GenID2008($seq='adodbseq',$start=1)   X-Ref
For Server 2005,2008, duplicate a sequence with an identity table


GenID2012($seq='adodbseq',$start=1)   X-Ref
Only available to Server 2012 and up
Cannot do this the normal adodb way by trapping an error if the
sequence does not exist because sql server will auto create a
sequence with the starting number of -9223372036854775808


SQLDate($fmt, $col=false)   X-Ref
No description

BeginTrans()   X-Ref
No description

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

RollbackTrans()   X-Ref
No description

SetTransactionMode( $transaction_mode )   X-Ref
No description

RowLock($tables,$where,$col='1 as adodbignore')   X-Ref
No description

SelectDB($dbName)   X-Ref
No description

ErrorMsg()   X-Ref
No description

ErrorNo()   X-Ref
No description

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

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

Prepare($sql)   X-Ref
No description

Concat()   X-Ref
No description

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

_query($sql, $inputarr = false)   X-Ref
Execute a query.

If executing an INSERT statement and $hasInsertId is true, will set
$lastInsId.

param: string $sql
param: array $inputarr
return: resource|false Query Id if successful, otherwise false

_close()   X-Ref
Rolls back pending transactions and closes the connection.

return: bool True, unless the connection id is invalid

MetaIndexes($table,$primary=false, $owner = false)   X-Ref
No description

metaForeignKeys($table, $owner = '', $upper = false, $associative = false)   X-Ref
No description

MetaDatabases()   X-Ref
No description

MetaPrimaryKeys($table, $owner=false)   X-Ref
No description

MetaTables($ttype=false,$showSchema=false,$mask=false)   X-Ref
No description

MetaColumns($table, $upper=true, $schema=false)   X-Ref
No description

substr($fld,$start,$length=0)   X-Ref
Returns a substring of a varchar type field

The SQL server version varies because the length is mandatory, so
we append a reasonable string length

param: string    $fld    The field to sub-string
param: int        $start    The start point
param: int        $length    An optional length
return: The SQL text

charMax()   X-Ref
Returns the maximum size of a MetaType C field. Because of the
database design, SQL Server places no limits on the size of data inserted
Although the actual limit is 2^31-1 bytes.

return: int

textMax()   X-Ref
Returns the maximum size of a MetaType X field. Because of the
database design, SQL Server places no limits on the size of data inserted
Although the actual limit is 2^31-1 bytes.

return: int

metaProcedures($procedureNamePattern = null, $catalog = null, $schemaPattern = null)   X-Ref
Lists procedures, functions and methods in an array.

param: string $procedureNamePattern (optional)
param: string $catalog                 (optional)
param: string $schemaPattern         (optional)
return: array of stored objects in current database.

offsetDate($dayFraction, $date = false)   X-Ref
An SQL Statement that adds a specific number of
days or part to local datetime

param: float $dayFraction
param: string $date
return: string

Class: Name  - X-Ref

Class: ADORecordset_mssqlnative  - X-Ref

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


_initrs()   X-Ref
No description

NextRecordSet()   X-Ref
No description

Fields($colname)   X-Ref
No description

_fetchField($fieldOffset = -1)   X-Ref
Returns: an object containing field information.

Get column information in the Recordset object. fetchField()
can be used in order to obtain information about fields in a
certain query result. If the field offset isn't specified,
the next field that wasn't yet retrieved by fetchField()
is retrieved.

param: int $fieldOffset (optional default=-1 for all
return: mixed an ADOFieldObject, or array of objects

fetchField($fieldOffset = -1)   X-Ref
No description

_seek($row)   X-Ref
No description

MoveNext()   X-Ref
No description

_fetch($ignore_fields=false)   X-Ref
No description

_close()   X-Ref
close() only needs to be called if you are worried about using too much
memory while your script is running. All associated result memory for
the specified result identifier will automatically be freed.

return: bool tru if we succeeded in closing down

Functions that are not part of a class: