KDbSimpleCommandLineApp

Search for usage in LXR

KDbSimpleCommandLineApp Class Reference

#include <KDbSimpleCommandLineApp.h>

Inheritance diagram for KDbSimpleCommandLineApp:

Public Member Functions

 KDbSimpleCommandLineApp (int argc, char **argv, const KCmdLineOptions &options, const char *programName, const char *version, const char *shortDescription=0, KAboutData::LicenseKey licenseType=KAboutData::License_Unknown, const char *copyrightStatement=0, const char *text=0, const char *homePageAddress=0, const char *bugsEmailAddress="submit@bugs.kde.org")
 
bool closeDatabase ()
 
const KComponentData & componentData () const
 
KDbConnectionconnection () const
 
KDbConnectionDataconnectionData () const
 
bool openDatabase (const QString &databaseName)
 
- Public Member Functions inherited from KDbObject
 KDbObject (int type)
 
QString captionOrName () const
 

Protected Attributes

Private *const d
 

Additional Inherited Members

- Public Attributes inherited from KDbObject
QString caption
 
QString description
 
int id
 
QString name
 
int type
 
- Protected Member Functions inherited from KDbObject
virtual void clear ()
 

Detailed Description

A skeleton for creating a simple command line database application.

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

  • –driver <id> (Database driver ID) 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 KDb-compatible database using command line arguments, do some data processing and close the database.

Definition at line 44 of file KDbSimpleCommandLineApp.h.

Constructor & Destructor Documentation

◆ KDbSimpleCommandLineApp()

KDbSimpleCommandLineApp::KDbSimpleCommandLineApp ( int argc,
char ** argv,
const KCmdLineOptions & options,
const char * programName,
const char * version,
const char * shortDescription = 0,
KAboutData::LicenseKey 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 55 of file KDbSimpleCommandLineApp.cpp.

◆ ~KDbSimpleCommandLineApp()

KDbSimpleCommandLineApp::~KDbSimpleCommandLineApp ( )

Definition at line 115 of file KDbSimpleCommandLineApp.cpp.

Member Function Documentation

◆ closeDatabase()

bool KDbSimpleCommandLineApp::closeDatabase ( )

Closes database connection previously opened using openDatabase()

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

Definition at line 168 of file KDbSimpleCommandLineApp.cpp.

◆ componentData()

const KComponentData & KDbSimpleCommandLineApp::componentData ( ) const
Returns
program instance

Definition at line 179 of file KDbSimpleCommandLineApp.cpp.

◆ connection()

KDbConnection * KDbSimpleCommandLineApp::connection ( ) const
Returns
connection object for this application or 0 if there is no properly opened connection.

Definition at line 189 of file KDbSimpleCommandLineApp.cpp.

◆ connectionData()

KDbConnectionData * KDbSimpleCommandLineApp::connectionData ( ) const
Returns
connection data for this application.

Definition at line 184 of file KDbSimpleCommandLineApp.cpp.

◆ openDatabase()

bool KDbSimpleCommandLineApp::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 KDbObject methods to get status of the operation on failure.

Definition at line 121 of file KDbSimpleCommandLineApp.cpp.

Member Data Documentation

◆ d

Private* const KDbSimpleCommandLineApp::d
protected

Definition at line 82 of file KDbSimpleCommandLineApp.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.