source: trunk/phpgwapi/inc/adodb/drivers/adodb-ado_mssql.inc.php @ 2

Revision 2, 2.6 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2/*
3V4.51 29 July 2004  (c) 2000-2004 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.
7Set 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
19if (!defined('ADODB_DIR')) die();
20
21if (!defined('_ADODB_ADO_LAYER')) {
22        include(ADODB_DIR."/drivers/adodb-ado.inc.php");
23}
24
25
26class  ADODB_ado_mssql extends ADODB_ado {       
27        var $databaseType = 'ado_mssql';
28        var $hasTop = 'top';
29        var $hasInsertID = true;
30        var $sysDate = 'convert(datetime,convert(char,GetDate(),102),102)';
31        var $sysTimeStamp = 'GetDate()';
32        var $leftOuter = '*=';
33        var $rightOuter = '=*';
34        var $ansiOuter = true; // for mssql7 or later
35        var $substr = "substring";
36        var $length = 'len';
37       
38        //var $_inTransaction = 1; // always open recordsets, so no transaction problems.
39       
40        function ADODB_ado_mssql()
41        {
42                $this->ADODB_ado();
43        }
44       
45        function _insertid()
46        {
47                return $this->GetOne('select @@identity');
48        }
49       
50        function _affectedrows()
51        {
52                return $this->GetOne('select @@rowcount');
53        }
54       
55        function MetaColumns($table)
56        {
57                $table = strtoupper($table);
58                $arr= array();
59                $dbc = $this->_connectionID;
60               
61                $osoptions = array();
62                $osoptions[0] = null;
63                $osoptions[1] = null;
64                $osoptions[2] = $table;
65                $osoptions[3] = null;
66               
67                $adors=@$dbc->OpenSchema(4, $osoptions);//tables
68       
69                if ($adors){
70                        while (!$adors->EOF){
71                                $fld = new ADOFieldObject();
72                                $c = $adors->Fields(3);
73                                $fld->name = $c->Value;
74                                $fld->type = 'CHAR'; // cannot discover type in ADO!
75                                $fld->max_length = -1;
76                                $arr[strtoupper($fld->name)]=$fld;
77               
78                                $adors->MoveNext();
79                        }
80                        $adors->Close();
81                }
82               
83                return $arr;
84        }
85        }
86       
87        class  ADORecordSet_ado_mssql extends ADORecordSet_ado {       
88       
89        var $databaseType = 'ado_mssql';
90       
91        function ADORecordSet_ado_mssql($id,$mode=false)
92        {
93                return $this->ADORecordSet_ado($id,$mode);
94        }
95}
96?>
Note: See TracBrowser for help on using the repository browser.