Documentation TYPO3 par Ameos |
00001 <?php 00002 /* 00003 V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim@natsoft.com.my). All rights reserved. 00004 Released under both BSD license and Lesser GPL library license. 00005 Whenever there is any discrepancy between the two licenses, 00006 the BSD license will take precedence. 00007 00008 Set tabs to 4. 00009 00010 Contributed by Interakt Online. Thx Cristian MARIN cristic#interaktonline.com 00011 */ 00012 class ADODB_sybase_ase extends ADODB_sybase { 00013 var $databaseType = "sybase_ase"; 00014 00015 var $metaTablesSQL="SELECT sysobjects.name FROM sysobjects, sysusers WHERE sysobjects.type='U' AND sysobjects.uid = sysusers.uid"; 00016 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"; 00017 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"; 00018 00019 function ADODB_sybase_ase() 00020 { 00021 } 00022 00023 // split the Views, Tables and procedures. 00024 function &MetaTables($ttype=false,$showSchema=false,$mask=false) 00025 { 00026 $false = false; 00027 if ($this->metaTablesSQL) { 00028 // complicated state saving by the need for backward compat 00029 00030 if ($ttype == 'VIEWS'){ 00031 $sql = str_replace('U', 'V', $this->metaTablesSQL); 00032 }elseif (false === $ttype){ 00033 $sql = str_replace('U',"U' OR type='V", $this->metaTablesSQL); 00034 }else{ // TABLES OR ANY OTHER 00035 $sql = $this->metaTablesSQL; 00036 } 00037 $rs = $this->Execute($sql); 00038 00039 if ($rs === false || !method_exists($rs, 'GetArray')){ 00040 return $false; 00041 } 00042 $arr =& $rs->GetArray(); 00043 00044 $arr2 = array(); 00045 foreach($arr as $key=>$value){ 00046 $arr2[] = trim($value['name']); 00047 } 00048 return $arr2; 00049 } 00050 return $false; 00051 } 00052 00053 function MetaDatabases() 00054 { 00055 $arr = array(); 00056 if ($this->metaDatabasesSQL!='') { 00057 $rs = $this->Execute($this->metaDatabasesSQL); 00058 if ($rs && !$rs->EOF){ 00059 while (!$rs->EOF){ 00060 $arr[] = $rs->Fields('name'); 00061 $rs->MoveNext(); 00062 } 00063 return $arr; 00064 } 00065 } 00066 return false; 00067 } 00068 00069 // fix a bug which prevent the metaColumns query to be executed for Sybase ASE 00070 function &MetaColumns($table,$upper=false) 00071 { 00072 $false = false; 00073 if (!empty($this->metaColumnsSQL)) { 00074 00075 $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table)); 00076 if ($rs === false) return $false; 00077 00078 $retarr = array(); 00079 while (!$rs->EOF) { 00080 $fld =& new ADOFieldObject(); 00081 $fld->name = $rs->Fields('field_name'); 00082 $fld->type = $rs->Fields('type'); 00083 $fld->max_length = $rs->Fields('width'); 00084 $retarr[strtoupper($fld->name)] = $fld; 00085 $rs->MoveNext(); 00086 } 00087 $rs->Close(); 00088 return $retarr; 00089 } 00090 return $false; 00091 } 00092 00093 function getProcedureList($schema) 00094 { 00095 return false; 00096 } 00097 00098 function ErrorMsg() 00099 { 00100 if (!function_exists('sybase_connect')){ 00101 return 'Your PHP doesn\'t contain the Sybase connection module!'; 00102 } 00103 return parent::ErrorMsg(); 00104 } 00105 } 00106 00107 class adorecordset_sybase_ase extends ADORecordset_sybase { 00108 var $databaseType = "sybase_ase"; 00109 function ADORecordset_sybase_ase($id,$mode=false) 00110 { 00111 $this->ADORecordSet_sybase($id,$mode); 00112 } 00113 00114 } 00115 ?>