00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 if (!defined('ADODB_DIR')) die();
00020
00021 if (!defined('_ADODB_ADO_LAYER')) {
00022 if (PHP_VERSION >= 5) include(ADODB_DIR."/drivers/adodb-ado5.inc.php");
00023 else include(ADODB_DIR."/drivers/adodb-ado.inc.php");
00024 }
00025
00026
00027 class ADODB_ado_mssql extends ADODB_ado {
00028 var $databaseType = 'ado_mssql';
00029 var $hasTop = 'top';
00030 var $hasInsertID = true;
00031 var $sysDate = 'convert(datetime,convert(char,GetDate(),102),102)';
00032 var $sysTimeStamp = 'GetDate()';
00033 var $leftOuter = '*=';
00034 var $rightOuter = '=*';
00035 var $ansiOuter = true;
00036 var $substr = "substring";
00037 var $length = 'len';
00038 var $_dropSeqSQL = "drop table %s";
00039
00040
00041
00042 function ADODB_ado_mssql()
00043 {
00044 $this->ADODB_ado();
00045 }
00046
00047 function _insertid()
00048 {
00049 return $this->GetOne('select @@identity');
00050 }
00051
00052 function _affectedrows()
00053 {
00054 return $this->GetOne('select @@rowcount');
00055 }
00056
00057 function SetTransactionMode( $transaction_mode )
00058 {
00059 $this->_transmode = $transaction_mode;
00060 if (empty($transaction_mode)) {
00061 $this->Execute('SET TRANSACTION ISOLATION LEVEL READ COMMITTED');
00062 return;
00063 }
00064 if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode;
00065 $this->Execute("SET TRANSACTION ".$transaction_mode);
00066 }
00067
00068 function qstr($s,$magic_quotes=false)
00069 {
00070 $s = ADOConnection::qstr($s, $magic_quotes);
00071 return str_replace("\0", "\\\\000", $s);
00072 }
00073
00074 function MetaColumns($table)
00075 {
00076 $table = strtoupper($table);
00077 $arr= array();
00078 $dbc = $this->_connectionID;
00079
00080 $osoptions = array();
00081 $osoptions[0] = null;
00082 $osoptions[1] = null;
00083 $osoptions[2] = $table;
00084 $osoptions[3] = null;
00085
00086 $adors=@$dbc->OpenSchema(4, $osoptions);
00087
00088 if ($adors){
00089 while (!$adors->EOF){
00090 $fld = new ADOFieldObject();
00091 $c = $adors->Fields(3);
00092 $fld->name = $c->Value;
00093 $fld->type = 'CHAR';
00094 $fld->max_length = -1;
00095 $arr[strtoupper($fld->name)]=$fld;
00096
00097 $adors->MoveNext();
00098 }
00099 $adors->Close();
00100 }
00101 $false = false;
00102 return empty($arr) ? $false : $arr;
00103 }
00104
00105 function CreateSequence($seq='adodbseq',$start=1)
00106 {
00107
00108 $this->Execute('BEGIN TRANSACTION adodbseq');
00109 $start -= 1;
00110 $this->Execute("create table $seq (id float(53))");
00111 $ok = $this->Execute("insert into $seq with (tablock,holdlock) values($start)");
00112 if (!$ok) {
00113 $this->Execute('ROLLBACK TRANSACTION adodbseq');
00114 return false;
00115 }
00116 $this->Execute('COMMIT TRANSACTION adodbseq');
00117 return true;
00118 }
00119
00120 function GenID($seq='adodbseq',$start=1)
00121 {
00122
00123 $this->Execute('BEGIN TRANSACTION adodbseq');
00124 $ok = $this->Execute("update $seq with (tablock,holdlock) set id = id + 1");
00125 if (!$ok) {
00126 $this->Execute("create table $seq (id float(53))");
00127 $ok = $this->Execute("insert into $seq with (tablock,holdlock) values($start)");
00128 if (!$ok) {
00129 $this->Execute('ROLLBACK TRANSACTION adodbseq');
00130 return false;
00131 }
00132 $this->Execute('COMMIT TRANSACTION adodbseq');
00133 return $start;
00134 }
00135 $num = $this->GetOne("select id from $seq");
00136 $this->Execute('COMMIT TRANSACTION adodbseq');
00137 return $num;
00138
00139
00140
00141 }
00142
00143 }
00144
00145 class ADORecordSet_ado_mssql extends ADORecordSet_ado {
00146
00147 var $databaseType = 'ado_mssql';
00148
00149 function ADORecordSet_ado_mssql($id,$mode=false)
00150 {
00151 return $this->ADORecordSet_ado($id,$mode);
00152 }
00153 }
00154 ?>
This documentation has been generated automatically from TYPO3 source code using
Doxygen and is provided as is by
Cast Iron Coding
as a courtesy to other TYPO3 developers and users. Please consider
Cast Iron Coding — a full-service web development
agency in Portland, Oregon specializing in TYPO3 extension development — for all of your TYPO3 development and consulting needs!