kexi

KexiDB::SimpleCommandLineApp Class Reference

#include <simplecommandlineapp.h>

Inheritance diagram for KexiDB::SimpleCommandLineApp:

KexiDB::Object

List of all members.


Detailed Description

A skeleton for creating a simple command line database application.

This class creates a KInstance object and automatically handles the following command line options:

  • --driver <name> (Database driver name) or -drv
  • --user <name> (Database user name) or -u
  • --password (Prompt for password) or -p
  • --host <name> (Server (host) name) or -h
  • --port <number> (Server's port number)
  • --local-socket <filename> (Server's local socket filename, if needed) or -s

You can use this helper class to create test applications or small tools that open a KexiDB-compatible database using command line arguments, do some data processing and close the database.

Definition at line 46 of file simplecommandlineapp.h.


Public Member Functions

 SimpleCommandLineApp (int argc, char **argv, KCmdLineOptions *options, const char *programName, const char *version, const char *shortDescription=0, int licenseType=KAboutData::License_Unknown, const char *copyrightStatement=0, const char *text=0, const char *homePageAddress=0, const char *bugsEmailAddress="submit@bugs.kde.org")
KInstance * instance () const
bool openDatabase (const QString &databaseName)
bool closeDatabase ()
KexiDB::ConnectionDataconnectionData () const
KexiDB::Connectionconnection () const

Protected Attributes

Private *const d

Constructor & Destructor Documentation

SimpleCommandLineApp::SimpleCommandLineApp ( int  argc,
char **  argv,
KCmdLineOptions *  options,
const char *  programName,
const char *  version,
const char *  shortDescription = 0,
int  licenseType = KAboutData::License_Unknown,
const char *  copyrightStatement = 0,
const char *  text = 0,
const char *  homePageAddress = 0,
const char *  bugsEmailAddress = "submit@bugs.kde.org" 
)

Todo:
make use of pty/tty here! (and care about portability)

Definition at line 82 of file simplecommandlineapp.cpp.


Member Function Documentation

KInstance * SimpleCommandLineApp::instance (  )  const

Returns:
program instance

Definition at line 215 of file simplecommandlineapp.cpp.

bool SimpleCommandLineApp::openDatabase ( const QString &  databaseName  ) 

Opens database databaseName for connection data specified via the command line.

Returns:
true in success. In details: the database driver is loaded, the connection is opened and the database is used. Use KexiDB::Object methods to get status of the operation on failure.

Definition at line 157 of file simplecommandlineapp.cpp.

bool SimpleCommandLineApp::closeDatabase (  ) 

Closes database connection previously opened using openDatabase()

Returns:
true on success. This method is called on destruction. Use KexiDB::Object methods to get status of the operation on failure.

Definition at line 204 of file simplecommandlineapp.cpp.

KexiDB::ConnectionData * SimpleCommandLineApp::connectionData (  )  const

Returns:
connection data for this application.

Definition at line 220 of file simplecommandlineapp.cpp.

KexiDB::Connection * SimpleCommandLineApp::connection (  )  const

Returns:
connection object for this application or 0 if there is no properly opened connection.

Definition at line 225 of file simplecommandlineapp.cpp.


Member Data Documentation

Private* const KexiDB::SimpleCommandLineApp::d [protected]

for future extensions

Reimplemented from KexiDB::Object.

Definition at line 81 of file simplecommandlineapp.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys