Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
36 kaklik 1
<?php
2
/* 
3
V4.80 8 Mar 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.
8
 
9
  Latest version is available at http://adodb.sourceforge.net
10
 
11
  Microsoft SQL Server ADO data driver. Requires ADO and MSSQL client. 
12
  Works only on MS Windows.
13
 
14
  It is normally better to use the mssql driver directly because it is much faster. 
15
  This file is only a technology demonstration and for test purposes.
16
*/
17
 
18
// security - hide paths
19
if (!defined('ADODB_DIR')) die();
20
 
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");
24
}
25
 
26
 
27
class  ADODB_ado_mssql extends ADODB_ado {        
28
	var $databaseType = 'ado_mssql';
29
	var $hasTop = 'top';
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";
37
	var $length = 'len';
38
 
39
	//var $_inTransaction = 1; // always open recordsets, so no transaction problems.
40
 
41
	function ADODB_ado_mssql()
42
	{
43
	        $this->ADODB_ado();
44
	}
45
 
46
	function _insertid()
47
	{
48
	        return $this->GetOne('select @@identity');
49
	}
50
 
51
	function _affectedrows()
52
	{
53
	        return $this->GetOne('select @@rowcount');
54
	}
55
 
56
	function MetaColumns($table)
57
	{
58
        $table = strtoupper($table);
59
        $arr= array();
60
        $dbc = $this->_connectionID;
61
 
62
        $osoptions = array();
63
        $osoptions[0] = null;
64
        $osoptions[1] = null;
65
        $osoptions[2] = $table;
66
        $osoptions[3] = null;
67
 
68
        $adors=@$dbc->OpenSchema(4, $osoptions);//tables
69
 
70
        if ($adors){
71
                while (!$adors->EOF){
72
                        $fld = new ADOFieldObject();
73
                        $c = $adors->Fields(3);
74
                        $fld->name = $c->Value;
75
                        $fld->type = 'CHAR'; // cannot discover type in ADO!
76
                        $fld->max_length = -1;
77
                        $arr[strtoupper($fld->name)]=$fld;
78
 
79
                        $adors->MoveNext();
80
                }
81
                $adors->Close();
82
        }
83
        $false = false;
84
		return empty($arr) ? $false : $arr;
85
	}
86
 
87
	} // end class 
88
 
89
	class  ADORecordSet_ado_mssql extends ADORecordSet_ado {        
90
 
91
	var $databaseType = 'ado_mssql';
92
 
93
	function ADORecordSet_ado_mssql($id,$mode=false)
94
	{
95
	        return $this->ADORecordSet_ado($id,$mode);
96
	}
97
}
98
?>