Documentation TYPO3 par Ameos

adodb-sybase_ase.inc.php

00001 <?php
00002 /*
00003   V4.93 10 Oct 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 
00013 
00014 require_once ADODB_DIR."/drivers/adodb-sybase.inc.php";
00015 
00016 class ADODB_sybase_ase extends ADODB_sybase {
00017         var $databaseType = "sybase_ase";
00018         
00019          var $metaTablesSQL="SELECT sysobjects.name FROM sysobjects, sysusers WHERE sysobjects.type='U' AND sysobjects.uid = sysusers.uid";
00020          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";
00021          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";
00022 
00023         function ADODB_sybase_ase()
00024         {
00025         }
00026         
00027         // split the Views, Tables and procedures.
00028         function &MetaTables($ttype=false,$showSchema=false,$mask=false)
00029         {
00030                 $false = false;
00031                 if ($this->metaTablesSQL) {
00032                         // complicated state saving by the need for backward compat
00033                         
00034                         if ($ttype == 'VIEWS'){
00035                                                 $sql = str_replace('U', 'V', $this->metaTablesSQL);
00036                         }elseif (false === $ttype){
00037                                                 $sql = str_replace('U',"U' OR type='V", $this->metaTablesSQL);
00038                         }else{ // TABLES OR ANY OTHER 
00039                                                 $sql = $this->metaTablesSQL;
00040                         }
00041                         $rs = $this->Execute($sql);
00042                         
00043                         if ($rs === false || !method_exists($rs, 'GetArray')){
00044                                         return $false;
00045                         }
00046                         $arr =& $rs->GetArray();
00047 
00048                         $arr2 = array();
00049                         foreach($arr as $key=>$value){
00050                                         $arr2[] = trim($value['name']);
00051                         }
00052                         return $arr2;
00053                 }
00054                 return $false;
00055         }
00056 
00057         function MetaDatabases()
00058         {
00059                         $arr = array();
00060                         if ($this->metaDatabasesSQL!='') {
00061                                 $rs = $this->Execute($this->metaDatabasesSQL);
00062                                 if ($rs && !$rs->EOF){
00063                                         while (!$rs->EOF){
00064                                                 $arr[] = $rs->Fields('name');
00065                                                 $rs->MoveNext();
00066                                         }
00067                                         return $arr;
00068                                 }
00069                         }
00070                         return false;
00071         }
00072 
00073         // fix a bug which prevent the metaColumns query to be executed for Sybase ASE
00074         function &MetaColumns($table,$upper=false) 
00075         {
00076                 $false = false;
00077                 if (!empty($this->metaColumnsSQL)) {
00078                 
00079                         $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
00080                         if ($rs === false) return $false;
00081 
00082                         $retarr = array();
00083                         while (!$rs->EOF) {
00084                                 $fld =& new ADOFieldObject();
00085                                 $fld->name = $rs->Fields('field_name');
00086                                 $fld->type = $rs->Fields('type');
00087                                 $fld->max_length = $rs->Fields('width');
00088                                 $retarr[strtoupper($fld->name)] = $fld;
00089                                 $rs->MoveNext();
00090                         }
00091                         $rs->Close();
00092                         return $retarr; 
00093                 }
00094                 return $false;
00095         }
00096         
00097         function getProcedureList($schema)
00098         {
00099                         return false;
00100         }
00101 
00102         function ErrorMsg()
00103         {
00104                 if (!function_exists('sybase_connect')){
00105                                 return 'Your PHP doesn\'t contain the Sybase connection module!';
00106                 }
00107                 return parent::ErrorMsg();      
00108         }
00109 }
00110 
00111 class adorecordset_sybase_ase extends ADORecordset_sybase {
00112 var $databaseType = "sybase_ase";
00113 function ADORecordset_sybase_ase($id,$mode=false)
00114         {
00115                 $this->ADORecordSet_sybase($id,$mode);
00116         }
00117         
00118 }
00119 ?>


Généré par Les experts TYPO3 avec  doxygen 1.4.6