eRx captured and displayed in AMC report,
[openemr.git] / library / adodb / drivers / adodb-sybase_ase.inc.php
blob384ace560471b08948ea2001e410d8eb73e855cc
1 <?php
2 /*
3 V5.14 8 Sept 2011 (c) 2000-2011 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.
8 Set tabs to 4.
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)
30 $false = 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')){
44 return $false;
46 $arr = $rs->GetArray();
48 $arr2 = array();
49 foreach($arr as $key=>$value){
50 $arr2[] = trim($value['name']);
52 return $arr2;
54 return $false;
57 function MetaDatabases()
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();
67 return $arr;
70 return false;
73 // fix a bug which prevent the metaColumns query to be executed for Sybase ASE
74 function MetaColumns($table,$upper=false)
76 $false = false;
77 if (!empty($this->metaColumnsSQL)) {
79 $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
80 if ($rs === false) return $false;
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();
91 $rs->Close();
92 return $retarr;
94 return $false;
97 function getProcedureList($schema)
99 return false;
102 function ErrorMsg()
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);