From: <ibr...@us...> - 2013-08-15 20:59:54
|
Revision: 4754 http://sourceforge.net/p/tora/code/4754 Author: ibre5041 Date: 2013-08-15 20:59:50 +0000 (Thu, 15 Aug 2013) Log Message: ----------- Modified Paths: -------------- branches/tora3/src/tests/test5.cpp Modified: branches/tora3/src/tests/test5.cpp =================================================================== --- branches/tora3/src/tests/test5.cpp 2013-08-15 14:09:27 UTC (rev 4753) +++ branches/tora3/src/tests/test5.cpp 2013-08-15 20:59:50 UTC (rev 4754) @@ -53,6 +53,12 @@ #include <QtCore/QLibrary> #include <QtGui/QProgressBar> +static void usage() +{ + printf("Usage:\n\n test5 connectstring\n\n"); + exit(2); +} + int main(int argc, char **argv) { int p = 0; @@ -197,12 +203,34 @@ qApp->translate("main", "Exit")); } - QString user = QString::fromAscii("system"); - QString password = QString::fromAscii("acror"); - QString connect = QString::fromAscii("DEVEL"); + if (qApp->argc() == 1) + usage(); + + QString connect = QString::fromLatin1(qApp->argv()[1]); + QString user, password, database; + + QStringList slashList, atList = connect.split("@", QString::SkipEmptyParts); + if( atList.size() == 1) + database = QString::fromLatin1(qgetenv("ORACLE_SID")); + if( atList.size() > 2) + usage(); + + if( atList.at(0).contains("/")) + { + slashList = atList.at(0).split("/", QString::SkipEmptyParts); + user = slashList.at(0); + password = slashList.at(1); + database = atList.at(1); + } else { + slashList = atList.at(1).split("/", QString::SkipEmptyParts); + user = atList.at(0); + database = slashList.at(0); + password = slashList.at(1); + } + QSet<QString> options; - new Test5Window(user, password, connect, options); + new Test5Window(user, password, database, options); int ret = qApp->exec(); return ret; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |