91 if (!is_array($fields) || empty($fields)) {
93 'missing any fields', __FUNCTION__);
95 foreach ($fields as $field_name => $field) {
96 $query = $db->getDeclaration($field[
'type'], $field_name, $field);
102 return implode(
', ', $query_fields);
123 $seq_pattern =
'/^'.preg_replace(
'/%s/',
'([a-z0-9_]+)', $db->options[
'seqname_format']).
'$/i';
124 $seq_name = preg_replace($seq_pattern,
'\\1', $sqn);
125 if ($seq_name && !strcasecmp($sqn, $db->getSequenceName($seq_name))) {
151 $idx_pattern =
'/^'.preg_replace(
'/%s/',
'([a-z0-9_]+)', $db->options[
'idxname_format']).
'$/i';
152 $idx_name = preg_replace($idx_pattern,
'\\1', $idx);
153 if ($idx_name && !strcasecmp($idx, $db->getIndexName($idx_name))) {
177 'method not implemented', __FUNCTION__);
198 'method not implemented', __FUNCTION__);
221 'no valid table name specified', __FUNCTION__);
223 if (empty($fields)) {
225 'no fields specified for table "'.$name.
'"', __FUNCTION__);
229 return $query_fields;
232 $query_fields.=
', PRIMARY KEY ('.implode(
', ', array_keys(
$options[
'primary'])).
')';
235 $name = $db->quoteIdentifier($name,
true);
237 if (!empty(
$options[
'temporary'])) {
240 $result .=
" TABLE $name ($query_fields)";
331 $name = $db->quoteIdentifier($name,
true);
332 return $db->exec(
"DROP TABLE $name");
436 'method not implemented', __FUNCTION__);
456 'method not implementedd', __FUNCTION__);
476 'method not implemented', __FUNCTION__);
499 'method not implemented', __FUNCTION__);
520 'method not implemented', __FUNCTION__);
541 'method not implemented', __FUNCTION__);
561 'method not implemented', __FUNCTION__);
584 'method not implemented', __FUNCTION__);
605 'method not implemented', __FUNCTION__);
650 $table = $db->quoteIdentifier($table,
true);
651 $name = $db->quoteIdentifier($db->getIndexName($name),
true);
652 $query =
"CREATE INDEX $name ON $table";
654 foreach (array_keys($definition[
'fields']) as $field) {
655 $fields[] = $db->quoteIdentifier($field,
true);
657 $query .=
' ('. implode(
', ', $fields) .
')';
679 $name = $db->quoteIdentifier($db->getIndexName($name),
true);
680 return $db->exec(
"DROP INDEX $name");
701 'method not implemented', __FUNCTION__);
735 $table = $db->quoteIdentifier($table,
true);
736 $name = $db->quoteIdentifier($db->getIndexName($name),
true);
737 $query =
"ALTER TABLE $table ADD CONSTRAINT $name";
738 if (!empty($definition[
'primary'])) {
740 } elseif (!empty($definition[
'unique'])) {
744 foreach (array_keys($definition[
'fields']) as $field) {
745 $fields[] = $db->quoteIdentifier($field,
true);
747 $query .=
' ('. implode(
', ', $fields) .
')';
770 $table = $db->quoteIdentifier($table,
true);
771 $name = $db->quoteIdentifier($db->getIndexName($name),
true);
772 return $db->exec(
"ALTER TABLE $table DROP CONSTRAINT $name");
793 'method not implemented', __FUNCTION__);
815 'method not implemented', __FUNCTION__);
836 'method not implemented', __FUNCTION__);
859 'method not implemented', __FUNCTION__);