3
V4.92a 29 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
4
Released under both BSD license and Lesser GPL library license.
5
Whenever there is any discrepancy between the two licenses,
6
the BSD license will take precedence.
7
Set tabs to 4 for best viewing.
9
Latest version is available at http://adodb.sourceforge.net
11
Microsoft SQL Server ADO data driver. Requires ADO and MSSQL client.
12
Works only on MS Windows.
14
Warning: Some versions of PHP (esp PHP4) leak memory when ADO/COM is used.
15
Please check http://bugs.php.net/ for more info.
18
// security - hide paths
19
if (!defined('ADODB_DIR')) die();
21
if (!defined('_ADODB_ADO_LAYER')) {
22
if (PHP_VERSION >= 5) include(ADODB_DIR."/drivers/adodb-ado5.inc.php");
23
else include(ADODB_DIR."/drivers/adodb-ado.inc.php");
27
class ADODB_ado_mssql extends ADODB_ado {
28
var $databaseType = 'ado_mssql';
30
var $hasInsertID = true;
31
var $sysDate = 'convert(datetime,convert(char,GetDate(),102),102)';
32
var $sysTimeStamp = 'GetDate()';
33
var $leftOuter = '*=';
34
var $rightOuter = '=*';
35
var $ansiOuter = true; // for mssql7 or later
36
var $substr = "substring";
39
//var $_inTransaction = 1; // always open recordsets, so no transaction problems.
41
function ADODB_ado_mssql()
48
return $this->GetOne('select @@identity');
51
function _affectedrows()
53
return $this->GetOne('select @@rowcount');
56
function SetTransactionMode( $transaction_mode )
58
$this->_transmode = $transaction_mode;
59
if (empty($transaction_mode)) {
60
$this->Execute('SET TRANSACTION ISOLATION LEVEL READ COMMITTED');
63
if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode;
64
$this->Execute("SET TRANSACTION ".$transaction_mode);
67
function MetaColumns($table)
69
$table = strtoupper($table);
71
$dbc = $this->_connectionID;
76
$osoptions[2] = $table;
79
$adors=@$dbc->OpenSchema(4, $osoptions);//tables
83
$fld = new ADOFieldObject();
84
$c = $adors->Fields(3);
85
$fld->name = $c->Value;
86
$fld->type = 'CHAR'; // cannot discover type in ADO!
87
$fld->max_length = -1;
88
$arr[strtoupper($fld->name)]=$fld;
95
return empty($arr) ? $false : $arr;
98
function CreateSequence($seq='adodbseq',$start=1)
101
$this->Execute('BEGIN TRANSACTION adodbseq');
103
$this->Execute("create table $seq (id float(53))");
104
$ok = $this->Execute("insert into $seq with (tablock,holdlock) values($start)");
106
$this->Execute('ROLLBACK TRANSACTION adodbseq');
109
$this->Execute('COMMIT TRANSACTION adodbseq');
113
function GenID($seq='adodbseq',$start=1)
116
$this->Execute('BEGIN TRANSACTION adodbseq');
117
$ok = $this->Execute("update $seq with (tablock,holdlock) set id = id + 1");
119
$this->Execute("create table $seq (id float(53))");
120
$ok = $this->Execute("insert into $seq with (tablock,holdlock) values($start)");
122
$this->Execute('ROLLBACK TRANSACTION adodbseq');
125
$this->Execute('COMMIT TRANSACTION adodbseq');
128
$num = $this->GetOne("select id from $seq");
129
$this->Execute('COMMIT TRANSACTION adodbseq');
132
// in old implementation, pre 1.90, we returned GUID...
133
//return $this->GetOne("SELECT CONVERT(varchar(255), NEWID()) AS 'Char'");
138
class ADORecordSet_ado_mssql extends ADORecordSet_ado {
140
var $databaseType = 'ado_mssql';
142
function ADORecordSet_ado_mssql($id,$mode=false)
144
return $this->ADORecordSet_ado($id,$mode);
b'\\ No newline at end of file'