From 96dde3cfc0f07d3d94b88407192c74c90b4401d4 Mon Sep 17 00:00:00 2001 From: Jamey Hicks Date: Thu, 1 Mar 2012 17:14:02 -0500 Subject: added load command to jsondb-client. Change-Id: I5240d38a1615dfe70fa24122a4a0b13b424f69a6 Reviewed-by: Kevin Simons --- tools/jsondb-client/client.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/jsondb-client/client.cpp b/tools/jsondb-client/client.cpp index 7a47ae3a..ae0316cc 100644 --- a/tools/jsondb-client/client.cpp +++ b/tools/jsondb-client/client.cpp @@ -56,6 +56,7 @@ QT_USE_NAMESPACE const char* InputThread::commands[] = { "changesSince", "create {\"", "help", + "load", "notify create [?", "notify remove [?", "notify update [?", @@ -373,6 +374,7 @@ void Client::usage() << " remove [partition:] QUERY" << std::endl << " find [partition:] QUERY" << std::endl << " changesSince [partition:] STATENUMBER [type1 type2 ...]" << std::endl + << " load FILE1 FILE2 ..." << std::endl << std::endl << "Convenience functions" << std::endl << " query STRING [limit]" << std::endl @@ -517,6 +519,14 @@ bool Client::processCommand(const QString &command) this, SLOT(onRequestError(QtJsonDb::QJsonDbRequest::ErrorCode,QString))); pushRequest(request); mConnection->send(request); + } else if (cmd == "load") { + QStringList filenames = rest.split(' '); + for (int i = 0; i < filenames.size(); i++) { + QString filename = filenames[i]; + if (filename.startsWith('"')) + filenames[i] = filename.mid(1, filename.size()-2); + } + loadFiles(filenames); } else if (cmd == "changesSince") { qWarning() << "Not yet supported"; } else if (cmd == "connect") { @@ -566,7 +576,7 @@ void Client::loadNextFile() if (mFilesToLoad.isEmpty()) { if (mTerminate) emit terminate(); - else + else if (!mInputThread) interactiveMode(); return; } -- cgit v1.2.3