Database Class Reference

Commence Database Wrapper. More...

#include <database.h>

Inherited by Database.

List of all members.

Public Slots

QString backup (int index) const
 Backup String.
bool checkOutAllFormScripts () const
 CheckOut All Form Scripts.
bool close ()
 Close the connection.
CommenceAPI::CommenceDB * getCommenceDB () const
 Return Originating Server object pointer.
bool isValid () const
 Is Database Instance Valid.
QDate naturalDate (const QString &dateExpression) const
 Natural Date.
QTime naturalTime (const QString &timeExpression) const
 Natural Time.
bool open (IDispatch *dispatch)
 Open a Database Instance.
bool open (const QString &dbName="")
 Open the Database Instance.
bool updateCommonCode ()
 Update Common Code.

Public Member Functions

Conversation cv () const
 Get a Conversation Object (enhanced).
CategoryDef getCategoryDef (const QString &catName) const
 Get a Category Definition.
Conversation getConversation (const QString &applicationName="Commence", const QString &topic="GetData") const
 Get a Conversation object.
Cursor getCursor (const QString &categoryName, const QString &filter, Cursor::Flag flag=Cursor::NoFlags) const
 Get a Pre-filtered Cursor.
Cursor getCursor (const QString &categoryName, Cursor::Flag flag=Cursor::NoFlags) const
 extended: Get a Cursor Object
Cursor getCursor (Cursor::Mode mode, const QString &categoryName, Cursor::Flag flag=Cursor::NoFlags) const
 Get a Cursor Object.
QString getIniFilename () const
 Dumont.ini File Name.
UserInfo getMeInfo () const
 Me/User Info.
void rstDumontCategoryName ()
 Reset Dumont Category Name.
void setDumontCategoryName (const QString &name)
 Set Dumont Category Name.

Properties

QString dumontCategoryName
 Dumont Category Name.
bool isClient
 Is Client.
bool isServer
 Is Server.
QString myDumontIniName
 Return Dumont.INI item name.
QString name
 Database Name.
QString path
 Database Path.
QString registeredUser
 Registered User.
int serverId
 Server ID.
bool shared
 Shared.
int sharedDbId
 Shared DB ID.
int shareDefault
 Share Default.
int syncFiles
 Sync Files.
int syncValid
 Sync Valid.
QString version
 Commence Version.
QString versionExt
 Commence Version Extended.
int workgroupEnable
 data.ini Workgroup/Enable flag
int workgroupNumEntries
 Number of Workgroup Entries.


Detailed Description

Commence Database Wrapper.

This object wraps the CommenceDB object.

Definition at line 76 of file database.h.


Member Function Documentation

QString backup ( int  index  )  const [slot]

Backup String.

Definition at line 991 of file database.cpp.

bool checkOutAllFormScripts (  )  const [slot]

CheckOut All Form Scripts.

This will check out all form scripts into the database directory under the location db\Dumont.

Definition at line 849 of file database.cpp.

bool close (  )  [slot]

Close the connection.

Definition at line 651 of file database.cpp.

Conversation cv (  )  const

Get a Conversation Object (enhanced).

This is a slight extension to the getConversation command. The call is shorter thus making the application programs a bit more readable, and it allows for no parameter values. The conversation values supplied are "Commence" for the application name and Database.path() for the DDE topic. The result of this call is a DDE Conversation object that is connected to the correct database in the instance that there are more than one Commence database running.

Accessing DDE with original call
 Database cmcdb;
 qDebug()
   << "available tables:"
   cmdb.getConversation("Commence",cmdb.path()).getCategoryNames()
   ;
A simplified version of a DDE call
 Database cmcdb;
 qDebug()
   << "available tables:"
   cmdb.cv().getCategoryNames()
   ;
As you can see the second version has a much simpler interface, easier to remember, easier to read.

Returns:
Conversation object
See also:
getConversation

Definition at line 1124 of file database.cpp.

CategoryDef getCategoryDef ( const QString &  catName  )  const

Get a Category Definition.

Definition at line 1243 of file database.cpp.

CommenceAPI::CommenceDB * getCommenceDB (  )  const [slot]

Return Originating Server object pointer.

