59 define(
'MDB2_TABLEINFO_ORDER', 1);
60 define(
'MDB2_TABLEINFO_ORDERTABLE', 2);
61 define(
'MDB2_TABLEINFO_FULL', 3);
94 'method not implemented', __FUNCTION__);
128 'method not implemented', __FUNCTION__);
163 'method not implemented', __FUNCTION__);
189 $start = $db->currId($sequence);
193 if ($db->supports(
'current_id')) {
196 $db->warnings[] =
'database does not support getting current
197 sequence value, the sequence value was incremented';
199 $definition = array();
201 $definition = array(
'start' => $start);
243 'method not implemented', __FUNCTION__);
376 if (!is_string($result)) {
378 'method not implemented', __FUNCTION__);
381 $db->loadModule(
'Manager', null,
true);
382 $fields = $db->manager->listTableFields($result);
389 $idxname_format = $db->getOption(
'idxname_format');
390 $db->setOption(
'idxname_format',
'%s');
392 $indexes = $db->manager->listTableIndexes($result);
394 $db->setOption(
'idxname_format', $idxname_format);
398 foreach ($indexes as $index) {
401 $db->setOption(
'idxname_format', $idxname_format);
404 if (count($definition[
'fields']) > 1) {
405 foreach ($definition[
'fields'] as $field => $sort) {
406 $flags[$field] =
'multiple_key';
411 $constraints = $db->manager->listTableConstraints($result);
416 foreach ($constraints as $constraint) {
419 $db->setOption(
'idxname_format', $idxname_format);
422 $flag = !empty($definition[
'primary'])
423 ?
'primary_key' : (!empty($definition[
'unique'])
424 ?
'unique_key' :
false);
426 foreach ($definition[
'fields'] as $field => $sort) {
427 if (empty($flags[$field]) || $flags[$field] !=
'primary_key') {
428 $flags[$field] = $flag;
435 $res[
'num_fields'] = count($fields);
438 foreach ($fields as $i => $field) {
441 $db->setOption(
'idxname_format', $idxname_format);
444 $res[$i] = $definition[0];
445 $res[$i][
'name'] = $field;
446 $res[$i][
'table'] = $result;
447 $res[$i][
'type'] = preg_replace(
'/^([a-z]+).*$/i',
'\\1', trim($definition[0][
'nativetype']));
449 $res[$i][
'flags'] = empty($flags[$field]) ?
'' : $flags[$field];
451 if (!empty(
$res[$i][
'notnull'])) {
452 $res[$i][
'flags'].=
' not_null';
454 if (!empty(
$res[$i][
'unsigned'])) {
455 $res[$i][
'flags'].=
' unsigned';
457 if (!empty(
$res[$i][
'auto_increment'])) {
458 $res[$i][
'flags'].=
' autoincrement';
460 if (!empty(
$res[$i][
'default'])) {
461 $res[$i][
'flags'].=
' default_'.rawurlencode(
$res[$i][
'default']);
465 $res[
'order'][
$res[$i][
'name']] = $i;
468 $res[
'ordertable'][
$res[$i][
'table']][
$res[$i][
'name']] = $i;
472 $db->setOption(
'idxname_format', $idxname_format);