datadict-informix.inc.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. @version v5.20.17 31-Mar-2020
  4. @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
  5. @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
  6. Released under both BSD license and Lesser GPL library license.
  7. Whenever there is any discrepancy between the two licenses,
  8. the BSD license will take precedence.
  9. Set tabs to 4 for best viewing.
  10. */
  11. // security - hide paths
  12. if (!defined('ADODB_DIR')) die();
  13. class ADODB2_informix extends ADODB_DataDict {
  14. var $databaseType = 'informix';
  15. var $seqField = false;
  16. function ActualType($meta)
  17. {
  18. switch($meta) {
  19. case 'C': return 'VARCHAR';// 255
  20. case 'XL':
  21. case 'X': return 'TEXT';
  22. case 'C2': return 'NVARCHAR';
  23. case 'X2': return 'TEXT';
  24. case 'B': return 'BLOB';
  25. case 'D': return 'DATE';
  26. case 'TS':
  27. case 'T': return 'DATETIME YEAR TO SECOND';
  28. case 'L': return 'SMALLINT';
  29. case 'I': return 'INTEGER';
  30. case 'I1': return 'SMALLINT';
  31. case 'I2': return 'SMALLINT';
  32. case 'I4': return 'INTEGER';
  33. case 'I8': return 'DECIMAL(20)';
  34. case 'F': return 'FLOAT';
  35. case 'N': return 'DECIMAL';
  36. default:
  37. return $meta;
  38. }
  39. }
  40. function AlterColumnSQL($tabname, $flds, $tableflds='', $tableoptions='')
  41. {
  42. if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported");
  43. return array();
  44. }
  45. function DropColumnSQL($tabname, $flds, $tableflds='', $tableoptions='')
  46. {
  47. if ($this->debug) ADOConnection::outp("DropColumnSQL not supported");
  48. return array();
  49. }
  50. // return string must begin with space
  51. function _CreateSuffix($fname, &$ftype, $fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
  52. {
  53. if ($fautoinc) {
  54. $ftype = 'SERIAL';
  55. return '';
  56. }
  57. $suffix = '';
  58. if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
  59. if ($fnotnull) $suffix .= ' NOT NULL';
  60. if ($fconstraint) $suffix .= ' '.$fconstraint;
  61. return $suffix;
  62. }
  63. }