TYPO3 CMS  TYPO3_7-6
adodb-sybase_ase.inc.php
Go to the documentation of this file.
1 <?php
2 /*
3  @version v5.20.3 01-Jan-2016
4  @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
5  @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
6  Released under both BSD license and Lesser GPL library license.
7  Whenever there is any discrepancy between the two licenses,
8  the BSD license will take precedence.
9 
10  Set tabs to 4.
11 
12  Contributed by Interakt Online. Thx Cristian MARIN cristic#interaktonline.com
13 */
14 
15 
16 require_once ADODB_DIR."/drivers/adodb-sybase.inc.php";
17 
19  var $databaseType = "sybase_ase";
20 
21  var $metaTablesSQL="SELECT sysobjects.name FROM sysobjects, sysusers WHERE sysobjects.type='U' AND sysobjects.uid = sysusers.uid";
22  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";
23  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";
24 
25  function __construct()
26  {
27  }
28 
29  // split the Views, Tables and procedures.
30  function MetaTables($ttype=false,$showSchema=false,$mask=false)
31  {
32  $false = false;
33  if ($this->metaTablesSQL) {
34  // complicated state saving by the need for backward compat
35 
36  if ($ttype == 'VIEWS'){
37  $sql = str_replace('U', 'V', $this->metaTablesSQL);
38  }elseif (false === $ttype){
39  $sql = str_replace('U',"U' OR type='V", $this->metaTablesSQL);
40  }else{ // TABLES OR ANY OTHER
42  }
43  $rs = $this->Execute($sql);
44 
45  if ($rs === false || !method_exists($rs, 'GetArray')){
46  return $false;
47  }
48  $arr = $rs->GetArray();
49 
50  $arr2 = array();
51  foreach($arr as $key=>$value){
52  $arr2[] = trim($value['name']);
53  }
54  return $arr2;
55  }
56  return $false;
57  }
58 
59  function MetaDatabases()
60  {
61  $arr = array();
62  if ($this->metaDatabasesSQL!='') {
63  $rs = $this->Execute($this->metaDatabasesSQL);
64  if ($rs && !$rs->EOF){
65  while (!$rs->EOF){
66  $arr[] = $rs->Fields('name');
67  $rs->MoveNext();
68  }
69  return $arr;
70  }
71  }
72  return false;
73  }
74 
75  // fix a bug which prevent the metaColumns query to be executed for Sybase ASE
76  function MetaColumns($table,$upper=false)
77  {
78  $false = false;
79  if (!empty($this->metaColumnsSQL)) {
80 
81  $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
82  if ($rs === false) return $false;
83 
84  $retarr = array();
85  while (!$rs->EOF) {
86  $fld = new ADOFieldObject();
87  $fld->name = $rs->Fields('field_name');
88  $fld->type = $rs->Fields('type');
89  $fld->max_length = $rs->Fields('width');
90  $retarr[strtoupper($fld->name)] = $fld;
91  $rs->MoveNext();
92  }
93  $rs->Close();
94  return $retarr;
95  }
96  return $false;
97  }
98 
99  function getProcedureList($schema)
100  {
101  return false;
102  }
103 
104  function ErrorMsg()
105  {
106  if (!function_exists('sybase_connect')){
107  return 'Your PHP doesn\'t contain the Sybase connection module!';
108  }
109  return parent::ErrorMsg();
110  }
111 }
112 
114 var $databaseType = "sybase_ase";
115 function __construct($id,$mode=false)
116  {
117  parent::__construct($id,$mode);
118  }
119 
120 }
if(isset($_REQUEST['nrows'])) else $rs
Definition: server.php:94
MetaColumns($table, $upper=false)
MetaTables($ttype=false, $showSchema=false, $mask=false)
$sql
Definition: server.php:84