home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / datadict-db2.inc.php < prev    next >
Encoding:
PHP Script  |  2004-03-20  |  1.8 KB  |  74 lines

  1. <?php
  2.  
  3. /**
  4.   V4.21 20 Mar 2004  (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
  5.   Released under both BSD license and Lesser GPL library license. 
  6.   Whenever there is any discrepancy between the two licenses, 
  7.   the BSD license will take precedence.
  8.     
  9.   Set tabs to 4 for best viewing.
  10.  
  11. */
  12.  
  13. class ADODB2_db2 extends ADODB_DataDict {
  14.     
  15.     var $databaseType = 'db2';
  16.     var $seqField = false;
  17.      
  18.      function ActualType($meta)
  19.     {
  20.         switch($meta) {
  21.         case 'C': return 'VARCHAR';
  22.         case 'XL': return 'CLOB';
  23.         case 'X': return 'VARCHAR(3600)'; 
  24.         
  25.         case 'C2': return 'VARCHAR'; // up to 32K
  26.         case 'X2': return 'VARCHAR(3600)'; // up to 32000, but default page size too small
  27.         
  28.         case 'B': return 'BLOB';
  29.             
  30.         case 'D': return 'DATE';
  31.         case 'T': return 'TIMESTAMP';
  32.         
  33.         case 'L': return 'SMALLINT';
  34.         case 'I': return 'INTEGER';
  35.         case 'I1': return 'SMALLINT';
  36.         case 'I2': return 'SMALLINT';
  37.         case 'I4': return 'INTEGER';
  38.         case 'I8': return 'BIGINT';
  39.         
  40.         case 'F': return 'DOUBLE';
  41.         case 'N': return 'DECIMAL';
  42.         default:
  43.             return $meta;
  44.         }
  45.     }
  46.     
  47.     // return string must begin with space
  48.     function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint)
  49.     {    
  50.         $suffix = '';
  51.         if ($fautoinc) return ' GENERATED ALWAYS AS IDENTITY'; # as identity start with 
  52.         if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
  53.         if ($fnotnull) $suffix .= ' NOT NULL';
  54.         if ($fconstraint) $suffix .= ' '.$fconstraint;
  55.         return $suffix;
  56.     }
  57.  
  58.     function AlterColumnSQL($tabname, $flds)
  59.     {
  60.         if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported");
  61.         return array();
  62.     }
  63.     
  64.     
  65.     function DropColumnSQL($tabname, $flds)
  66.     {
  67.         if ($this->debug) ADOConnection::outp("DropColumnSQL not supported");
  68.         return array();
  69.     }
  70.     
  71. }
  72.  
  73.  
  74. ?>