This returns a pointer to the originating server object. This pointer .is. the actual CommenceDB object. It can be used in instances where direct communication with the server is desired. Note that use of this pointer bypasses all wrapper functions.

Definition at line 667 of file database.cpp.

Conversation getConversation ( const QString &  appName = "Commence",
const QString &  topic = "GetData" 
) const

Get a Conversation object.

This API is identical to the CommenceDB.getConversation API. It returns a Conversation object wrapper based upon the application name and DDE topic provided. By default the application name value is "Commence" and the topic value is "GetData". However, it is a good idea to set the topic value to the path of the open database. This insures that a DDE connection to the correct database is provided, in the event that there is more than one Commence database open.

Returns:
Conversation object
See also:
cv
Parameters:
appName String ~ application name; defaults to "Commence"
topic String ~ DDE topic; defaults to "GetData" but should be set to Database.path() to insure connection to the correct database.

Definition at line 1070 of file database.cpp.

Cursor getCursor ( const QString &  categoryName,
const QString &  filter,
Cursor::Flag  flag = Cursor::NoFlags 
) const

Get a Pre-filtered Cursor.

This extended call returns a cursor with a filter pre-applied. This is handy in situations where you know the category name is good, and you know the filter is likely to succeed and you just want to quickly acquire a cursor object without a bunch of hassle and code.

 Cursor cursor = cmdb.getCursor("Person","1,F,,First Name,Equal to,\"Deepak\"");

You can even go so far as to immediately request a RowSet object as well.

 RowSet rowSet = cmdb.getCursor("Person","1,F,,First Name,Equal to,\"Deepak\"").getQueryRowSet();
 if( !rowSet.isValid() )
   return("could not acquire a proper rowset");

Definition at line 1222 of file database.cpp.

Cursor getCursor ( const QString &  categoryName,
Cursor::Flag  flag = Cursor::NoFlags 
) const

extended: Get a Cursor Object

This is a simplified version of the Get Cursor function. This function assumes a cursor 'mode' zero, which opens a cursor on the category directly, and not on one of the views or pilot categories.

Example ~ simplified method of opening a cursor
 Database cmdb;
 Cursor cursor = cmdb.getCursor("Person")
See also:
getCursor( original )
Returns:
cmcCursor object
Parameters:
categoryName String ~ must be an existing category name
flag CursorFlag ~ defaults to NoFlag

Definition at line 1188 of file database.cpp.

Cursor getCursor ( Cursor::Mode  mode,
const QString &  categoryName,
Cursor::Flag  flag = Cursor::NoFlags 
) const

Get a Cursor Object.

This is the original version of the Get Cursor function. This function accepts the cursor mode just like the original Commence version. The flags parameter is not required.

vbScript Example ~ original (code compatible) method of opening a cursor
 dim dexe: set dexe = createObject("Dumont.EXE") ' hook dumont
 dim dapp: set dapp = dexe.applications("MyDB")  ' fetch an app from the R.O.T.

 '
 ' get a cursor the 'old fashioned' way.  Specify the 'mode' and 'flags'
 '
 dim cursor: set cursor = dapp.db.getCursor(0,"Person",0)
See also:
getCursor( simplified )

Cursor Modes

Returns:
Cursor object
Parameters:
mode int ~ see: Cursor Modes
categoryName String ~ must be an existing category name
flag int ~ defaults to 0

Definition at line 1154 of file database.cpp.

QString getIniFilename (  )  const

Dumont.ini File Name.

This value holds the location and name of the dumont .ini file name. The purpose of the .ini file is to maintain the set of start-up parameters for the Dumont API.

Definition at line 864 of file database.cpp.

UserInfo getMeInfo (  )  const

Me/User Info.

Definition at line 1254 of file database.cpp.

bool isValid (  )  const [slot]

Is Database Instance Valid.

This returns .true. if this database instance holds a valid pointer to a CommenceDB server.

Definition at line 593 of file database.cpp.

QDate naturalDate ( const QString &  dateExpression  )  const [slot]

Natural Date.

Definition at line 1025 of file database.cpp.

QTime naturalTime ( const QString &  timeExpression  )  const [slot]

Natural Time.

Definition at line 1046 of file database.cpp.

