25 #require_once 'Zend/Db/Adapter/Pdo/Ibm.php'; 28 #require_once 'Zend/Db/Statement/Pdo/Ibm.php'; 65 $sql =
"SELECT tabname " 68 return $this->_adapter->fetchCol($sql);
82 $sql=
"SELECT DISTINCT t.owner, t.tabname, c.colname, c.colno, c.coltype, 83 d.default, c.collength, t.tabid 85 JOIN systables t ON c.tabid = t.tabid 86 LEFT JOIN sysdefaults d ON c.tabid = d.tabid AND c.colno = d.colno 88 . $this->_adapter->quoteInto(
'UPPER(t.tabname) = UPPER(?)',
$tableName);
90 $sql .= $this->_adapter->quoteInto(
' AND UPPER(t.owner) = UPPER(?)', $schemaName);
92 $sql .=
" ORDER BY c.colno";
95 $stmt = $this->_adapter->query($sql);
116 $primaryPosition =
null;
122 if (array_key_exists(
$row[$colno], $primaryCols)) {
124 $primaryPosition = $primaryCols[
$row[$colno]];
128 if (
$row[$typename] == 6 + 256 ||
129 $row[$typename] == 18 + 256) {
133 $desc[$this->_adapter->foldCase(
$row[$colname])] = array (
134 'SCHEMA_NAME' => $this->_adapter->foldCase(
$row[$tabschema]),
135 'TABLE_NAME' => $this->_adapter->foldCase(
$row[$tabname]),
136 'COLUMN_NAME' => $this->_adapter->foldCase(
$row[$colname]),
137 'COLUMN_POSITION' =>
$row[$colno],
139 'DEFAULT' =>
$row[$default],
140 'NULLABLE' => (bool) !(
$row[$typename] - 256 >= 0),
141 'LENGTH' =>
$row[$length],
142 'SCALE' => (
$row[$typename] == 5 ?
$row[$length]&255 : 0),
143 'PRECISION' => (
$row[$typename] == 5 ? (
int)(
$row[$length]/256) : 0),
145 'PRIMARY' => $primary,
146 'PRIMARY_POSITION' => $primaryPosition,
147 'IDENTITY' => $identity
187 40 =>
"Variable-length opaque type",
191 if ($typeNo - 256 >= 0) {
192 $typeNo = $typeNo - 256;
195 return $typemap[$typeNo];
207 $sql =
"SELECT i.part1, i.part2, i.part3, i.part4, i.part5, i.part6, 208 i.part7, i.part8, i.part9, i.part10, i.part11, i.part12, 209 i.part13, i.part14, i.part15, i.part16 211 JOIN sysconstraints c ON c.idxname = i.idxname 212 WHERE i.tabid = " . $tabid .
" AND c.constrtype = 'P'";
214 $stmt = $this->_adapter->query($sql);
229 foreach (
$row as $key => $colno) {
234 $cols[$colno] = $position;
253 #require_once 'Zend/Db/Adapter/Exception.php'; 256 $limit_sql = str_ireplace(
"SELECT",
"SELECT * FROM (SELECT", $sql);
257 $limit_sql .=
") WHERE 0 = 1";
259 $offset = intval($offset);
262 #require_once 'Zend/Db/Adapter/Exception.php'; 266 $limit_sql = str_ireplace(
"SELECT",
"SELECT FIRST $count", $sql);
268 $limit_sql = str_ireplace(
"SELECT",
"SELECT SKIP $offset LIMIT $count", $sql);
282 $sql =
'SELECT '.$this->_adapter->quoteIdentifier($sequenceName).
'.CURRVAL FROM ' 283 .
'systables WHERE tabid = 1';
284 $value = $this->_adapter->fetchOne($sql);
296 $sql =
'SELECT '.$this->_adapter->quoteIdentifier($sequenceName).
'.NEXTVAL FROM ' 297 .
'systables WHERE tabid = 1';
298 $value = $this->_adapter->fetchOne($sql);
limit($sql, $count, $offset=0)
nextSequenceId($sequenceName)
describeTable($tableName, $schemaName=null)
lastSequenceId($sequenceName)