From: <ibr...@us...> - 2013-08-27 19:14:15
|
Revision: 4800 http://sourceforge.net/p/tora/code/4800 Author: ibre5041 Date: 2013-08-27 19:14:03 +0000 (Tue, 27 Aug 2013) Log Message: ----------- toExtract is back Modified Paths: -------------- trunk/tora/src/CMakeLists.txt trunk/tora/src/connection/tooracleextract.cpp trunk/tora/src/connection/tooracleextract.h trunk/tora/src/core/toextract.cpp trunk/tora/src/core/toextract.h trunk/tora/src/core/toresultcode.cpp trunk/tora/src/tools/toinvalid.cpp trunk/tora/src/tools/totemporary.cpp Removed Paths: ------------- trunk/tora/src/core/tooracleextract.cpp trunk/tora/src/core/tooracleextract.h Modified: trunk/tora/src/CMakeLists.txt =================================================================== --- trunk/tora/src/CMakeLists.txt 2013-08-27 18:01:01 UTC (rev 4799) +++ trunk/tora/src/CMakeLists.txt 2013-08-27 19:14:03 UTC (rev 4800) @@ -464,7 +464,7 @@ core/toresultcode.cpp core/toresultfield.cpp #obsolere core/tosqlparse.cpp - #obsolete core/toextract.cpp + core/toextract.cpp core/toresultgrants.cpp core/toresultdepend.cpp core/toresultextent.cpp @@ -509,6 +509,7 @@ connection/tooraclefind.cpp connection/tooraclesql.cpp + connection/tooracleextract.cpp connection/toteradatafind.cpp connection/toqsqlfind.cpp connection/toqsqlconnection.cpp @@ -574,7 +575,6 @@ tools/towaitevents.cpp tools/tocurrent.cpp tools/toinvalid.cpp - #obsolete core/tooracleextract.cpp tools/tobackup.cpp tools/tobackuptool.cpp tools/tounittest.cpp Modified: trunk/tora/src/connection/tooracleextract.cpp =================================================================== --- trunk/tora/src/connection/tooracleextract.cpp 2013-08-27 18:01:01 UTC (rev 4799) +++ trunk/tora/src/connection/tooracleextract.cpp 2013-08-27 19:14:03 UTC (rev 4800) @@ -41,7 +41,7 @@ #include "connection/tooracleextract.h" #include "core/toconnectiontraits.h" #include "core/utils.h" -#include "core/toconf.h" +#include "core/toconfiguration.h" #include "core/toquery.h" #include "core/toextract.h" #include "core/tosql.h" @@ -1910,10 +1910,10 @@ toQList storage; QString partition = Utils::toShift(segment); QString highValue = Utils::toShift(segment); - toPush(storage, toQValue(" ")); - toPush(storage, toQValue(organization)); + Utils::toPush(storage, toQValue(" ")); + Utils::toPush(storage, toQValue(organization)); for (int i = 0; i < 16; i++) - toPush(storage, Utils::toShift(segment)); + Utils::toPush(storage, Utils::toShift(segment)); ret += comma; ret += QString("PARTITION %1 VALUES LESS THAN\n" @@ -2285,10 +2285,10 @@ QString highValue = Utils::toShift(result); toQList storage; - toPush(storage, toQValue(" ")); - toPush(storage, toQValue("INDEX")); + Utils::toPush(storage, toQValue(" ")); + Utils::toPush(storage, toQValue("INDEX")); for (int i = 0; i < 16; i++) - toPush(storage, Utils::toShift(result)); + Utils::toPush(storage, Utils::toShift(result)); ret += comma; ret += "PARTITION "; @@ -2301,6 +2301,7 @@ if (subPartitionType == "HASH") { + toConnectionSubLoan conn(ext.connection()); toQuery inf(conn, SQLIndexSubPartitionName, toQueryParams() << name << partition << owner); ret += " (\n" @@ -2911,7 +2912,8 @@ { static QRegExp quote("\""); static QRegExp func("^sys_nc[0-9]g"); - toQuery inf(CONNECTION, SQLIndexColumns, toQueryParams() << name << owner); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, SQLIndexColumns, toQueryParams() << name << owner); int num = 1; while (!inf.eof()) { @@ -2920,7 +2922,8 @@ QString row; if (func.indexIn(col) >= 0) { - toQuery def(CONNECTION, SQLIndexFunction, toQueryParams() << col << name << owner); + toConnectionSubLoan conn2(ext.connection()); + toQuery def(conn2, SQLIndexFunction, toQueryParams() << col << name << owner); QString function(def.readValue()); inf.readValue(); // we read function index from def, but inf has to be shifted too function.replace(quote, ""); @@ -2958,7 +2961,8 @@ QString updatable = Utils::toShift(result); QString query = Utils::toShift(result); - toQuery inf(CONNECTION, SQLIndexName, toQueryParams() << table << owner); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, SQLIndexName, toQueryParams() << table << owner); QString index(inf.readValue()); std::list<QString> ctx; @@ -3078,7 +3082,8 @@ ctx.insert(ctx.end(), "WITH PRIMARY KEY"); addDescription(lst, ctx); - toQuery inf(CONNECTION, SQLSnapshotColumns, toQueryParams() << name << owner); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, SQLSnapshotColumns, toQueryParams() << name << owner); bool first = true; if (!inf.eof()) { @@ -3148,10 +3153,10 @@ QString highValue = Utils::toShift(result); toQList storage; - toPush(storage, toQValue(" ")); - toPush(storage, toQValue("INDEX")); + Utils::toPush(storage, toQValue(" ")); + Utils::toPush(storage, toQValue("INDEX")); for (int i = 0; i < 16; i++) - toPush(storage, Utils::toShift(result)); + Utils::toPush(storage, Utils::toShift(result)); std::list<QString> cctx = ctx; cctx.insert(cctx.end(), QUOTE(partition)); @@ -3163,7 +3168,8 @@ if (subPartitionType == "HASH") { - toQuery inf(CONNECTION, SQLIndexSubPartitionName, toQueryParams() << name << partition << owner); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, SQLIndexSubPartitionName, toQueryParams() << name << partition << owner); while (!inf.eof()) { QString sub(inf.readValue()); @@ -3186,13 +3192,14 @@ describeTableText(ext, lst, ctx, result, schema, owner, name); if (ext.getPartition()) { - toQuery inf(CONNECTION, SQLPartitionIndexNames, toQueryParams() << name << owner); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, SQLPartitionIndexNames, toQueryParams() << name << owner); if (!inf.eof()) throw qApp->translate("toOracleExtract", "Couldn't find index partitions for %1.%2").arg(owner).arg(name); QString index(inf.readValue()); std::list<QString> cctx = ctx; - toPush(cctx, QString("PARTITION COLUMNS")); - toPush(cctx, partitionKeyColumns(ext, owner, name, "TABLE")); + Utils::toPush(cctx, QString("PARTITION COLUMNS")); + Utils::toPush(cctx, partitionKeyColumns(ext, owner, name, "TABLE")); addDescription(lst, cctx); describePartitions(ext, lst, cctx, owner, index, "NONE", "IOT"); } @@ -3302,10 +3309,10 @@ toQList storage; QString partition = Utils::toShift(segment); QString highValue = Utils::toShift(segment); - toPush(storage, toQValue(" ")); - toPush(storage, toQValue(organization)); + Utils::toPush(storage, toQValue(" ")); + Utils::toPush(storage, toQValue(organization)); for (int i = 0; i < 16; i++) - toPush(storage, Utils::toShift(segment)); + Utils::toPush(storage, Utils::toShift(segment)); std::list<QString> cctx = ctx; cctx.insert(cctx.end(), prtstr); @@ -3481,7 +3488,8 @@ if (ext.getConstraints()) { - toQuery inf(CONNECTION, SQLListConstraint, toQueryParams() << owner << name); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, SQLListConstraint, toQueryParams() << owner << name); if (inf.eof()) throw qApp->translate("toOracleExtract", "Constraint %1.%2 doesn't exist").arg(owner).arg(name); QString table(inf.readValue()); @@ -3521,7 +3529,8 @@ if (tchr == "R") { - toQuery query(CONNECTION, SQLConstraintTable, toQueryParams() << rOwner << rName); + toConnectionSubLoan conn(ext.connection()); + toQuery query(conn, SQLConstraintTable, toQueryParams() << rOwner << rName); ret += " REFERENCES "; ret += ext.intSchema(rOwner, false); ret += QUOTE(query.readValue()); @@ -3565,7 +3574,8 @@ const QString &owner, const QString &name) const { - toQuery inf(CONNECTION, SQLDBLink, toQueryParams() << owner << name); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, SQLDBLink, toQueryParams() << owner << name); if (inf.eof()) throw qApp->translate("toOracleExtract", "DBLink %1.%2 doesn't exist").arg(owner).arg(name); QString user(inf.readValue()); @@ -3600,7 +3610,8 @@ const QString &owner, const QString &name) const { - toQuery inf(CONNECTION, SQLDirectory, toQueryParams() << name); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, SQLDirectory, toQueryParams() << name); if (inf.eof()) throw qApp->translate("toOracleExtract", "Directory %1 doesn't exist").arg(name); QString dname(inf.readValue()); @@ -3699,7 +3710,8 @@ QString segment = str.first(); QString partition = str.last(); - toQuery inf(CONNECTION, segments(ext, SQLPartitionSegmentType), toQueryParams() << segment << partition << owner); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, segments(ext, SQLPartitionSegmentType), toQueryParams() << segment << partition << owner); if (inf.eof()) throw qApp->translate("toOracleExtract", "Exchange index %1.%2 doesn't exist").arg(owner).arg(name); QString type = inf.readValue(); @@ -3714,7 +3726,7 @@ QString unique = Utils::toShift(result); QString bitmap = Utils::toShift(result); - toUnShift(result, toQValue("")); + Utils::toUnShift(result, toQValue("")); sql = QString("CREATE%1%2 INDEX %3%4 ON %3%5\n"). arg(unique).arg(bitmap).arg(schema).arg(segment).arg(QUOTE(table)); @@ -3803,7 +3815,8 @@ QString segment = str.first(); QString partition = str.last(); - toQuery inf(CONNECTION, segments(ext, SQLPartitionSegmentType), toQueryParams() << segment << partition << owner); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, segments(ext, SQLPartitionSegmentType), toQueryParams() << segment << partition << owner); if (inf.eof()) throw qApp->translate("toOracleExtract", "Exchange table %1.%2 doesn't exist").arg(owner).arg(name); QString type = inf.readValue(); @@ -4028,7 +4041,8 @@ if (!ext.getIndexes()) return ""; - toQList res = toQuery::readQuery(CONNECTION, SQLIndexInfo, toQueryParams() << name << owner); + toConnectionSubLoan conn(ext.connection()); + toQList res = toQuery::readQuery(ext.connection(), SQLIndexInfo, toQueryParams() << name << owner); if (res.size() != 10) throw qApp->translate("toOracleExtract", "Couldn't find index %1.%2").arg(owner).arg(name); @@ -4043,7 +4057,7 @@ QString domName = Utils::toShift(res); QString domParam = Utils::toShift(res); - toQList storage = toQuery::readQuery(CONNECTION, segments(ext, SQLIndexSegment), name, owner); + toQList storage = toQuery::readQuery(ext.connection(), segments(ext, SQLIndexSegment), toQueryParams() << name << owner); QString degree = Utils::toShift(storage); QString instances = Utils::toShift(storage); QString compressed = Utils::toShift(storage); @@ -4090,7 +4104,7 @@ if (partitioned == "YES") return createPartitionedIndex(ext, schema, owner, name, ret); - toUnShift(storage, toQValue("")); + Utils::toUnShift(storage, toQValue("")); ret += segmentAttributes(ext, storage); if (!compressed.isEmpty() && compressed != "0" && ext.getStorage()) { @@ -4269,7 +4283,7 @@ const QString &, const QString &name) const { - toQList result = toQuery::readQuery(CONNECTION, SQLRollbackSegment, toQueryParams() << name); + toQList result = toQuery::readQuery(ext.connection(), SQLRollbackSegment, toQueryParams() << name); QString isPublic = Utils::toShift(result); QString tablespaceName = Utils::toShift(result); QString initialExtent = Utils::toShift(result); @@ -4627,7 +4641,8 @@ const QString &owner, const QString &name) const { - toQuery inf(CONNECTION, SQLTableType, toQueryParams() << name << owner); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, SQLTableType, toQueryParams() << name << owner); if (inf.eof()) throw qApp->translate("toOracleExtract", "Couldn't find table %1.%2").arg(owner).arg(name); @@ -4754,7 +4769,8 @@ { QString ret = createTable(ext, schema, owner, name); - toQuery inf(CONNECTION, SQLTableType, toQueryParams() << name << owner); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, SQLTableType, toQueryParams() << name << owner); if (inf.eof()) throw qApp->translate("toOracleExtract", "Couldn't find table %1.%2").arg(owner).arg(name); @@ -4817,7 +4833,8 @@ if (PROMPT) stream << QString("PROMPT CONTENTS OF %1%2\n\n").arg(schema).arg(QUOTE(name)); - toQuery query(CONNECTION, QString("SELECT * FROM %1.%2").arg(QUOTE(owner)).arg(QUOTE(name)), toQueryParams()); + toConnectionSubLoan conn(ext.connection()); + toQuery query(conn, QString("SELECT * FROM %1.%2").arg(QUOTE(owner)).arg(QUOTE(name)), toQueryParams()); toQColumnDescriptionList desc = query.describe(); int cols = query.columns(); @@ -4901,7 +4918,7 @@ const QString &name) const { QString ret; - toQList constraints = toQuery::readQuery(CONNECTION, SQLTableReferences, toQueryParams() << name << owner); + toQList constraints = toQuery::readQuery(ext.connection(), SQLTableReferences, toQueryParams() << name << owner); while (!constraints.empty()) ret += createConstraint(ext, schema, owner, Utils::toShift(constraints)); return ret; @@ -5090,10 +5107,9 @@ } ret += sql; - toQList files = toQuery::readQuery(CONNECTION, + toQList files = toQuery::readQuery(ext.connection(), SQLDatafileInfo, - QString::number(ext.getBlockSize()), - name); + toQueryParams() << QString::number(ext.getBlockSize()) << name); if (extentManagement == "LOCAL" && contents == "TEMPORARY") ret += "TEMPFILE\n"; else @@ -5209,7 +5225,7 @@ { if (!ext.getCode()) return ""; - toQList result = toQuery::readQuery(CONNECTION, SQLTriggerInfo, toQueryParams() << name << owner); + toQList result = toQuery::readQuery(ext.connection(), SQLTriggerInfo, toQueryParams() << name << owner); if (result.size() != 10) throw qApp->translate("toOracleExtract", "Couldn't find trigger %1.%2").arg(owner).arg(name); QString triggerType = Utils::toShift(result); @@ -5374,7 +5390,7 @@ if (ext.getStorage()) { - toQList quota = toQuery::readQuery(CONNECTION, SQLUserQuotas, toQueryParams() << name); + toQList quota = toQuery::readQuery(ext.connection(), SQLUserQuotas, toQueryParams() << name); while (!quota.empty()) { QString siz = Utils::toShift(quota); @@ -5413,9 +5429,9 @@ { if (!ext.getCode()) return ""; - toQList source = toQuery::readQuery(CONNECTION, + toQList source = toQuery::readQuery(ext.connection(), SQLViewSource, - name, owner); + toQueryParams() << name << owner); if (source.empty()) throw qApp->translate("toOracleExtract", "Couldn't find view %1.%2").arg(QUOTE(owner)).arg(QUOTE(name)); @@ -5459,7 +5475,8 @@ { if (ext.getConstraints()) { - toQuery inf(CONNECTION, SQLListConstraint, toQueryParams() << owner << name); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, SQLListConstraint, toQueryParams() << owner << name); if (inf.eof()) throw qApp->translate("toOracleExtract", "Constraint %1.%2 doesn't exist").arg(owner).arg(name); QString table(inf.readValue()); @@ -5499,7 +5516,8 @@ if (tchr == "R") { - toQuery query(CONNECTION, SQLConstraintTable, toQueryParams() << rOwner << rName); + toConnectionSubLoan conn(ext.connection()); + toQuery query(conn, SQLConstraintTable, toQueryParams() << rOwner << rName); ret += " REFERENCES "; ret += ext.intSchema(rOwner, false); ret += QUOTE(query.readValue()); @@ -5534,7 +5552,8 @@ const QString &owner, const QString &name) const { - toQuery inf(CONNECTION, SQLDBLink, toQueryParams() << owner << name); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, SQLDBLink, toQueryParams() << owner << name); if (inf.eof()) throw qApp->translate("toOracleExtract", "DBLink %1.%2 doesn't exist").arg(owner).arg(name); QString user(inf.readValue()); @@ -5566,7 +5585,8 @@ QString segment = str.first(); QString partition = str.last(); - toQuery inf(CONNECTION, segments(ext, SQLPartitionSegmentType), toQueryParams() << segment << partition << owner); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, segments(ext, SQLPartitionSegmentType), toQueryParams() << segment << partition << owner); if (inf.eof()) throw qApp->translate("toOracleExtract", "Exchange index %1.%2 doesn't exist").arg(owner).arg(name); QString type = inf.readValue(); @@ -5580,7 +5600,7 @@ QString unique = Utils::toShift(result); QString bitmap = Utils::toShift(result); - toUnShift(result, toQValue("")); + Utils::toUnShift(result, toQValue("")); std::list<QString> ctx; ctx.insert(ctx.end(), schema); @@ -5613,7 +5633,8 @@ QString segment = str.first(); QString partition = str.last(); - toQuery inf(CONNECTION, segments(ext, SQLPartitionSegmentType), toQueryParams() << segment << partition << owner); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, segments(ext, SQLPartitionSegmentType), toQueryParams() << segment << partition << owner); if (inf.eof()) throw qApp->translate("toOracleExtract", "Exchange table %1.%2 doesn't exist").arg(owner).arg(name); QString type = inf.readValue(); @@ -5699,7 +5720,7 @@ return ; } - toUnShift(storage, toQValue("")); + Utils::toUnShift(storage, toQValue("")); describeAttributes(ext, lst, ctx, storage); if (!compressed.isEmpty() && compressed != "0" && ext.getStorage()) addDescription(lst, ctx, "COMPRESS", compressed); @@ -5905,7 +5926,8 @@ const QString &owner, const QString &name) const { - toQuery inf(CONNECTION, SQLTableType, toQueryParams() << name << owner); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, SQLTableType, toQueryParams() << name << owner); if (inf.eof()) throw qApp->translate("toOracleExtract", "Couldn't find table %1.%2").arg(owner).arg(name); @@ -5951,7 +5973,8 @@ describeIndex(ext, lst, ext.intSchema(indOwner, true), indOwner, Utils::toShift(indexes)); } - toQuery inf(CONNECTION, SQLTableType, toQueryParams() << name << owner); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, SQLTableType, toQueryParams() << name << owner); if (inf.eof()) throw qApp->translate("toOracleExtract", "Couldn't find table %1.%2").arg(owner).arg(name); @@ -5968,7 +5991,7 @@ Utils::toShift(constraints); } - toQList triggers = toQuery::readQuery(CONNECTION, SQLTableTriggers, toQueryParams() name << owner); + toQList triggers = toQuery::readQuery(ext.connection(), SQLTableTriggers, toQueryParams() << name << owner); while (!triggers.empty()) describeTrigger(ext, lst, schema, owner, Utils::toShift(triggers)); } @@ -5990,10 +6013,9 @@ const QString &, const QString &name) const { - toQList info = toQuery::readQuery(CONNECTION, + toQList info = toQuery::readQuery(ext.connection(), SQLTablespaceInfo, - QString::number(ext.getBlockSize()), - toQueryParams() << name); + toQueryParams() << QString::number(ext.getBlockSize()) << name); if (info.size() != 10) throw qApp->translate("toOracleExtract", "Couldn't find tablespace %1").arg(name); @@ -6253,7 +6275,8 @@ addDescription(lst, ctx, "AS", text); describeComments(ext, lst, ctx, owner, name); - toQuery query(CONNECTION, "SELECT * FROM " + QUOTE(owner) + "." + QUOTE(name) + " WHERE NULL = NULL"); + toConnectionSubLoan conn(ext.connection()); + toQuery query(conn, "SELECT * FROM " + QUOTE(owner) + "." + QUOTE(name) + " WHERE NULL = NULL", toQueryParams()); toQColumnDescriptionList desc = query.describe(); int num = 1; @@ -7268,7 +7291,8 @@ QString toOracleExtract::createMetadata(toExtract &ext, const QString &owner, const QString &name, const QString &type) const { - toQuery inf(CONNECTION, SQLDbmsMetadataGetDdl, toQueryParams() << type << name << owner); + toConnectionSubLoan conn(ext.connection()); + toQuery inf(conn, SQLDbmsMetadataGetDdl, toQueryParams() << type << name << owner); if (inf.eof()) throw qApp->translate("toOracleExtract", "Couldn't get meta information for %1 %2.%3").arg(type).arg(owner).arg(name); @@ -7602,7 +7626,9 @@ toConnectionSubLoan conn(CONNECTION); try { - toQuery(CONNECTION, "select * from sys.dba_segments where null=null", toQueryParams()); + toConnectionSubLoan conn(ext.connection()); + toQuery q(conn, "select * from sys.dba_segments where null=null", toQueryParams()); + q.eof(); DbaSegments = "sys.dba_segments"; } catch (...) @@ -7614,14 +7640,14 @@ try { - toQList ret = toQuery::readQuery(CONNECTION, SQLSetSizing); + toQList ret = toQuery::readQuery(ext.connection(), SQLSetSizing, toQueryParams()); ext.setBlockSize(Utils::toShift(ret).toInt()); } catch (...) { - toQList ret = toQuery::readQuery(CONNECTION, SQLSetSizingFallback, toQueryParams()); + toQList ret = toQuery::readQuery(ext.connection(), SQLSetSizingFallback, toQueryParams()); if (ret.empty()) - ret = toQuery::readQuery(CONNECTION, SQLSetSizingFallback2, toQueryParams()); + ret = toQuery::readQuery(ext.connection(), SQLSetSizingFallback2, toQueryParams()); ext.setBlockSize(Utils::toShift(ret).toInt()); } } @@ -7861,12 +7887,12 @@ { clearFlags(ext); - if (type == "TABLE") - stream << migrateTable(ext, src, dst); +// if (type == "TABLE") +// stream << migrateTable(ext, src, dst); // TODO: Add other missing objects: views, indexes, tablespaces etc. // else if (type == "OTHEROBJECTS") // stream << migrateOtherObject(otherparams); - else +// else { throw qApp->translate("toOracleExtract", "Invalid type %1 to migrate").arg(type); } Modified: trunk/tora/src/connection/tooracleextract.h =================================================================== --- trunk/tora/src/connection/tooracleextract.h 2013-08-27 18:01:01 UTC (rev 4799) +++ trunk/tora/src/connection/tooracleextract.h 2013-08-27 19:14:03 UTC (rev 4800) @@ -331,8 +331,8 @@ std::list<QString> &destin) const; QString migrateSequence(toExtract &ext, std::list<QString> &source, std::list<QString> &destin) const; - QString migrateTable(toExtract &ext, std::list<QString> &source, - std::list<QString> &destin) const; +// QString migrateTable(toExtract &ext, std::list<QString> &source, +// std::list<QString> &destin) const; // DBMS_METADATA QString createMetadata(toExtract &ext, const QString &owner, const QString &name, const QString &type) const; Modified: trunk/tora/src/core/toextract.cpp =================================================================== --- trunk/tora/src/core/toextract.cpp 2013-08-27 18:01:01 UTC (rev 4799) +++ trunk/tora/src/core/toextract.cpp 2013-08-27 19:14:03 UTC (rev 4800) @@ -908,18 +908,18 @@ return QString::null; } -QString toExtract::createFromParse(std::list<toSQLParse::statement>::iterator start, - std::list<toSQLParse::statement>::iterator end) -{ - QString ret; - toSQLParse::statement newstat(toSQLParse::statement::Statement); - while (start != end) - { - newstat.subTokens().insert(newstat.subTokens().end(), *start); - start++; - } - return toSQLParse::indentStatement(newstat, connection()).trimmed(); -} +//QString toExtract::createFromParse(std::list<toSQLParse::statement>::iterator start, +// std::list<toSQLParse::statement>::iterator end) +//{ +// QString ret; +// toSQLParse::statement newstat(toSQLParse::statement::Statement); +// while (start != end) +// { +// newstat.subTokens().insert(newstat.subTokens().end(), *start); +// start++; +// } +// return toSQLParse::indentStatement(newstat, connection()).trimmed(); +//} std::list<toExtract::columnInfo> toExtract::parseColumnDescription(std::list<QString>::const_iterator begin, std::list<QString>::const_iterator end, Modified: trunk/tora/src/core/toextract.h =================================================================== --- trunk/tora/src/core/toextract.h 2013-08-27 18:01:01 UTC (rev 4799) +++ trunk/tora/src/core/toextract.h 2013-08-27 19:14:03 UTC (rev 4800) @@ -691,8 +691,8 @@ * @param end End of parameters. * @return The indented statement. */ - QString createFromParse(std::list<toSQLParse::statement>::iterator start, - std::list<toSQLParse::statement>::iterator end); + //QString createFromParse(std::list<toSQLParse::statement>::iterator start, + // std::list<toSQLParse::statement>::iterator end); /** Create a source and destination object list to two other lists * containing dropped and created objects or attributes. Deleted: trunk/tora/src/core/tooracleextract.cpp =================================================================== --- trunk/tora/src/core/tooracleextract.cpp 2013-08-27 18:01:01 UTC (rev 4799) +++ trunk/tora/src/core/tooracleextract.cpp 2013-08-27 19:14:03 UTC (rev 4800) @@ -1,7873 +0,0 @@ -/* BEGIN_COMMON_COPYRIGHT_HEADER - * - * TOra - An Oracle Toolkit for DBA's and developers - * - * Shared/mixed copyright is held throughout files in this product - * - * Portions Copyright (C) 2000-2001 Underscore AB - * Portions Copyright (C) 2003-2005 Quest Software, Inc. - * Portions Copyright (C) 2004-2009 Numerous Other Contributors - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; only version 2 of - * the License is valid for this program. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * As a special exception, you have permission to link this program - * with the Oracle Client libraries and distribute executables, as long - * as you follow the requirements of the GNU GPL in regard to all of the - * software in the executable aside from Oracle client libraries. - * - * Specifically you are not permitted to link this program with the - * Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech. - * And you are not permitted to distribute binaries compiled against - * these libraries. - * - * You may link this product with any GPL'd Qt library. - * - * All trademarks belong to their respective owners. - * - * END_COMMON_COPYRIGHT_HEADER */ - -#include "core/tooracleextract.h" -#include "core/toconnectiontraits.h" -#include "core/utils.h" -#include "core/toconf.h" -#include "core/toquery.h" -#include "core/toextract.h" -#include "core/tosql.h" -#include "core/totool.h" - -#include <QtGui/QApplication> -#include <QtGui/QRegExp> - -static toOracleExtract OracleExtractor; - -// Implementation misc - -void toOracleExtract::clearFlags(toExtract &ext) const -{ - ext.setState("IsASnapIndex", QVariant(false)); - ext.setState("IsASnapTable", QVariant(false)); -} - -static toSQL SQLDisplaySource("toOracleExtract:ListSource", - "SELECT text\n" - " FROM sys.all_source\n" - " WHERE type = :typ<char[100]>\n" - " AND name = :nam<char[100]>\n" - " AND owner = :own<char[100]>\n" - " ORDER BY line", - "Get source of an object from the database, " - "must have same columns and binds"); - -QString toOracleExtract::displaySource(toExtract &ext, - const QString &schema, - const QString &owner, - const QString &name, - const QString &type, - bool describe) const -{ - if (!ext.getCode()) - return ""; - - QString re("^\\s*"); - re += type; - re += "\\s+"; - QRegExp StripType(re, Qt::CaseInsensitive); - - toConnectionSubLoan conn(CONNECTION); - toQuery inf(conn, SQLDisplaySource, toQueryParams() << type << name << owner); - if (inf.eof()) - throw qApp->translate("toOracleExtract", "Couldn't find source for of %1.%2").arg(owner).arg(name); - - QString ret; - if (PROMPT && !describe) - ret = QString("PROMPT CREATE OR REPLACE %1 %2%3\n\n"). - arg(type). - arg(schema). - arg(QUOTE(name)); - bool first = true; - while (!inf.eof()) - { - QString line = inf.readValue(); - if (first) - { - int len; - int pos = StripType.indexIn(line, 0); - len = StripType.matchedLength(); - if (pos != 0) - throw qApp->translate("toOracleExtract", "Displaying source of wrong type for %1. Got %2 expected 0.") - .arg(type).arg(pos); - QString tmp = QString("CREATE OR REPLACE %1 ") - .arg(type); - if (!describe) - tmp += schema; - tmp += line.mid(len); - line = tmp.simplified() + "\n"; // avoid growing amount of spaces - - first = false; - } - ret += line; - } - if (!describe) - ret += "\n/\n\n"; - return ret; -} - -static toSQL SQLKeyColumns("toOracleExtract:KeyColumns", - "SELECT column_name\n" - " FROM sys.all_%1_key_columns\n" - " WHERE name = :nam<char[100]>\n" - " AND owner = :owner<char[100]>\n" - " AND object_type LIKE :typ<char[100]>||'%'", - "Get key columns of partitions, " - "must have same binds, columns and %"); - -QString toOracleExtract::keyColumns(toExtract &ext, - const QString &owner, - const QString &name, - const QString &type, - const QString &table) const -{ - toConnectionSubLoan conn(CONNECTION); - toQuery inf(conn, toSQL::string(SQLKeyColumns, CONNECTION).arg(table), toQueryParams() << name << owner << type); - QString ret; - bool first = true; - while (!inf.eof()) - { - if (first) - first = false; - else - ret += "\n , "; - ret += QUOTE(inf.readValue()); - } - return ret; -} - -QString toOracleExtract::partitionKeyColumns(toExtract &ext, - const QString &owner, - const QString &name, - const QString &type) const -{ - return keyColumns(ext, owner, name, type, "PART"); -} - -QString toOracleExtract::prepareDB(const QString &db) -{ - static QRegExp quote("'"); - QString ret = db; - ret.replace(quote, "''"); - return ret; -} - -QString toOracleExtract::segments(toExtract &ext) const -{ - return ext.state("Segments").toString(); -} - -QString toOracleExtract::segments(toExtract &ext, const toSQL &sql) const -{ - return toSQL::string(sql, CONNECTION).arg(segments(ext)); -} - -QString toOracleExtract::subPartitionKeyColumns(toExtract &ext, - const QString &owner, - const QString &name, - const QString &type) const -{ - return keyColumns(ext, owner, name, type, "SUBPART"); -} - -// Implementation create utility functions - -static toSQL SQLConstraintCols("toOracleExtract:ConstraintCols", - "SELECT column_name\n" - " FROM sys.all_cons_columns\n" - " WHERE owner = :own<char[100]>\n" - " AND constraint_name = :con<char[100]>\n" - " ORDER BY position", - "List columns in a constraint, must have same binds and columns"); - -QString toOracleExtract::constraintColumns(toExtract &ext, - const QString &owner, - const QString &name) const -{ - toConnectionSubLoan conn(CONNECTION); - toQuery query(conn, SQLConstraintCols, toQueryParams() << owner << name); - - QString ret = "(\n "; - bool first = true; - while (!query.eof()) - { - if (first) - first = false; - else - ret += ",\n "; - ret += QUOTE(query.readValue()); - } - ret += "\n)\n"; - return ret; -} - -static toSQL SQLTableComments("toOracleExtract:TableComment", - "SELECT comments\n" - " FROM sys.all_tab_comments\n" - " WHERE table_name = :nam<char[100]>\n" - " AND comments IS NOT NULL\n" - " AND owner = :own<char[100]>", - "Extract comments about a table, must have same columns and binds"); - -static toSQL SQLColumnComments("toOracleExtract:ColumnComment", - "SELECT column_name,\n" - " comments\n" - " FROM sys.all_col_comments\n" - " WHERE table_name = :nam<char[100]>\n" - " AND comments IS NOT NULL\n" - " AND owner = :own<char[100]>", - "Extract comments about a columns, must have same columns and binds"); - -QString toOracleExtract::createComments(toExtract &ext, - const QString &schema, - const QString &owner, - const QString &name) const -{ - QString ret; - toConnectionSubLoan conn(CONNECTION); - if (ext.getComments()) - { - QString sql; - toQuery inf(conn, SQLTableComments, toQueryParams() << name << owner); - while (!inf.eof()) - { - sql = QString("COMMENT ON TABLE %1%2 IS '%3'"). - arg(schema). - arg(QUOTE(name)). - arg(prepareDB(inf.readValue())); - if (PROMPT) - { - ret += "PROMPT "; - ret += sql; - ret += "\n\n"; - } - ret += sql; - ret += ";\n\n"; - } - toQuery col(conn, SQLColumnComments, toQueryParams() << name << owner); - while (!col.eof()) - { - QString column = col.readValue(); - sql = QString("COMMENT ON COLUMN %1%2.%3 IS '%4'"). - arg(schema). - arg(QUOTE(name)). - arg(QUOTE(column)). - arg(prepareDB(col.readValue())); - if (PROMPT) - { - ret += "PROMPT "; - ret += sql; - ret += "\n\n"; - } - ret += sql; - ret += ";\n\n"; - } - } - return ret; -} - -static toSQL SQLContextInfoDBA("toOracleExtract:ContextInfoDBA", - "SELECT\n" - " ixv_class\n" - " , ixv_object\n" - " , ixv_attribute\n" - " , ixv_value\n" - " FROM\n" - " ctxsys.ctx_index_values\n" - " WHERE\n" - " ixv_index_owner = :own<char[100]>\n" - " AND\n" - " ixv_index_name = :nam<char[100]>\n" - " AND\n" - " ixv_class = :cls<char[100]>\n" - " ORDER BY\n" - " ixv_object", - "Get information on context index preferences.", - "0801"); - -static toSQL SQLContextInfoNoAttrDBA("toOracleExtract:ContextInfoNoAttrDBA", - "SELECT\n" - " ixo_object\n" - " FROM\n" - " ctxsys.ctx_index_objects\n" - " WHERE\n" - " ixo_index_owner = :own<char[100]>\n" - " AND\n" - " ixo_index_name = :nam<char[100]>\n" - " AND\n" - " ixo_class = :cls<char[100]>", - "Get the context preferences w/o attributes.", - "0801"); - -static toSQL SQLContextColumnDBA("toOracleExtract:ContextColumnDBA", - "SELECT\n" - " idx_language_column\n" - " , idx_format_column\n" - " , idx_charset_column\n" - " FROM\n" - " ctxsys.ctx_indexes\n" - " WHERE\n" - " idx_owner = :own<char[100]>\n" - " AND\n" - " idx_name = :nam<char[100]>", - "Get the context column designations.", - "0801"); - -static toSQL SQLContextInfo("toOracleExtract:ContextInfo", - "SELECT\n" - " ixv_class\n" - " , ixv_object\n" - " , ixv_attribute\n" - " , ixv_value\n" - " FROM\n" - " ctxsys.ctx_user_index_values\n" - " WHERE\n" - " ixv_index_name = :nam<char[100]>\n" - " AND\n" - " ixv_class = :cls<char[100]>\n" - " ORDER BY\n" - " ixv_object", - "Get information on context index preferences.", - "0801"); - -static toSQL SQLContextInfoNoAttr("toOracleExtract:ContextInfoNoAttr", - "SELECT\n" - " ixo_object\n" - " FROM\n" - " ctxsys.ctx_user_index_objects\n" - " WHERE\n" - " ixo_index_name = :nam<char[100]>\n" - " AND\n" - " ixo_class = :cls<char[100]>", - "Get the context preferences w/o attributes.", - "0801"); - -static toSQL SQLContextColumn("toOracleExtract:ContextColumn", - "SELECT\n" - " idx_language_column\n" - " , idx_format_column\n" - " , idx_charset_column\n" - " FROM\n" - " ctxsys.ctx_user_indexes\n" - " WHERE\n" - " idx_name = :nam<char[100]>", - "Get the context column designations.", - "0801"); - -QString toOracleExtract::createContextPrefs(toExtract &ext, - const QString &, - const QString &owner, - const QString &name, - const QString &sql) const -{ - QString prefs = ""; - if (PROMPT) - prefs += "PROMPT CREATE CONTEXT PREFERENCES\n\n"; - prefs += qApp->translate("toOracleExtract", - "-- Context indexes can be quite complicated depending upon the\n" - "-- used parameters. The following is an attempt to recreate this\n" - "-- context index. But, a close scrutiny of the following code is\n" - "-- strongly recommended.\n\n"); - QString tmp; - QString pre_name = ""; - QString parameters = ""; - QStringList ql; - toQList resultset; - bool first = true; - bool isDBA = true; - try - { - resultset = toQuery::readQuery(CONNECTION, - "SELECT * FROM ctxsys.ctx_indexes " - "WHERE idx_owner = 'DUMMY'", - toQueryParams()); - } - catch (...) - { - isDBA = false; - } - ql << "DATASTORE" << "FILTER" << "LEXER" << "WORDLIST" << "STORAGE"; - // Lets start with discovering the preferences - QStringList::Iterator it; - for (it = ql.begin(); it != ql.end(); ++it) - { - if (isDBA) - resultset = toQuery::readQuery(CONNECTION, SQLContextInfoDBA, toQueryParams() << owner << name << *it); - else - resultset = toQuery::readQuery(CONNECTION, SQLContextInfo, toQueryParams() << name << *it); - if (!resultset.empty()) - { - first = true; - while (!resultset.empty()) - { - QString pre_class = Utils::toShift(resultset); - QString pre_obj = Utils::toShift(resultset); - QString pre_attr = Utils::toShift(resultset); - QString pre_val = Utils::toShift(resultset); - if (first) - { - first = false; - pre_name = QString("%1_%2").arg(name).arg(pre_obj); - pre_name.truncate(30); - tmp = QString("BEGIN\n CTX_DDL.CREATE_PREFERENCE('%1','%2');\n") - .arg(pre_name).arg(pre_obj); - prefs += tmp; - parameters += QString(" %1 %2\n") - .arg(pre_class).arg(pre_name); - } - tmp = QString(" CTX_DDL.SET_ATTRIBUTE('%1', '%2', '%3');\n") - .arg(pre_name).arg(pre_attr).arg(pre_val); - prefs += tmp; - } - prefs += "END;\n\n"; - } - else - { - // some preferences don't have any attributes and - // so won't be caught above - if (isDBA) - resultset = toQuery::readQuery(CONNECTION, SQLContextInfoNoAttrDBA, toQueryParams() << owner << name << *it); - else - resultset = toQuery::readQuery(CONNECTION, SQLContextInfoNoAttr, toQueryParams() << name << *it); - if (!resultset.empty()) - { - QString pre_obj = Utils::toShift(resultset); - pre_name = QString("%1_%2").arg(name).arg(pre_obj); - pre_name.truncate(30); - tmp = QString("BEGIN\n CTX_DDL.CREATE_PREFERENCE('%1', '%2');\nEND;\n\n").arg(pre_name).arg(pre_obj); - prefs += tmp; - parameters += QString(" %1 %2\n") - .arg(*it).arg(pre_name); - } - } - } - - // Now get the stoplist - if (isDBA) - resultset = toQuery::readQuery(CONNECTION, SQLContextInfoDBA, toQueryParams() << owner << name << QString::fromLatin1("STOPLIST")); - else - resultset = toQuery::readQuery(CONNECTION, SQLContextInfo, toQueryParams() << name << QString::fromLatin1("STOPLIST")); - pre_name = ""; - while (!resultset.empty()) - { - QString pre_class = Utils::toShift(resultset); - QString pre_obj = Utils::toShift(resultset); - QString pre_attr = Utils::toShift(resultset); - QString pre_val = Utils::toShift(resultset); - if (pre_name == "") - { - pre_name = QString("%1_STOPLIST").arg(name); - pre_name.truncate(30); - tmp = QString("BEGIN\n CTX_DDL.CREATE_STOPLIST('%1');\n") - .arg(pre_name); - prefs += tmp; - parameters += QString(" STOPLIST %1\n").arg(pre_name); - } - pre_attr.remove(4, 1); - tmp = QString(" CTX_DDL.ADD_%1('%2', '%3');\n") - .arg(pre_attr).arg(pre_name).arg(pre_val); - prefs += tmp; - } - if (pre_name != "") - prefs += "END;\n\n"; - else - { - // This is most probably redundant but shouldn't hurt. - // When everybody is out to get you paranoia just seems like a good idea. - - if (isDBA) - resultset = toQuery::readQuery(CONNECTION, SQLContextInfoNoAttrDBA, toQueryParams() << owner << name << QString::fromLatin1("STOPLIST")); - else - resultset = toQuery::readQuery(CONNECTION, SQLContextInfoNoAttr, toQueryParams() << name << QString::fromLatin1("STOPLIST")); - - if (!resultset.empty()) - { - QString pre_obj = Utils::toShift(resultset); - pre_name = QString("%1_%2").arg(name).arg(pre_obj); - pre_name.truncate(30); - tmp = QString("BEGIN\n CTX_DDL.CREATE_STOPLIST('%1');\nEND;\n\n") - .arg(pre_name); - prefs += tmp; - parameters += QString(" STOPLIST %1\n").arg(pre_name); - } - } - - // get the section_groups - if (isDBA) - resultset = toQuery::readQuery(CONNECTION, SQLContextInfoDBA, toQueryParams() << owner << name << QString::fromLatin1("SECTION_GROUP")); - else - resultset = toQuery::readQuery(CONNECTION, SQLContextInfo, toQueryParams() << name << QString::fromLatin1("SECTION_GROUP")); - pre_name = ""; - while (!resultset.empty()) - { - QString pre_class = Utils::toShift(resultset); - QString pre_obj = Utils::toShift(resultset); - QString pre_attr = Utils::toShift(resultset); - QString pre_val = Utils::toShift(resultset); - QString pre_val1 = pre_val.left(pre_val.indexOf(':', 0, Qt::CaseInsensitive)); - pre_val = pre_val.right(pre_val.length() - pre_val1.length() - 1); - QString pre_val2 = pre_val.left(pre_val.indexOf(':', 0, Qt::CaseInsensitive)); - QString pre_val4 = pre_val.right(1); - if (pre_val4 == "Y") - pre_val4 = "TRUE"; - else - pre_val4 = "FALSE"; - if (pre_name == "") - { - pre_name = QString("%1_SECTION_GROUP").arg(name); - pre_name.truncate(30); - tmp = QString("BEGIN\n CTX_DDL.CREATE_SECTION_GROUP('%1', '%2');\n") - .arg(pre_name).arg(pre_obj); - prefs += tmp; - parameters += QString(" SECTION GROUP %1\n").arg(pre_name); - } - if (pre_attr == "ZONE") - tmp = QString(" CTX_DDL.ADD_ZONE_SECTION('%1', '%2', '%3');\n") - .arg(pre_name).arg(pre_val1).arg(pre_val2); - else if (pre_attr == "FIELD") - tmp = QString(" CTX_DDL.ADD_FIELD_SECTION('%1', '%2', '%3', %4);\n") - .arg(pre_name).arg(pre_val1).arg(pre_val2).arg(pre_val4); - else if (pre_attr == "SPECIAL") - tmp = QString(" CTX_DDL.ADD_SPECIAL_SECTION('%1', '%2');\n") - .arg(pre_name).arg(pre_val1); - prefs += tmp; - } - if (pre_name != "") - prefs += "END;\n\n"; - else - { - if (isDBA) - resultset = toQuery::readQuery(CONNECTION, SQLContextInfoNoAttrDBA, toQueryParams() << owner << name << QString::fromLatin1("SECTION_GROUP")); - else - resultset = toQuery::readQuery(CONNECTION, SQLContextInfoNoAttr, toQueryParams() << name << QString::fromLatin1("SECTION_GROUP")); - if (!resultset.empty()) - { - QString pre_obj = Utils::toShift(resultset); - pre_name = QString("%1_%2").arg(name).arg(pre_obj); - pre_name.truncate(30); - tmp = QString("BEGIN\n CTX_DDL.CREATE_SECTION_GROUP('%1', '%2');\nEND;\n\n"). - arg(pre_name).arg(pre_obj); - prefs += tmp; - parameters += QString(" SECTION GROUP %1\n").arg(pre_name); - } - } - - // Lets look up the language, format, and charset columns - // only if Oracle 8.1.6 and above - if (CONNECTION.version() >= "080106") - { - if (isDBA) - resultset = toQuery::readQuery(CONNECTION, SQLContextColumnDBA, toQueryParams() << owner << name); - else - resultset = toQuery::readQuery(CONNECTION, SQLContextColumn, toQueryParams() << name); - if (!resultset.empty()) - { - toQValue vlang = Utils::toShift(resultset); - toQValue vfrmt = Utils::toShift(resultset); - toQValue vcset = Utils::toShift(resultset); - if (!vlang.isNull()) - { - tmp = QString(" LANGUAGE COLUMN %1\n").arg(vlang); - parameters += tmp; - } - if (!vfrmt.isNull()) - { - tmp = QString(" FORMAT COLUMN %1\n").arg(vfrmt); - parameters += tmp; - } - if (!vcset.isNull()) - { - tmp = QString(" CHARSET COLUMN %1\n").arg(vcset); - parameters += tmp; - } - } - } - prefs += sql; - parameters += " "; - tmp = QString("INDEXTYPE IS CTXSYS.CONTEXT\nPARAMETERS ('\n%1');\n\n"). - arg(parameters); - prefs += tmp; - return prefs; -} - -static toSQL SQLIOTInfo("toOracleExtract:IOTInfo", - "SELECT\n" - " DECODE(\n" - " b.monitoring\n" - " ,'NO','NOMONITORING'\n" - " , 'MONITORING'\n" - " )\n" - " , 'N/A' AS table_name\n" - " , LTRIM(a.degree)\n" - " , LTRIM(a.instances)\n" - " , 'INDEX' AS organization\n" - " , 'N/A' AS cache\n" - " , 'N/A' AS pct_used\n" - " , a.pct_free\n" - " , DECODE(\n" - " a.ini_trans\n" - " ,0,1\n" - " ,null,1\n" - " ,a.ini_trans\n" - " ) AS ini_trans\n" - " , DECODE(\n" - " a.max_trans\n" - " ,0,255\n" - " ,null,255\n" - " ,a.max_trans\n" - " ) AS max_trans\n" - " , a.initial_extent\n" - " , a.next_extent\n" - " , a.min_extents\n" - " , DECODE(\n" - " a.max_extents\n" - " ,2147483645,'unlimited'\n" - " ,a.max_extents\n" - " ) AS max_extents\n" - " , a.pct_increase\n" - " , NVL(a.freelists,1)\n" - " , NVL(a.freelist_groups,1)\n" - " , a.buffer_pool AS buffer_pool\n" - " , DECODE(\n" - " b.logging\n" - " ,'NO','NOLOGGING'\n" - " , 'LOGGING'\n" - " ) AS logging\n" - " , a.tablespace_name AS tablespace_name\n" - " , DECODE(\n" - " b.blocks\n" - " ,null,GREATEST(a.initial_extent,a.next_extent) \n" - " / (b.blocks * 1024)\n" - " ,'0' ,GREATEST(a.initial_extent,a.next_extent)\n" - " / (b.blocks * 1024)\n" - " ,b.blocks\n" - " ) AS blocks\n" - " FROM\n" - " sys.all_indexes a,\n" - " sys.all_all_tables b,\n" - " sys.all_constraints c\n" - " WHERE a.table_name = :nam<char[100]>\n" - " AND b.owner = a.owner\n" - " AND b.table_name = a.table_name\n" - " AND a.owner = :own<char[100]>\n" - " AND c.constraint_name = a.index_name\n" - " AND c.owner = a.owner\n" - " AND c.constraint_type = 'P'", - "Get storage information about a IOT storage, " - "same binds and columns"); - -static toSQL SQLOverflowInfo("toOracleExtract:OverflowInfo", - "SELECT\n" - " ' '\n" - " , 'N/A'\n" - " , DECODE(\n" - " LTRIM(t.cache)\n" - " ,'Y','CACHE'\n" - " , 'NOCACHE'\n" - " )\n" - " , t.pct_used\n" - " , t.pct_free\n" - " , DECODE(\n" - " t.ini_trans\n" - " ,0,1\n" - " ,null,1\n" - " ,t.ini_trans\n" - " ) AS ini_trans\n" - " , DECODE(\n" - " t.max_trans\n" - " ,0,255\n" - " ,null,255\n" - " ,t.max_trans\n" - " ) AS max_trans\n" - " , t.initial_extent\n" - " , t.next_extent\n" - " , t.min_extents\n" - " , DECODE(\n" - " t.max_extents\n" - " ,2147483645,'unlimited'\n" - " , t.max_extents\n" - " ) AS max_extents\n" - " , NVL(t.pct_increase,0)\n" - " , NVL(t.freelists,1)\n" - " , NVL(t.freelist_groups,1)\n" - " , t.buffer_pool AS buffer_pool\n" - " , DECODE(\n" - " t.logging\n" - " ,'NO','NOLOGGING'\n" - " , 'LOGGING'\n" - " ) AS logging\n" - " , t.tablespace_name AS tablespace_name\n" - " , s.blocks - NVL(t.empty_blocks,0)\n" - " FROM\n" - " sys.all_tables t\n" - " , %1 s\n" - " WHERE\n" - " t.iot_name = :nam<char[100]>\n" - " AND t.table_name = s.segment_name\n" - " AND s.segment_type = 'TABLE'\n" - " AND s.owner = :own<char[100]>\n" - " AND t.owner = s.owner", - "Get information about overflow segment for table, must have same binds and columns", - "0800"); - -QString toOracleExtract::createIOT(toExtract &ext, const QString &schema, const QString &owner, - const QString &name) const -{ - toQList storage = toQuery::readQuery(CONNECTION, SQLIOTInfo, toQueryParams() << name << owner); - - QString ret = createTableText(ext, storage, schema, owner, name); - if (ext.getStorage()) - { - toQList overflow = toQuery::readQuery(CONNECTION, segments(ext, SQLOverflowInfo... [truncated message content] |