3 V5.16 26 Mar 2012 (c) 2000-2012 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.
10 Contributed by Interakt Online. Thx Cristian MARIN cristic#interaktonline.com
14 require_once ADODB_DIR
."/drivers/adodb-sybase.inc.php";
16 class ADODB_sybase_ase
extends ADODB_sybase
{
17 var $databaseType = "sybase_ase";
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";
23 function ADODB_sybase_ase()
27 // split the Views, Tables and procedures.
28 function MetaTables($ttype=false,$showSchema=false,$mask=false)
31 if ($this->metaTablesSQL
) {
32 // complicated state saving by the need for backward compat
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
39 $sql = $this->metaTablesSQL
;
41 $rs = $this->Execute($sql);
43 if ($rs === false ||
!method_exists($rs, 'GetArray')){
46 $arr = $rs->GetArray();
49 foreach($arr as $key=>$value){
50 $arr2[] = trim($value['name']);
57 function MetaDatabases()
60 if ($this->metaDatabasesSQL
!='') {
61 $rs = $this->Execute($this->metaDatabasesSQL
);
62 if ($rs && !$rs->EOF
){
64 $arr[] = $rs->Fields('name');
73 // fix a bug which prevent the metaColumns query to be executed for Sybase ASE
74 function MetaColumns($table,$upper=false)
77 if (!empty($this->metaColumnsSQL
)) {
79 $rs = $this->Execute(sprintf($this->metaColumnsSQL
,$table));
80 if ($rs === false) return $false;
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;
97 function getProcedureList($schema)
104 if (!function_exists('sybase_connect')){
105 return 'Your PHP doesn\'t contain the Sybase connection module!';
107 return parent
::ErrorMsg();
111 class adorecordset_sybase_ase
extends ADORecordset_sybase
{
112 var $databaseType = "sybase_ase";
113 function ADORecordset_sybase_ase($id,$mode=false)
115 $this->ADORecordSet_sybase($id,$mode);