bool open ( IDispatch *  dispatch  )  [slot]

Open a Database Instance.

This function acts as a direct wrapper.

Note:
dont use this yet, i don't know if it works.

Definition at line 635 of file database.cpp.

bool open ( const QString &  dbName = ""  )  [slot]

Open the Database Instance.

This opens a connection to a CommenceDB database server. This function will only open the connection if the connection is presently closed.

If the dbName parameter is left blank, then any database will be opened. Otherwise, if the database name does not match the name of the parameter value provided, then the open operation will close the connection and return false.

Parameters:
dbName (optional) ~ Name as it is registered in the Database|Open function of Commence.

Definition at line 613 of file database.cpp.

void rstDumontCategoryName (  ) 

Reset Dumont Category Name.

This function will scan the database and attempt to detect the category that is to be used for Dumont functions.

The dumont category is a category that contains the following attributes;

o the category name has Dumont in it o it does not allow for duplicate items o it contains the following field structure;

  • a ~name~ field
  • a ~memo~ field called "Value" o it can optionally contain the following fields;
  • number("Build")
  • date("Date")
  • memo("Description")
  • memo("dumontVar")
  • number("Length")
  • checkBox("online")
  • text("Parameters",250)
  • memo("Result")
  • checkBox("Run from Disk")
  • text("Script",80)

Definition at line 807 of file database.cpp.

void setDumontCategoryName ( const QString &  name  ) 

Set Dumont Category Name.

This sets the name of the Dumont category.

Definition at line 772 of file database.cpp.

bool updateCommonCode (  )  [slot]

Update Common Code.

This is a utility function that is designed to loop through entries in the Dumont category that are considered to be common code scripts, and locates them throughout the database and updates them.

Definition at line 894 of file database.cpp.


Property Documentation

QString dumontCategoryName [read, write]

Dumont Category Name.

This returns the name that is assigned as the Dumont category.

Definition at line 86 of file database.h.

bool isClient [read]

Is Client.

Returns TRUE if this application is a CLIENT database

Definition at line 94 of file database.h.

bool isServer [read]

Is Server.

Returns TRUE if this application is a SERVER database

Definition at line 93 of file database.h.

QString myDumontIniName [read]

Return Dumont.INI item name.

This function returns the Dumont item name associated with this user. The dumont item name consists of "dumont" followed by (usually) the three letter abbreviation of the Commence user followed by ".ini". This item name is then used to pull user-specific dumont values.

Result Examples:
 dumontMWP.ini
 dumontLMP.ini
Usage Example:
  Database cmdb;
  cmdb.open("mydb");
  cmdb.cv().editItem( "sy.Dumont", cmdb.myDumontIniName(), "Value", "new value" );

Definition at line 87 of file database.h.

QString name [read]

Database Name.

Definition at line 80 of file database.h.

QString path [read]

Database Path.

Definition at line 81 of file database.h.

QString registeredUser [read]

Registered User.

Definition at line 82 of file database.h.

int serverId [read]

Server ID.

Definition at line 96 of file database.h.

bool shared [read]

Shared.

Definition at line 83 of file database.h.

int sharedDbId [read]

Shared DB ID.

Definition at line 90 of file database.h.

int shareDefault [read]

Share Default.

Definition at line 92 of file database.h.

int syncFiles [read]

Sync Files.

Definition at line 91 of file database.h.

int syncValid [read]

Sync Valid.

Definition at line 97 of file database.h.

QString version [read]

Commence Version.

Definition at line 84 of file database.h.

QString versionExt [read]

Commence Version Extended.

Definition at line 85 of file database.h.

int workgroupEnable [read]

data.ini Workgroup/Enable flag

Definition at line 89 of file database.h.

int workgroupNumEntries [read]

Number of Workgroup Entries.

Definition at line 95 of file database.h.


The documentation for this class was generated from the following files:




~ ~ ~ ~ ~ ~
Source Code without Comments is like a Cranberry Garland
without the berries. Comment your Code!
 
Commence Database Support User Group Forum
http://newsgroup.showoff-db.org/
~ ~ ~ ~ ~ ~
Author: Mark Petryk
Lorimark Solutions, LLC
mark@lorimarksolutions.com