function __construct($db, $otherSchema) { parent::__construct($db); $this->OtherSchema = $otherSchema; $this->CorrectSchema = false; $this->IsLintChecked = false; }
function generateTableInsertSQLList($tableName, $tableDef, $dataEntries, $params, $withClosure = true) { $sqlList = eZDBSchemaInterface::generateTableInsertSQLList($tableName, $tableDef, $dataEntries, $params, $withClosure); foreach ($tableDef['fields'] as $fieldName => $fieldDef) { if ($fieldDef['type'] == 'auto_increment') { $sql = "SELECT setval('" . $tableName . "_s',max(" . $fieldName . ")+1) FROM " . $tableName; if ($withClosure) { $sql .= ";"; } $sqlList[] = $sql; } } return $sqlList; }
function transformData(&$data, $toLocal) { // Check if it is already in correct format if (isset($data['_info']['format'])) { if ($data['_info']['format'] == ($toLocal ? 'local' : 'generic')) { return true; } } // Set the new format it will get $data['_info']['format'] = $toLocal ? 'local' : 'generic'; // load the schema transformation rules $schemaType = $this->schemaType(); $schemaTransformationRules = eZDBSchemaInterface::loadSchemaTransformationRules($schemaType); if ($schemaTransformationRules === false) { return false; } // transform column names foreach ($schemaTransformationRules['column-name'] as $key => $val) { list($tableName, $genericColName) = explode('.', $key); $localColName = $val; if ($toLocal) { $searchColName = $genericColName; $replacementColName = $localColName; } else { $searchColName = $localColName; $replacementColName = $genericColName; } if (!isset($data[$tableName])) { continue; } // transform column names in tables $fieldsData = $data[$tableName]['fields']; foreach ($fieldsData as $key => $fieldName) { if ($searchColName == $fieldName) { $data[$tableName]['fields'][$key] = $replacementColName; eZDebugSetting::writeDebug('lib-dbschema-data-transformation', '', "transformed table column name {$tableName}.{$searchColName} to {$replacementColName}"); } } } return true; }
function __construct($params) { parent::__construct($params); }