From d5c32df4e300e278d8369bd3b4d64d0e299e034b Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 23 Jul 2004 00:41:24 +0000 Subject: [PATCH] first version of data-dictionary for sapdb --- phpgwapi/inc/adodb/adodb.inc.php | 2 + .../inc/adodb/datadict/datadict-sapdb.inc.php | 99 +++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 phpgwapi/inc/adodb/datadict/datadict-sapdb.inc.php diff --git a/phpgwapi/inc/adodb/adodb.inc.php b/phpgwapi/inc/adodb/adodb.inc.php index 8f76063074..8466ab0124 100644 --- a/phpgwapi/inc/adodb/adodb.inc.php +++ b/phpgwapi/inc/adodb/adodb.inc.php @@ -3511,6 +3511,8 @@ break; case 'db2': break; + case 'sapdb': + break; default: $drivername = 'generic'; break; diff --git a/phpgwapi/inc/adodb/datadict/datadict-sapdb.inc.php b/phpgwapi/inc/adodb/datadict/datadict-sapdb.inc.php new file mode 100644 index 0000000000..6631bc1352 --- /dev/null +++ b/phpgwapi/inc/adodb/datadict/datadict-sapdb.inc.php @@ -0,0 +1,99 @@ +".print_r($sql,true)."\n"; + + return $sql; + } + + // 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) + { + $tabname = $this->TableName ($tabname); + $sql = array(); + list($lines,$pkey) = $this->_GenFields($flds); + return array( 'ALTER TABLE ' . $tabname . ' MODIFY (' . implode(',',$lines) . ')' ); + } + + function DropColumnSQL($tabname, $flds) + { + $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) . ')' ); + } +} + +?> \ No newline at end of file