Commit f3fcdfe9 authored by Giuseppe Lo Presti's avatar Giuseppe Lo Presti
Browse files

Don't generate the *_oracle_drop SQL script anymore

parent 454a718c
......@@ -5,7 +5,7 @@
#
# @author Castor dev team, castor-dev@cern.ch
#
# @(#)$RCSfile: gencastor,v $ $Revision: 1.15 $ $Release$ $Date: 2007/02/08 18:22:41 $ $Author: itglp $
# @(#)$RCSfile: gencastor,v $ $Revision: 1.16 $ $Release$ $Date: 2007/04/30 12:47:38 $ $Author: itglp $
#
if ("$1" == "-h") then
......@@ -39,7 +39,6 @@ set TMPDIR=`mktemp /tmp/gencastor-XXXXXX`
rm -rf ${TMPDIR}
mkdir -p ${TMPDIR}/${TOPNS}/db
cp ${WORKDIR}/${TOPNS}/db/*.sql ${TMPDIR}/${TOPNS}/db/
grep 'CREATE OR REPLACE' ${TMPDIR}/${TOPNS}/db/oracleTrailer.sql | grep -v 'TRIGGER' | grep -v I_CastorFile_fileIdNsHost | awk 'BEGIN { FS="[ (]+" } { print "DROP " $4, $5 ";" }' > ${TMPDIR}/${TOPNS}/db/oracleTrailer_drop.sql
grep 'CREATE OR REPLACE' ${TMPDIR}/${TOPNS}/db/postgresTrailer.sql | grep -v 'TRIGGER' | grep -v I_CastorFile_fileIdNsHost | awk 'BEGIN { FS="[ (]+" } { print "DROP " $4, $5 ";" }' > ${TMPDIR}/${TOPNS}/db/postgresTrailer_drop.sql
# removes CVS keywords
sed 's/\$//g' ${TMPDIR}/${TOPNS}/db/oracleTrailer.sql > ${TMPDIR}/ora.sql
......@@ -48,7 +47,6 @@ mv ${TMPDIR}/ora.sql ${TMPDIR}/${TOPNS}/db/oracleTrailer.sql
(/usr/bin/gencastor.bin -o ${TMPDIR} -c ${TOPNS} --nocrashhandler ${XMIFILE} > /dev/tty) >& /dev/null
sed 's/^END;/END;\n\//' ${TMPDIR}/${TOPNS}/db/${TOPNS}_oracle_create.sql | sed 's/^\(END castor[a-zA-Z]*;\)/\1\n\//' | sed 's/\(CREATE OR REPLACE TYPE .*\)$/\1\n\//' > ${TMPDIR}/${TOPNS}/db/${TOPNS}_oracle_create.sqlplus
sed 's/^END;/END;\n\//' ${TMPDIR}/${TOPNS}/db/${TOPNS}_oracle_drop.sql | sed 's/^\(END castor[a-zA-Z]*;\)/\1\n\//' | sed 's/\(CREATE OR REPLACE TYPE .*\)$/\1\n\//' > ${TMPDIR}/${TOPNS}/db/${TOPNS}_oracle_drop.sqlplus
set pushdsilent
pushd ${TMPDIR}
......
......@@ -47,16 +47,6 @@ void CppCppDbCnvWriter::startSQLFile() {
IO_WriteOnly | IO_Truncate);
file.close();
openFile(file, s_topNS + "/db/" + s_topNS + "_oracle_drop.sql",
IO_WriteOnly | IO_Truncate);
file.close();
openFile(file, s_topNS + "/db/oracleGeneratedHeader_drop.sql",
IO_WriteOnly | IO_Truncate);
file.close();
openFile(file, s_topNS + "/db/oracleGeneratedCore_drop.sql",
IO_WriteOnly | IO_Truncate);
file.close();
openFile(file, s_topNS + "/db/" + s_topNS + "_postgres_create.sql",
IO_WriteOnly | IO_Truncate);
file.close();
......@@ -108,15 +98,6 @@ void CppCppDbCnvWriter::endSQLFile() {
insertFileintoStream(streamO, s_topNS + "/db/oracleTrailer.sql");
file.close();
openFile(file, s_topNS + "/db/" + s_topNS + "_oracle_drop.sql",
IO_WriteOnly | IO_Append);
QTextStream streamOD(&file);
insertFileintoStream(streamOD, s_topNS + "/db/oracleHeader_drop.sql");
insertFileintoStream(streamOD, s_topNS + "/db/oracleGeneratedHeader_drop.sql");
insertFileintoStream(streamOD, s_topNS + "/db/oracleGeneratedCore_drop.sql");
insertFileintoStream(streamOD, s_topNS + "/db/oracleTrailer_drop.sql");
file.close();
openFile(file, s_topNS + "/db/" + s_topNS + "_postgres_create.sql",
IO_WriteOnly | IO_Append);
QTextStream streamP(&file);
......@@ -576,7 +557,7 @@ void CppCppDbCnvWriter::writeConstants() {
// writeOraSqlStatements
//=============================================================================
void CppCppDbCnvWriter::writeOraSqlStatements() {
QFile file, tFile, fileD, hFileD;
QFile file, tFile;
openFile(file,
s_topNS + "/db/oracleGeneratedCore_create.sql",
IO_WriteOnly | IO_Append);
......@@ -585,22 +566,6 @@ void CppCppDbCnvWriter::writeOraSqlStatements() {
s_topNS + "/db/oracleGeneratedTrailer_create.sql",
IO_WriteOnly | IO_Append);
QTextStream tStream(&tFile);
openFile(hFileD,
s_topNS + "/db/oracleGeneratedHeader_drop.sql",
IO_WriteOnly | IO_Append);
QTextStream hStreamD(&hFileD);
openFile(fileD,
s_topNS + "/db/oracleGeneratedCore_drop.sql",
IO_WriteOnly | IO_Append);
QTextStream streamD(&fileD);
streamD << "/* SQL statements for type "
<< m_classInfo->className
<< " */"
<< endl
<< "DROP TABLE "
<< m_classInfo->className
<< ";" << endl;
stream << "/* SQL statements for type "
<< m_classInfo->className
......@@ -664,18 +629,7 @@ void CppCppDbCnvWriter::writeOraSqlStatements() {
QString compoundName =
capitalizeFirstLetter(firstMember->typeName).mid(0, 12) + QString("2")
+ capitalizeFirstLetter(secondMember->typeName).mid(0, 13);
streamD << getIndent()
<< "DROP INDEX I_"
<< compoundName
<< "_C;"
<< endl << getIndent()
<< "DROP INDEX I_"
<< compoundName
<< "_P;"
<< endl << "DROP TABLE "
<< compoundName
<< ";" << endl;
stream << "CREATE TABLE "
stream << "CREATE TABLE "
<< compoundName
<< " (Parent INTEGER, Child INTEGER) INITRANS 50 PCTFREE 50;"
<< endl << getIndent()
......@@ -691,16 +645,6 @@ void CppCppDbCnvWriter::writeOraSqlStatements() {
<< compoundName
<< " (parent);"
<< endl;
hStreamD << getIndent()
<< "ALTER TABLE "
<< compoundName
<< endl << getIndent()
<< " DROP CONSTRAINT fk_"
<< compoundName
<< "_P" << endl << getIndent()
<< " DROP CONSTRAINT fk_"
<< compoundName
<< "_C;" << endl;
tStream << getIndent()
<< "ALTER TABLE "
<< compoundName
......@@ -719,11 +663,8 @@ void CppCppDbCnvWriter::writeOraSqlStatements() {
}
}
stream << endl;
streamD << endl;
file.close();
tFile.close();
hFileD.close();
fileD.close();
}
//=============================================================================
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment