TYPO3 CMS  TYPO3_6-2
adodb-sybase_ase.inc.php
Go to the documentation of this file.
1 <?php
2 /*
3  V5.19 23-Apr-2014 (c) 2000-2014 John Lim (jlim#natsoft.com). 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 
8  Set tabs to 4.
9 
10  Contributed by Interakt Online. Thx Cristian MARIN cristic#interaktonline.com
11 */
12 
13 
14 require_once ADODB_DIR."/drivers/adodb-sybase.inc.php";
15 
17  var $databaseType = "sybase_ase";
18 
19  var $metaTablesSQL="SELECT sysobjects.name FROM sysobjects, sysusers WHERE sysobjects.type='U' AND sysobjects.uid = sysusers.uid";
20  var $metaColumnsSQL = "SELECT syscolumns.name AS field_name, systypes.name AS type, systypes.length AS width FROM sysobjects, syscolumns, systypes WHERE sysobjects.name='%s' AND syscolumns.id = sysobjects.id AND systypes.type=syscolumns.type";
21  var $metaDatabasesSQL ="SELECT a.name FROM master.dbo.sysdatabases a, master.dbo.syslogins b WHERE a.suid = b.suid and a.name like '%' and a.name != 'tempdb' and a.status3 != 256 order by 1";
22 
23  function ADODB_sybase_ase()
24  {
25  }
26 
27  // split the Views, Tables and procedures.
28  function MetaTables($ttype=false,$showSchema=false,$mask=false)
29  {
30  $false = false;
31  if ($this->metaTablesSQL) {
32  // complicated state saving by the need for backward compat
33 
34  if ($ttype == 'VIEWS'){
35  $sql = str_replace('U', 'V', $this->metaTablesSQL);
36  }elseif (false === $ttype){
37  $sql = str_replace('U',"U' OR type='V", $this->metaTablesSQL);
38  }else{ // TABLES OR ANY OTHER
40  }
41  $rs = $this->Execute($sql);
42 
43  if ($rs === false || !method_exists($rs, 'GetArray')){
44  return $false;
45  }
46  $arr = $rs->GetArray();
47 
48  $arr2 = array();
49  foreach($arr as $key=>$value){
50  $arr2[] = trim($value['name']);
51  }
52  return $arr2;
53  }
54  return $false;
55  }
56 
57  function MetaDatabases()
58  {
59  $arr = array();
60  if ($this->metaDatabasesSQL!='') {
61  $rs = $this->Execute($this->metaDatabasesSQL);
62  if ($rs && !$rs->EOF){
63  while (!$rs->EOF){
64  $arr[] = $rs->Fields('name');
65  $rs->MoveNext();
66  }
67  return $arr;
68  }
69  }
70  return false;
71  }
72 
73  // fix a bug which prevent the metaColumns query to be executed for Sybase ASE
74  function MetaColumns($table,$upper=false)
75  {
76  $false = false;
77  if (!empty($this->metaColumnsSQL)) {
78 
79  $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
80  if ($rs === false) return $false;
81 
82  $retarr = array();
83  while (!$rs->EOF) {
84  $fld = new ADOFieldObject();
85  $fld->name = $rs->Fields('field_name');
86  $fld->type = $rs->Fields('type');
87  $fld->max_length = $rs->Fields('width');
88  $retarr[strtoupper($fld->name)] = $fld;
89  $rs->MoveNext();
90  }
91  $rs->Close();
92  return $retarr;
93  }
94  return $false;
95  }
96 
97  function getProcedureList($schema)
98  {
99  return false;
100  }
101 
102  function ErrorMsg()
103  {
104  if (!function_exists('sybase_connect')){
105  return 'Your PHP doesn\'t contain the Sybase connection module!';
106  }
107  return parent::ErrorMsg();
108  }
109 }
110 
112 var $databaseType = "sybase_ase";
113 function ADORecordset_sybase_ase($id,$mode=false)
114  {
115  $this->ADORecordSet_sybase($id,$mode);
116  }
117 
118 }
$sql
Definition: server.php:82
if(isset($_REQUEST['nrows'])) else $rs
Definition: server.php:92
MetaColumns($table, $upper=false)
MetaTables($ttype=false, $showSchema=false, $mask=false)
ADORecordset_sybase_ase($id, $mode=false)