22 if (!defined(
'ADODB_DIR'))
die();
24 if (!function_exists(
'sqlsrv_configure')) {
25 die(
"mssqlnative extension not installed");
28 if (!function_exists(
'sqlsrv_set_error_handling')) {
29 function sqlsrv_set_error_handling($constant) {
30 sqlsrv_configure(
"WarningsReturnAsErrors", $constant);
33 if (!function_exists(
'sqlsrv_log_set_severity')) {
34 function sqlsrv_log_set_severity($constant) {
35 sqlsrv_configure(
"LogSeverity", $constant);
38 if (!function_exists(
'sqlsrv_log_set_subsystems')) {
39 function sqlsrv_log_set_subsystems($constant) {
40 sqlsrv_configure(
"LogSubsystems", $constant);
70 if (ADODB_PHPVER >= 0x4300) {
72 ini_set(
'mssql.datetimeconvert',0);
76 $ADODB_mssql_mths = array(
77 'JAN'=>1,
'FEB'=>2,
'MAR'=>3,
'APR'=>4,
'MAY'=>5,
'JUN'=>6,
78 'JUL'=>7,
'AUG'=>8,
'SEP'=>9,
'OCT'=>10,
'NOV'=>11,
'DEC'=>12);
93 var
$metaTablesSQL=
"select name,case when type='U' then 'T' else 'V' end from sysobjects where (type='U' or type='V') and (name not in ('sysallocations','syscolumns','syscomments','sysdepends','sysfilegroups','sysfiles','sysfiles1','sysforeignkeys','sysfulltextcatalogs','sysindexes','sysindexkeys','sysmembers','sysobjects','syspermissions','sysprotects','sysreferences','systypes','sysusers','sysalternates','sysconstraints','syssegments','REFERENTIAL_CONSTRAINTS','CHECK_CONSTRAINTS','CONSTRAINT_TABLE_USAGE','CONSTRAINT_COLUMN_USAGE','VIEWS','VIEW_TABLE_USAGE','VIEW_COLUMN_USAGE','SCHEMATA','TABLES','TABLE_CONSTRAINTS','TABLE_PRIVILEGES','COLUMNS','COLUMN_DOMAIN_USAGE','COLUMN_PRIVILEGES','DOMAINS','DOMAIN_CONSTRAINTS','KEY_COLUMN_USAGE','dtproperties'))";
100 c.isnullable as nullable, 101 c.cdefault as default_value, 103 t.length as type_length, 106 join systypes t on t.xusertype=c.xusertype 107 join sysobjects o on o.id=c.id 108 join sys.tables st on st.name=o.name 109 join sys.columns sc on sc.object_id = st.object_id and sc.name=c.name 113 var
$sysDate =
'convert(datetime,convert(char,GetDate(),102),102)';
133 sqlsrv_set_error_handling( SQLSRV_ERRORS_LOG_ALL );
134 sqlsrv_log_set_severity( SQLSRV_LOG_SEVERITY_ALL );
135 sqlsrv_log_set_subsystems(SQLSRV_LOG_SYSTEM_ALL);
136 sqlsrv_configure(
'warnings_return_as_errors', 0);
138 sqlsrv_set_error_handling(0);
139 sqlsrv_log_set_severity(0);
140 sqlsrv_log_set_subsystems(SQLSRV_LOG_SYSTEM_ALL);
141 sqlsrv_configure(
'warnings_return_as_errors', 0);
146 if (preg_match(
'/^09/',$data[
'version'])){
150 $this->mssql_version = 9;
151 } elseif (preg_match(
'/^10/',$data[
'version'])){
155 $this->mssql_version = 10;
156 } elseif (preg_match(
'/^11/',$data[
'version'])){
160 $this->mssql_version = 11;
162 die(
"SQL SERVER VERSION {$data['version']} NOT SUPPORTED IN mssqlnative DRIVER");
166 global $ADODB_FETCH_MODE;
170 if ($this->fetchMode ===
false) {
171 $savem = $ADODB_FETCH_MODE;
172 $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
173 } elseif ($this->fetchMode >=0 && $this->fetchMode <=2) {
174 $savem = $this->fetchMode;
176 $savem = $this->SetFetchMode(ADODB_FETCH_NUM);
178 $arrServerInfo = sqlsrv_server_info($this->_connectionID);
179 $ADODB_FETCH_MODE = $savem;
180 $arr[
'description'] = $arrServerInfo[
'SQLServerName'].
' connected to '.$arrServerInfo[
'CurrentDatabase'];
181 $arr[
'version'] = $arrServerInfo[
'SQLServerVersion'];
187 return " ISNULL($field, $ifNull) ";
197 return $this->lastInsertID;
203 return sqlsrv_rows_affected($this->_queryID);
206 function GenID($seq=
'adodbseq',$start=1) {
207 if (!$this->mssql_version)
209 switch($this->mssql_version){
222 if (!$this->mssql_vesion)
225 switch($this->mssql_version){
242 if($this->
debug) error_log(
"<hr>CreateSequence($seq,$start)");
243 sqlsrv_begin_transaction($this->_connectionID);
245 $this->Execute(
"create table $seq (id int)");
246 $ok = $this->Execute(
"insert into $seq with (tablock,holdlock) values($start)");
248 if($this->
debug) error_log(
"<hr>Error: ROLLBACK");
249 sqlsrv_rollback($this->_connectionID);
252 sqlsrv_commit($this->_connectionID);
260 if (!$this->sequences){
261 $sql =
"SELECT name FROM sys.sequences";
262 $this->sequences = $this->GetCol(
$sql);
264 $ok = $this->Execute(
"CREATE SEQUENCE $seq START WITH $start INCREMENT BY 1");
266 die(
"CANNOT CREATE SEQUENCE" . print_r(sqlsrv_errors(),
true));
267 $this->sequences[] = $seq;
275 if($this->
debug) error_log(
"<hr>CreateSequence($seq,$start)");
276 sqlsrv_begin_transaction($this->_connectionID);
277 $ok = $this->Execute(
"update $seq with (tablock,holdlock) set id = id + 1");
280 $this->Execute(
"create table $seq (id int)");
281 $ok = $this->Execute(
"insert into $seq with (tablock,holdlock) values($start)");
283 if($this->
debug) error_log(
"<hr>Error: ROLLBACK");
284 sqlsrv_rollback($this->_connectionID);
288 $num = $this->GetOne(
"select id from $seq");
289 sqlsrv_commit($this->_connectionID);
308 if (!$this->sequences){
309 $sql =
"SELECT name FROM sys.sequences";
310 $this->sequences = $this->GetCol(
$sql);
312 if (!is_array($this->sequences)
313 || is_array($this->sequences) && !in_array($seq,$this->sequences)){
317 $num = $this->GetOne(
"SELECT NEXT VALUE FOR $seq");
328 for ($i=0; $i < $len; $i++) {
334 $s .=
"datename(yyyy,$col)";
337 $s .=
"convert(char(3),$col,0)";
340 $s .=
"replace(str(month($col),2),' ','0')";
344 $s .=
"datename(quarter,$col)";
348 $s .=
"replace(str(day($col),2),' ','0')";
351 $s .=
"substring(convert(char(14),$col,0),13,2)";
355 $s .=
"replace(str(datepart(hh,$col),2),' ','0')";
359 $s .=
"replace(str(datepart(mi,$col),2),' ','0')";
362 $s .=
"replace(str(datepart(ss,$col),2),' ','0')";
366 $s .=
"substring(convert(char(19),$col,0),18,2)";
372 $ch = substr($fmt,$i,1);
374 $s .= $this->qstr($ch);
384 if ($this->transOff)
return true;
385 $this->transCnt += 1;
386 if ($this->
debug) error_log(
'<hr>begin transaction');
387 sqlsrv_begin_transaction($this->_connectionID);
393 if ($this->transOff)
return true;
394 if ($this->
debug) error_log(
'<hr>commit transaction');
396 if ($this->transCnt) $this->transCnt -= 1;
397 sqlsrv_commit($this->_connectionID);
402 if ($this->transOff)
return true;
403 if ($this->
debug) error_log(
'<hr>rollback transaction');
404 if ($this->transCnt) $this->transCnt -= 1;
405 sqlsrv_rollback($this->_connectionID);
411 $this->_transmode = $transaction_mode;
412 if (empty($transaction_mode)) {
413 $this->Execute(
'SET TRANSACTION ISOLATION LEVEL READ COMMITTED');
416 if (!stristr($transaction_mode,
'isolation')) $transaction_mode =
'ISOLATION LEVEL '.$transaction_mode;
417 $this->Execute(
"SET TRANSACTION ".$transaction_mode);
432 function RowLock($tables,$where,$col=
'1 as adodbignore')
434 if ($col ==
'1 as adodbignore') $col =
'top 1 null as ignore';
436 return $this->GetOne(
"select $col from $tables with (ROWLOCK,HOLDLOCK) where $where");
441 $this->database = $dbName;
442 $this->databaseName = $dbName; # obsolete, retained
for compat with older adodb versions
443 if ($this->_connectionID) {
444 $rs = $this->Execute(
'USE '.$dbName);
454 $retErrors = sqlsrv_errors(SQLSRV_ERR_ALL);
455 if($retErrors != null) {
456 foreach($retErrors as $arrError) {
457 $this->_errorMsg .=
"SQLState: ".$arrError[
'SQLSTATE'].
"\n";
458 $this->_errorMsg .=
"Error Code: ".$arrError[
'code'].
"\n";
459 $this->_errorMsg .=
"Message: ".$arrError[
'message'].
"\n";
462 $this->_errorMsg =
'';
464 return $this->_errorMsg;
469 if ($this->_logsql && $this->_errorCode !==
false)
return $this->_errorCode;
470 $err = sqlsrv_errors(SQLSRV_ERR_ALL);
471 if($err[0])
return $err[0][
'code'];
476 function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
478 if (!function_exists(
'sqlsrv_connect'))
return null;
482 list ($hostname, $port) = explode(
':', $argHostname, 2);
483 if (strpos($hostname,
'\\') ===
false) {
484 $argHostname = $hostname .
',' . $port;
486 $argHostname = $hostname;
489 $connectionInfo[
'Database'] = $argDatabasename;
490 if (!empty($argUsername)) {
491 $connectionInfo[
'UID'] = $argUsername;
493 if (!empty($argPassword)) {
494 $connectionInfo[
'PWD'] = $argPassword;
496 if (!empty($this->charSet)) {
497 $connectionInfo[
'CharacterSet'] = $this->charSet;
499 if ($this->
debug) error_log(
"<hr>connecting... hostname: $argHostname params: ".var_export($connectionInfo,
true));
501 if(!($this->_connectionID = sqlsrv_connect($argHostname,$connectionInfo))) {
502 if ($this->
debug) error_log(
"<hr><b>errors</b>: ".print_r( sqlsrv_errors(),
true));
511 function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
514 return $this->
_connect($argHostname, $argUsername, $argPassword, $argDatabasename);
521 $stmt = sqlsrv_prepare( $this->_connectionID,
$sql);
522 if (!$stmt)
return $sql;
523 return array(
$sql,$stmt);
533 $arr = func_get_args();
536 if (
sizeof($arr) == 1) {
537 foreach ($arr as $arg) {
538 $args = explode(
',', $arg);
543 array_walk($arr, create_function(
'&$v',
'$v = "CAST(" . $v . " AS VARCHAR(255))";'));
544 $s = implode(
'+',$arr);
545 if (
sizeof($arr) > 0)
return "$s";
562 function UpdateBlob($table,$column,$val,$where,$blobtype=
'BLOB')
565 if (strtoupper($blobtype) ==
'CLOB') {
566 $sql =
"UPDATE $table SET $column='" . $val .
"' WHERE $where";
567 return $this->Execute(
$sql) !=
false;
569 $sql =
"UPDATE $table SET $column=0x".bin2hex($val).
" WHERE $where";
570 return $this->Execute(
$sql) !=
false;
576 $this->_errorMsg =
false;
582 if(preg_match(
'/^\W*(insert [^;]+);?$/i',
$sql)) {
584 $sql .=
'; '.$this->identitySQL;
587 $rez = sqlsrv_query($this->_connectionID,
$sql, $inputarr);
589 $rez = sqlsrv_query($this->_connectionID,
$sql);
592 if ($this->
debug) error_log(
"<hr>running query: ".var_export(
$sql,
true).
"<hr>input array: ".var_export($inputarr,
true).
"<hr>result: ".var_export($rez,
true));
596 }
else if ($insert) {
598 sqlsrv_next_result($rez);
600 $this->lastInsertID = sqlsrv_get_field($rez, 0);
609 $rez = @sqlsrv_close($this->_connectionID);
610 $this->_connectionID =
false;
627 $table = $this->qstr($table);
629 $sql =
"SELECT i.name AS ind_name, C.name AS col_name, USER_NAME(O.uid) AS Owner, c.colid, k.Keyno, 630 CASE WHEN I.indid BETWEEN 1 AND 254 AND (I.status & 2048 = 2048 OR I.Status = 16402 AND O.XType = 'V') THEN 1 ELSE 0 END AS IsPK, 631 CASE WHEN I.status & 2 = 2 THEN 1 ELSE 0 END AS IsUnique 632 FROM dbo.sysobjects o INNER JOIN dbo.sysindexes I ON o.id = i.id 633 INNER JOIN dbo.sysindexkeys K ON I.id = K.id AND I.Indid = K.Indid 634 INNER JOIN dbo.syscolumns c ON K.id = C.id AND K.colid = C.Colid 635 WHERE LEFT(i.name, 8) <> '_WA_Sys_' AND o.status >= 0 AND O.Name LIKE $table 636 ORDER BY O.name, I.Name, K.keyno";
638 global $ADODB_FETCH_MODE;
639 $save = $ADODB_FETCH_MODE;
640 $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
641 if ($this->fetchMode !== FALSE) {
642 $savem = $this->SetFetchMode(FALSE);
647 $this->SetFetchMode($savem);
649 $ADODB_FETCH_MODE = $save;
651 if (!is_object(
$rs)) {
656 while ($row =
$rs->FetchRow()) {
657 if (!$primary && $row[5])
continue;
659 $indexes[$row[0]][
'unique'] = $row[6];
660 $indexes[$row[0]][
'columns'][] = $row[1];
667 global $ADODB_FETCH_MODE;
669 $save = $ADODB_FETCH_MODE;
670 $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
671 $table = $this->qstr(strtoupper($table));
674 "select object_name(constid) as constraint_name, 675 col_name(fkeyid, fkey) as column_name, 676 object_name(rkeyid) as referenced_table_name, 677 col_name(rkeyid, rkey) as referenced_column_name 679 where upper(object_name(fkeyid)) = $table 680 order by constraint_name, referenced_table_name, keyno";
682 $constraints =& $this->GetArray(
$sql);
684 $ADODB_FETCH_MODE = $save;
687 foreach($constraints as $constr) {
689 $arr[$constr[0]][$constr[2]][] = $constr[1].
'='.$constr[3];
691 if (!$arr)
return false;
695 foreach($arr as $k => $v) {
696 foreach($v as $a => $b) {
697 if ($upper) $a = strtoupper($a);
708 $rs =& $this->Execute($this->metaDatabasesSQL);
709 $rows =
$rs->GetRows();
711 for($i=0;$i<count($rows);$i++) {
712 $ret[] = $rows[$i][0];
725 global $ADODB_FETCH_MODE;
728 $this->_findschema($table,$schema);
730 if ($schema) $schema =
"and k.table_catalog like '$schema%'";
732 $sql =
"select distinct k.column_name,ordinal_position from information_schema.key_column_usage k, 733 information_schema.table_constraints tc 734 where tc.constraint_name = k.constraint_name and tc.constraint_type = 735 'PRIMARY KEY' and k.table_name = '$table' $schema order by ordinal_position ";
737 $savem = $ADODB_FETCH_MODE;
738 $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
739 $a = $this->GetCol(
$sql);
740 $ADODB_FETCH_MODE = $savem;
742 if ($a &&
sizeof($a)>0)
return $a;
748 function MetaTables($ttype=
false,$showSchema=
false,$mask=
false)
752 $mask = $this->qstr(($mask));
753 $this->metaTablesSQL .=
" AND name like $mask";
755 $ret = ADOConnection::MetaTables($ttype,$showSchema);
758 $this->metaTablesSQL = $save;
765 static $cached_columns = array();
766 if ($this->cachedSchemaFlush)
767 $cached_columns = array();
769 if (array_key_exists($table,$cached_columns)){
770 return $cached_columns[$table];
774 if (!$this->mssql_version)
777 $this->_findschema($table,$schema);
782 global $ADODB_FETCH_MODE;
783 $save = $ADODB_FETCH_MODE;
784 $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
786 if ($this->fetchMode !==
false) $savem = $this->SetFetchMode(
false);
787 $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
793 if (isset($savem)) $this->SetFetchMode($savem);
794 $ADODB_FETCH_MODE = $save;
795 if (!is_object(
$rs)) {
803 $fld =
new ADOFieldObject();
804 if (array_key_exists(0,
$rs->fields)) {
805 $fld->name =
$rs->fields[0];
806 $fld->type =
$rs->fields[1];
807 $fld->max_length =
$rs->fields[2];
808 $fld->precision =
$rs->fields[3];
809 $fld->scale =
$rs->fields[4];
810 $fld->not_null =!
$rs->fields[5];
811 $fld->has_default =
$rs->fields[6];
812 $fld->xtype =
$rs->fields[7];
813 $fld->type_length =
$rs->fields[8];
814 $fld->auto_increment=
$rs->fields[9];
816 $fld->name =
$rs->fields[
'name'];
817 $fld->type =
$rs->fields[
'type'];
818 $fld->max_length =
$rs->fields[
'length'];
819 $fld->precision =
$rs->fields[
'precision'];
820 $fld->scale =
$rs->fields[
'scale'];
821 $fld->not_null =!
$rs->fields[
'nullable'];
822 $fld->has_default =
$rs->fields[
'default_value'];
823 $fld->xtype =
$rs->fields[
'xtype'];
824 $fld->type_length =
$rs->fields[
'type_length'];
825 $fld->auto_increment=
$rs->fields[
'is_identity'];
828 if ($save == ADODB_FETCH_NUM)
831 $retarr[strtoupper($fld->name)] = $fld;
838 $cached_columns[$table] = $retarr;
852 var $canSeek =
false;
853 var $fieldOffset = 0;
858 if ($mode ===
false) {
859 global $ADODB_FETCH_MODE;
860 $mode = $ADODB_FETCH_MODE;
863 $this->fetchMode = $mode;
864 return $this->ADORecordSet($id,$mode);
870 global $ADODB_COUNTRECS;
871 # KMN # if ($this->connection->debug) error_log("(before) ADODB_COUNTRECS: {$ADODB_COUNTRECS} _numOfRows: {$this->_numOfRows} _numOfFields: {$this->_numOfFields}"); 875 $this->_numOfRows = -1;
876 $fieldmeta = sqlsrv_field_metadata($this->_queryID);
877 $this->_numOfFields = ($fieldmeta)? count($fieldmeta):-1;
878 # KMN # if ($this->connection->debug) error_log("(after) _numOfRows: {$this->_numOfRows} _numOfFields: {$this->_numOfFields}"); 882 if ($this->_numOfFields>0) {
883 $this->_fieldobjs = array();
884 $max = $this->_numOfFields;
885 for ($i=0;$i<$max; $i++) $this->_fieldobjs[] = $this->_FetchField($i);
895 if (!sqlsrv_next_result($this->_queryID))
return false;
896 $this->_inited =
false;
898 $this->_currentRow = -1;
906 if ($this->fetchMode != ADODB_FETCH_NUM)
return $this->fields[$colname];
908 $this->bind = array();
909 for ($i=0; $i < $this->_numOfFields; $i++) {
910 $o = $this->FetchField($i);
911 $this->bind[strtoupper($o->name)] = $i;
915 return $this->fields[$this->bind[strtoupper($colname)]];
926 $_typeConversion = array(
927 -155 =>
'datetimeoffset',
931 -11 =>
'uniqueidentifier',
954 $fa = @sqlsrv_field_metadata($this->_queryID);
955 if ($fieldOffset != -1) {
956 $fa = $fa[$fieldOffset];
965 $fa = array_change_key_case($fa, CASE_LOWER);
967 if ($fieldOffset != -1)
970 'name' => $fa[
'name'],
971 'max_length' => $fa[
'size'],
972 'column_source' => $fa[
'name'],
973 'type' => $_typeConversion[$fa[
'type']]
978 foreach ($fa as $key => $value)
981 'name' => $value[
'name'],
982 'max_length' => $value[
'size'],
983 'column_source' => $value[
'name'],
984 'type' => $_typeConversion[$value[
'type']]
1003 return $this->_fieldobjs[$fieldOffset];
1016 if ($this->EOF)
return false;
1018 $this->_currentRow++;
1021 if ($this->_fetch())
return true;
1033 # KMN # if ($this->connection->debug) error_log("_fetch()"); 1034 if ($this->fetchMode & ADODB_FETCH_ASSOC) {
1035 if ($this->fetchMode & ADODB_FETCH_NUM) {
1037 $this->fields = @sqlsrv_fetch_array($this->_queryID,SQLSRV_FETCH_BOTH);
1040 $this->fields = @sqlsrv_fetch_array($this->_queryID,SQLSRV_FETCH_ASSOC);
1043 if (is_array($this->fields)) {
1044 if (ADODB_ASSOC_CASE == 0) {
1045 foreach($this->fields as $k=>$v) {
1046 $this->fields[strtolower($k)] = $v;
1048 }
else if (ADODB_ASSOC_CASE == 1) {
1049 foreach($this->fields as $k=>$v) {
1050 $this->fields[strtoupper($k)] = $v;
1056 $this->fields = @sqlsrv_fetch_array($this->_queryID,SQLSRV_FETCH_NUMERIC);
1058 if(is_array($this->fields) && array_key_exists(1,$this->fields) && !array_key_exists(0,$this->fields)) {
1059 $arrFixed = array();
1060 foreach($this->fields as $key=>$value) {
1061 if(is_numeric($key)) {
1062 $arrFixed[$key-1] = $value;
1064 $arrFixed[$key] = $value;
1068 $this->fields = $arrFixed;
1070 if(is_array($this->fields)) {
1071 foreach($this->fields as $key=>$value) {
1072 if (is_object($value) && method_exists($value,
'format')) {
1073 $this->fields[$key] = $value->format(
"Y-m-d\TH:i:s\Z");
1077 if($this->fields === null) $this->fields =
false;
1078 # KMN # if ($this->connection->debug) error_log("<hr>after _fetch, fields: <pre>".print_r($this->fields,true)." backtrace: ".adodb_backtrace(false)); 1079 return $this->fields;
1086 $rez = sqlsrv_free_stmt($this->_queryID);
1087 $this->_queryID =
false;
1107 $this->ADORecordSet_array($id,$mode);
1114 if (is_numeric(substr($v,0,1)) && ADODB_PHPVER >= 0x4200)
return parent::UnixDate($v);
1119 if ($ADODB_mssql_date_order ==
'dmy') {
1120 if (!preg_match(
"|^([0-9]{1,2})[-/\. ]+([A-Za-z]{3})[-/\. ]+([0-9]{4})|" ,$v, $rr)) {
1121 return parent::UnixDate($v);
1123 if ($rr[3] <= TIMESTAMP_FIRST_YEAR)
return 0;
1126 $themth = substr(strtoupper($rr[2]),0,3);
1128 if (!preg_match(
"|^([A-Za-z]{3})[-/\. ]+([0-9]{1,2})[-/\. ]+([0-9]{4})|" ,$v, $rr)) {
1129 return parent::UnixDate($v);
1131 if ($rr[3] <= TIMESTAMP_FIRST_YEAR)
return 0;
1134 $themth = substr(strtoupper($rr[1]),0,3);
1136 $themth = $ADODB_mssql_mths[$themth];
1137 if ($themth <= 0)
return false;
1145 if (is_numeric(substr($v,0,1)) && ADODB_PHPVER >= 0x4200)
return parent::UnixTimeStamp($v);
1150 if ($ADODB_mssql_date_order ==
'dmy') {
1151 if (!preg_match(
"|^([0-9]{1,2})[-/\. ]+([A-Za-z]{3})[-/\. ]+([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})|" 1152 ,$v, $rr))
return parent::UnixTimeStamp($v);
1153 if ($rr[3] <= TIMESTAMP_FIRST_YEAR)
return 0;
1156 $themth = substr(strtoupper($rr[2]),0,3);
1158 if (!preg_match(
"|^([A-Za-z]{3})[-/\. ]+([0-9]{1,2})[-/\. ]+([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})|" 1159 ,$v, $rr))
return parent::UnixTimeStamp($v);
1160 if ($rr[3] <= TIMESTAMP_FIRST_YEAR)
return 0;
1163 $themth = substr(strtoupper($rr[1]),0,3);
1166 $themth = $ADODB_mssql_mths[$themth];
1167 if ($themth <= 0)
return false;
1169 switch (strtoupper($rr[6])) {
1171 if ($rr[4]<12) $rr[4] += 12;
1174 if ($rr[4]==12) $rr[4] = 0;
1180 return adodb_mktime($rr[4],$rr[5],0,$themth,$theday,$rr[3]);
MetaTables($ttype=false, $showSchema=false, $mask=false)
GenID2012($seq='adodbseq', $start=1)
ADORecordSet_array_mssqlnative($id=-1, $mode=false)
MetaForeignKeys($table, $owner=false, $upper=false)
if(isset($_REQUEST['nrows'])) else $rs
SQLDate($fmt, $col=false)
_fetch($ignore_fields=false)
_FetchField($fieldOffset=-1)
SetTransactionMode( $transaction_mode)
UpdateBlob($table, $column, $val, $where, $blobtype='BLOB')
GenID($seq='adodbseq', $start=1)
GenID2008($seq='adodbseq', $start=1)
MetaColumns($table, $upper=true, $schema=false)
MetaPrimaryKeys($table, $owner=false)
CreateSequence($seq='adodbseq', $start=1)
ADORecordset_mssqlnative($id, $mode=false)
_query($sql, $inputarr=false)
FetchField($fieldOffset=-1)
debug($variable='', $name=' *variable *', $line=' *line *', $file=' *file *', $recursiveDepth=3, $debugLevel=E_DEBUG)
adodb_mktime($hr, $min, $sec, $mon=false, $day=false, $year=false, $is_dst=false, $is_gmt=false)
CreateSequence2012($seq='adodb', $start=1)
_connect($argHostname, $argUsername, $argPassword, $argDatabasename)
RowLock($tables, $where, $col='1 as adodbignore')
MetaIndexes($table, $primary=false, $owner=false)
_pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
CreateSequence2008($seq='adodbseq', $start=1)