From 8df3db566a3a937b45ebf11adb90d265e6f5e2d4 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 17 Nov 2019 20:45:02 +0100 Subject: initial checking of customized version 1.0rc9 --- .../adodb-php/datadict/datadict-sapdb.inc.php | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 vendor/adodb/adodb-php/datadict/datadict-sapdb.inc.php (limited to 'vendor/adodb/adodb-php/datadict/datadict-sapdb.inc.php') diff --git a/vendor/adodb/adodb-php/datadict/datadict-sapdb.inc.php b/vendor/adodb/adodb-php/datadict/datadict-sapdb.inc.php new file mode 100644 index 0000000..794edf7 --- /dev/null +++ b/vendor/adodb/adodb-php/datadict/datadict-sapdb.inc.php @@ -0,0 +1,122 @@ +type; + $len = $fieldobj->max_length; + } + static $maxdb_type2adodb = array( + 'VARCHAR' => 'C', + 'CHARACTER' => 'C', + 'LONG' => 'X', // no way to differ between 'X' and 'B' :-( + 'DATE' => 'D', + 'TIMESTAMP' => 'T', + 'BOOLEAN' => 'L', + 'INTEGER' => 'I4', + 'SMALLINT' => 'I2', + 'FLOAT' => 'F', + 'FIXED' => 'N', + ); + $type = isset($maxdb_type2adodb[$t]) ? $maxdb_type2adodb[$t] : 'C'; + + // convert integer-types simulated with fixed back to integer + if ($t == 'FIXED' && !$fieldobj->scale && ($len == 20 || $len == 3)) { + $type = $len == 20 ? 'I8' : 'I1'; + } + if ($fieldobj->auto_increment) $type = 'R'; + + return $type; + } + + // return string must begin with space + function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned) + { + $suffix = ''; + if ($funsigned) $suffix .= ' UNSIGNED'; + if ($fnotnull) $suffix .= ' NOT NULL'; + if ($fautoinc) $suffix .= ' DEFAULT SERIAL'; + elseif (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fconstraint) $suffix .= ' '.$fconstraint; + return $suffix; + } + + function AddColumnSQL($tabname, $flds) + { + $tabname = $this->TableName ($tabname); + $sql = array(); + list($lines,$pkey) = $this->_GenFields($flds); + return array( 'ALTER TABLE ' . $tabname . ' ADD (' . implode(', ',$lines) . ')' ); + } + + function AlterColumnSQL($tabname, $flds, $tableflds='', $tableoptions='') + { + $tabname = $this->TableName ($tabname); + $sql = array(); + list($lines,$pkey) = $this->_GenFields($flds); + return array( 'ALTER TABLE ' . $tabname . ' MODIFY (' . implode(', ',$lines) . ')' ); + } + + function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') + { + $tabname = $this->TableName ($tabname); + if (!is_array($flds)) $flds = explode(',',$flds); + foreach($flds as $k => $v) { + $flds[$k] = $this->NameQuote($v); + } + return array( 'ALTER TABLE ' . $tabname . ' DROP (' . implode(', ',$flds) . ')' ); + } +} -- cgit v1.2.3-54-g00ecf