RowSet Class Reference

RowSet. More...

#include <rowset.h>

List of all members.

Public Types

enum  Type {
  NoType = 0, Query = 1, Add = 2, Delete = 3,
  Edit = 4
}
 Rowset Types. More...

Public Member Functions

CategoryDef categoryDef () const
 Category Definition.
QString categoryName () const
 extended alias: Category Name
bool close ()
 Close the RowSet.
int colCount () const
 alias: Rowset Column Count
bool colInRange (int col) const
 extended: Quick Column Range Test
int columnCount () const
 Rowset Column Count.
bool columnIsBlank (int row, int column) const
 Check if Column is Blank.
int commit (int flags=0)
 Commit the changes to the database.
int currentSelection () const
 Current Row Selection.
Cursor cursor () const
 Originating Cursor.
int deleteRow ()
 Delete a Row.
int deleteRow (int row, int flags=0)
 Mark a row for deletion.
int firstCol () const
 Return the first column index.
int firstColumn () const
 Return the first row index.
int firstRow () const
 Return the first row index.
int getColumnIndex (const QString &col, int flags=0) const
 Get Column Index.
QString getColumnLabel (int col, int flags=0) const
 Get Column Label.
int getFieldToFile (int nRow, int nCol, const QString &filename, int flags=0) const
QString getRow (int nRow, const QString &pDelim, int flags=0) const
 Fetch an entire row.
bool getRowBool (int row, const QString &col) const
 extended: Get a Row Boolean by column name
bool getRowBool (const QString &col) const
 Get a Row Boolean.
bool getRowBool (int row, int col) const
 extended: Get a Row Boolean by column number
bool getRowBool (int col) const
 Get Default Row Boolean.
QString getRowGUID (int row) const
 extended: Read a GUID from a row
QString getRowGUID () const
 Get the Row GUID.
QString getRowID (int row, int flags=0) const
 Get a Row ID.
long getRowLong (int row, const QString &col) const
 extended: Get a Row Long by column name
long getRowLong (const QString &col) const
 Get a Row Long.
long getRowLong (int row, int col) const
 extended: Get a Row Long by column number
long getRowLong (int col) const
 Get a Row Long.
QString getRowString (int row, const QString &col) const
 extended: Get a Row String by column name
QString getRowString (int row, int col) const
 extended: Get a Row String by column number
QString getRowString (int col) const
 Get currentSelection Row String.
QString getRowTHID (int row) const
 Get the Row THID.
QString getRowTHID () const
 Get CurrentSelection Row ID.
QString getRowValue (int row, const QString &col) const
 extended: Get a Row Value (String) by column name
QString getRowValue (const QString &col) const
 Get a Row Value (String) on current row.
QString getRowValue (int row, int col, int flags=0) const
 Get a Row Value (String) by column number.
QString getRowValue (int col) const
 Get a Row Value (String) on current row.
QStringList getRowValueList (int row, int col1, int col2) const
 Get Value List from Two Columns.
QStringList getRowValueList (int row, const QString &col1, const QString &col2) const
 Alias with String Column.
QStringList getRowValueList (int row, int col) const
 Get the Row Value as a List.
QStringList getRowValueList (int row, const QString &col) const
 Alias with String Column.
QString getRowVar (int row, const QString &col, const QString &field) const
 Get a Row Var.
QString getRowVar (const QString &col, const QString &field) const
 Get a Row Var.
QString getRowVar (int row, int col, const QString &field) const
 Get Row Var.
bool getShared (int row) const
 Get the Shared status of a Row.
bool isDirty () const
 True when the rowset is dirty (needs a commit).
bool isValid () const
 RowSet Open.
int lastCol () const
 Return the last column index.
int lastColumn () const
 Return the last column index.
int lastRow () const
 Return the last row index.
int modifyRow (int row, const QString &col, const QString &varField, const QString &newVar)
 Modify a Row Var.
int modifyRow (const char *col, const QString &value)
 Modify Current Selection.
int modifyRow (int row, const QString &col, const QString &value, int flags=0)
 extended: Modify a Row String by column name
int modifyRow (int row, int col, const QString &value, int flags=0)
 Modify a Row String by column number.
int modifyVar (int row, int col, const QString &varField, const QString &newVar)
RowSet operator= (const RowSet &copy)
 Set Operator.
int rowCount () const
 Rowset Row Count.
bool rowInRange (int row) const
 extended: Quick Row Range Test
 RowSet (const RowSet &copy)
 Copy Constructor.
 RowSet (QObject *parent=0)
 Default Constructor.
void setCurrentSelection (int value)
 Set the current Row.
QString setRowGUID (int row)
 This sets a GUID on a Row.
bool setShared (int row)
 Make a row Shared.
bool setTimeStamp (int row)
 Set Row Time Stamp.
Type type () const
 extended: RowSet Type ID
QString typeName () const
 extended: RowSet Type Name
QString varValue (int row, int col, const QString &field) const
 Get a Var Value.
QString varValue (int col, const QString &field) const
 Get a Var Value.
QString varValue (int row, const QString &col, const QString &field) const
 Get a Var Value.
QString varValue (const QString &col, const QString &field) const
 Get a Var Value.

Static Public Member Functions

static QString typeName (Type type)
 extended: RowSet Type Name


Detailed Description

RowSet.

This is a generic RowSet object class that consolidates the functionality of all the four rowset object types (Query, Edit, Add, Delete).

Definition at line 74 of file rowset.h.


Member Enumeration Documentation

enum Type

Rowset Types.

A row set object is designated as being of a particular single type.

You can query for these row types by requesting type() on the rowset or if you prefer a string version of the rowset type, you can call typeName() with the type value requested.

There are four (valid) rowset Types:

Enumerator:
NoType  0 == No Type Definition. This will be set on invalid RowSet objects
Query  1 == Read-Only
Add  2 == Add-Only
Delete  3 == Read-Only plus Delete
Edit  4 == Read and Write existing

Definition at line 92 of file rowset.h.


Constructor & Destructor Documentation

RowSet ( QObject *  parent = 0  ) 

Default Constructor.

Definition at line 662 of file rowset.cpp.

RowSet ( const RowSet copy  ) 

Copy Constructor.

Definition at line 695 of file rowset.cpp.


Member Function Documentation

CategoryDef categoryDef (  )  const

Category Definition.

This returns a reference back to the category definition.

Definition at line 741 of file rowset.cpp.

QString categoryName (  )  const

extended alias: Category Name

This is a convenience function. I can never remember if the function I should be calling to get the category name should be name() or category() or categoryName(). This clarifies it for me. Anytime I'm referring to the name of a category, I can use categoryName()

Returns:
String value of Category Name

Definition at line 973 of file rowset.cpp.

bool close (  ) 

Close the RowSet.

This will close the RowSet object.

Definition at line 765 of file rowset.cpp.

int colCount (  )  const

alias: Rowset Column Count

This is just an alias for columnCount() because I like it when my source files all line up properly, and

 dim rowCount: rowCount = rs.rowCount()
 dim colCount: colCount = rs.colCount()

Looks better than

 dim rowCount: rowCount = rs.rowCount()
 dim columnCount: columnCount = rs.columnCount()

but, that's just me!

See also:
columnCount, rowCount
Returns:
Integer value of RowSet column count

Definition at line 908 of file rowset.cpp.

bool colInRange ( int  col  )  const

extended: Quick Column Range Test

This is a handy function for determining quickly if an index variable is within the column range of the rowset.

See also:
rowInRange, rowCount, columnCount, colCount
Returns:
bool True if index value is within range
Parameters:
col index value to be checked

Definition at line 949 of file rowset.cpp.

int columnCount (  )  const

Rowset Column Count.

The Column Count value returns the number of columns assigned to the cursor for this rowset. If no columns have been specifically assigned, then this value represents all the designed fields and connections.

See also:
colCount, rowCount
Returns:
Integer value of RowSet column count

Definition at line 877 of file rowset.cpp.

bool columnIsBlank ( int  row,
int  column 
) const

Check if Column is Blank.

This checks if the column value is blank or not.

Definition at line 2369 of file rowset.cpp.

int commit ( int  flags = 0  ) 

Commit the changes to the database.

Note:
Calling this function from a Query row set will generate an error.
Returns:
Integer ~ 0 on success, -1 on error
Parameters:
flags unused ~ defaults to zero

Definition at line 1923 of file rowset.cpp.

int currentSelection (  )  const

Current Row Selection.

Definition at line 1740 of file rowset.cpp.

Cursor cursor (  )  const

Originating Cursor.

This refers back to the cursor that created this RowSet object.

Definition at line 728 of file rowset.cpp.

int deleteRow (  ) 

Delete a Row.

Definition at line 2111 of file rowset.cpp.

int deleteRow ( int  row,
int  flags = 0 
)

Mark a row for deletion.

This function doesn't actually delete a row, but only marks it for deletion. You must call commit() in order to save the deleted items to disk. The procedure for deleting rows is as follows:

vbScript Example ~ Deleting Rows
 dim cursor: set cursor = dapp.db.getCursor("Person")
 cursor.setColumn "personKey"
 cursor.setFilter "[ViewFilter(1,F,,deleteMe,True)]"
 dim rs: set rs = cursor.getDeleteRowSet
 dim i: for i = rs.firstRow to rs.lastRow
   if( rs.deleteRow(i) = -1 ) then
     dexe.debug "Unable to delete: " & rs.getRowString(i,"personKey")
   end if
 next
 rs.commit
Note:
Calling this function from anything other than a "Delete" row set will generate an error.
See also:
commit
Returns:
Integer ~ 0 on success, -1 on error
Parameters:
row index ~ (firstRow <= row <= lastRow)
flags unused ~ defaults to zero

Definition at line 2093 of file rowset.cpp.

int firstCol (  )  const [inline]

Return the first column index.

In Commence, some object collections use zero based indexes, and some use one based indexes. Why try to remember? Use these functions instead.

See also:
firstColumn, firstRow, lastColumn, lastCol, lastRow
Returns:
0 (zero) ~ rowset columns are zero based

Definition at line 460 of file rowset.h.

int firstColumn (  )  const [inline]

Return the first row index.

In Commence, some object collections use zero based indexes, and some use one based indexes. Why try to remember? Use these functions instead.

See also:
firstCol, lastColumn, lastCol, firstRow, lastRow
Returns:
0 (zero) ~ rowset columns are zero based

Definition at line 447 of file rowset.h.

int firstRow (  )  const [inline]

Return the first row index.

In Commence, some object collections use zero based indexes, and some use one based indexes. Why try to remember? Use these functions instead.

See also:
firstColumn, firstCol, lastRow, lastColumn, lastCol
Returns:
0 (zero) ~ rowset rows are zero based

Definition at line 434 of file rowset.h.

int getColumnIndex ( const QString &  col,
int  flags = 0 
) const

Get Column Index.

This gets the index number of the requested column. If no matching column exists, a -1 is returned.

See also:
getColumnLabel
Returns:
Integer value of column index for label. -1 if label could not be found.
Parameters:
col name ~ text label of column
flags unused ~ defaults to zero

Definition at line 992 of file rowset.cpp.

QString getColumnLabel ( int  col,
int  flags = 0 
) const

Get Column Label.

This gets the label for a specific column. If the column specified is out of range, then this function returns an empty string.

See also:
getColumnIndex
Returns:
String value of column label for requested index
Parameters:
col index ~ column number
flags unused ~ defaults to zero

Definition at line 1017 of file rowset.cpp.

int getFieldToFile ( int  row,
int  col,
const QString &  filename,
int  flags = 0 
) const

/brief Get Field to File

This is a Commence function. I'm not really sure why you would want to read a field and write it to a file, but here it is.

Parameters:
row index ~ row number you want to fetch (0..rowCount()-1)
col index ~ (firstCol <= col <= lastCol)
filename file name you want the data to be written to
flags integer ~ flags, optional, unused, default always to zero

Definition at line 1039 of file rowset.cpp.

QString getRow ( int  row,
const QString &  delim,
int  flags = 0 
) const

Fetch an entire row.

This fetches an entire row from the rowset.

Parameters:
row index ~ row number you want to fetch (0..rowCount()-1)
delim string ~ delimiter between field values
flags integer ~ flags, optional, unused, default always to zero

Definition at line 1066 of file rowset.cpp.

bool getRowBool ( int  row,
const QString &  col 
) const

extended: Get a Row Boolean by column name

This reads a row value and converts it to a Boolean true/false. This is an important function since, in Commence, there are about three different versions of True and False, depending on the object type that you are reading. One is TRUE/FALSE for cursors and rowsets, another is Yes/No for connections, and yet another is... well... something else. I can't remember. This function makes uniform that user interface.

See also:
getRowBool( by column number )
Returns:
bool ~ True/False or row and column
Parameters:
row index ~ (firstRow <= row <= lastRow)
col name ~ text label of column

Definition at line 1368 of file rowset.cpp.

bool getRowBool ( const QString &  col  )  const

Get a Row Boolean.

Definition at line 1348 of file rowset.cpp.

bool getRowBool ( int  row,
int  col 
) const

extended: Get a Row Boolean by column number

This reads a row value and converts it to a Boolean true/false. This is an important function since, in Commence, there are about three different versions of True and False, depending on the object type that you are reading. One is TRUE/FALSE for cursors and rowsets, another is Yes/No for connections, and yet another is... well... something else. I can't remember. This function makes uniform that user interface.

See also:
getRowBool( by column name )
Returns:
bool ~ True/False of row and column
Parameters:
row index ~ (firstRow <= row <= lastRow)
col index ~ (firstCol <= col <= lastCol)

Definition at line 1332 of file rowset.cpp.

bool getRowBool ( int  col  )  const

Get Default Row Boolean.

This is a short-hand function that provides the default row.

Returns:
bool ~ True/False of row and column
Parameters:
col long ~ column number

Definition at line 1309 of file rowset.cpp.

QString getRowGUID ( int  row  )  const

extended: Read a GUID from a row

In order for this function to work properly, the category must be GUID ready. Refer to the secion thids for more information.

See also:
getRowID
Returns:
String GUID of row
Todo:
get GUID values working
Parameters:
row index ~ (firstRow <= row <= lastRow)

Definition at line 1217 of file rowset.cpp.

QString getRowGUID (  )  const

Get the Row GUID.

Definition at line 1246 of file rowset.cpp.

QString getRowID ( int  row,
int  flags = 0 
) const

Get a Row ID.

In order for this function to work properly, the rowset MUST be opened in USE_THIDS mode. If not, the results of this function are unpredictable. Refer to the secion thids for more information.

See also:
getRowGUID
Returns:
String THID of row
Parameters:
row index ~ (firstRow <= row <= lastRow)
flags unused ~ defaults to zero

Definition at line 1096 of file rowset.cpp.

long getRowLong ( int  row,
const QString &  col 
) const

extended: Get a Row Long by column name

Returns:
Integer value of row and column
Parameters:
row index ~ (firstRow <= row <= lastRow)
col name ~ text label of column

Definition at line 1427 of file rowset.cpp.

long getRowLong ( const QString &  col  )  const

Get a Row Long.

Definition at line 1415 of file rowset.cpp.

long getRowLong ( int  row,
int  col 
) const

extended: Get a Row Long by column number

Returns:
Integer value of row and column
Parameters:
row index ~ (firstRow <= row <= lastRow)
col index ~ (firstCol <= col <= lastCol)

Definition at line 1396 of file rowset.cpp.

long getRowLong ( int  col  )  const

Get a Row Long.

Definition at line 1384 of file rowset.cpp.

QString getRowString ( int  row,
const QString &  col 
) const

extended: Get a Row String by column name

Returns:
String value of row and column
Parameters:
row index ~ (firstRow <= row <= lastRow)
col name ~ text label of column

Definition at line 1291 of file rowset.cpp.

QString getRowString ( int  row,
int  col 
) const

extended: Get a Row String by column number

Returns:
String value of row and column
Parameters:
row index ~ (firstRow <= row <= lastRow)
col index ~ (firstCol <= col <= lastCol)

Definition at line 1258 of file rowset.cpp.

QString getRowString ( int  col  )  const

Get currentSelection Row String.

Definition at line 1274 of file rowset.cpp.

QString getRowTHID ( int  row  )  const

Get the Row THID.

Definition at line 1188 of file rowset.cpp.

QString getRowTHID (  )  const

Get CurrentSelection Row ID.

Definition at line 1198 of file rowset.cpp.

QString getRowValue ( int  row,
const QString &  col 
) const

extended: Get a Row Value (String) by column name

Returns:
String value of row and column
Parameters:
row index ~ (firstRow <= row <= lastRow)
col name ~ text label of column

Definition at line 1167 of file rowset.cpp.

QString getRowValue ( const QString &  col  )  const

Get a Row Value (String) on current row.

Returns:
String value of column
Parameters:
col column name

Definition at line 1152 of file rowset.cpp.

QString getRowValue ( int  row,
int  col,
int  flags = 0 
) const

Get a Row Value (String) by column number.

Returns:
String value of row and column
Parameters:
row index ~ (firstRow <= row <= lastRow)
col index ~ (firstCol <= col <= lastCol)
flags unused ~ defaults to zero

Definition at line 1116 of file rowset.cpp.

QString getRowValue ( int  col  )  const

Get a Row Value (String) on current row.

Returns:
String value of column
Parameters:
col index ~ (firstCol <= col <= lastCol)

Definition at line 1138 of file rowset.cpp.

QStringList getRowValueList ( int  row,
int  col1,
int  col2 
) const

Get Value List from Two Columns.

This is a slightly modified version of the GetRowValueList function call.

This function pulls a value-list based on the contents of two columns. The columns are, of course, assumed to be related columns. The result of related columns is that sometimes some of the rows will be blank.

What this function does is take the value list of the first column, and then combines it with the value list of the second column, leaving the first column as precedence. Any row values from the first column that are blank are replaced with values from the second column.

Where this gets used is when we are generating a list of items from two connected columns. The connected column list may include rows that are blank, and on those connected rows we want to substitute a value from another connection.

An example would be if we are pulling email addresses from two possible columns. The columns are "SMS" and "Email". What we want is the email address from the SMS column first, and if it is blank, then we want the email address from the Email column.

Definition at line 2322 of file rowset.cpp.

QStringList getRowValueList ( int  row,
const QString &  col1,
const QString &  col2 
) const

Alias with String Column.

Definition at line 2289 of file rowset.cpp.

QStringList getRowValueList ( int  row,
int  col 
) const

Get the Row Value as a List.

This function extracts a column of data and converts it into a string list. It is intended to be used on Related columns where the data is either separated by commas or by carriage returns.

The issue with Commence is that it will return a comma delimited list of items or a CrLf delimited list based upon its own discretion. To further complicate the issue the CfLf list will sometimes contain blank lines. Consider the following test:

How Commence Dumps Related Columns
 void ProcessCalendarDailyAlarms::runTask()
 "Thu Oct 6 15:07:00 2011"        "HP Oscilloscope"
   Al "5-minute, 1-hour, Beginning of Day, Day Prior, 30-minute, Two Days Prior, Email Read Staff"
   pR "1215555075@mms.att.net"
   pW "1215555075@mms.att.net"
   At ""
 "Fri Oct 7 11:00:00 2011"        "test alarm"
   Al "Beginning of Day, Day Prior, Two Days Prior, On Time, Email Read Staff"
   pR "1215550336@mms.att.net
 1215555075@mms.att.net"
   pW "1215555075@mms.att.net"
   At "sonofabarber@yahoo.com
 mikey.brakeley@bonnie.org            Comma Delimited List -+
 tadpole@pinrgconst.com                                      \
 MyEmailAddress@aol.com                                       \
 "                                                             \
 "Sun Oct 9 13:00:00 2011"        "Ives Game Day"               V
   Al "Beginning of Week, Beginning of Day, Day Prior, 30-minute, Two Days Prior, Email Read Staff"
   pR "1215550336@mms.att.net
 1215555075@mms.att.net"
   pW "1215550336@mms.att.net
 1215555075@mms.att.net"
   At ""
 "Sun Oct 9 16:00:00 2011"        "Jets: Montreal  @  Winnipeg"
   Al "5-minute, Email Attendees, Beginning of Week, Beginning of Day, Email Write Staff, Email Read Staff"
   pR "1215550336@mms.att.net
 1215555075@mms.att.net"
   pW "1215550336@mms.att.net
 1215555075@mms.att.net"
   At ""
 "Sun Oct 9 16:00:00 2011"        "pick carolyn up from airport"
   Al "1-hour, Email Attendees, Beginning of Week, Beginning of Day, Day Prior, 2-hour, On Time, Email Write Staff, Email Read Staff"
   pR "1215550336@mms.att.net
                              <--- blank line inserted here
 1215555075@mms.att.net
 "
   pW "1215550336@mms.att.net
                              <--- blank line inserted here
 1215555075@mms.att.net
 "
   At "sonofabarber@yahoo.com
 mikey.brakeley@bonnie.org
 MyEmailAddress@aol.com"
Note the presense of blanks lines, and comma delimited lists. All of the Related Category lists were generated by the same call to GetRowValue().

The same code calling into GetRowValueList will return the following result:

Related Columns Cleaned Up
 void ProcessCalendarDailyAlarms::runTask()
 "Thu Oct 6 15:07:00 2011"        "HP Oscilloscope"
   Al ("5-minute", "1-hour", "Beginning of Day", "Day Prior", "30-minute", "Two Days Prior", "Email Read Staff")
   pR ("1215555075@mms.att.net")
   pW ("1215555075@mms.att.net")
   At ()
 "Fri Oct 7 11:00:00 2011"        "test alarm"
   Al ("Beginning of Day", "Day Prior", "Two Days Prior", "On Time", "Email Read Staff")
   pR ("1215550336@mms.att.net", "1215555075@mms.att.net")
   pW ("1215555075@mms.att.net")
   At ("sonofabarber@yahoo.com", "mikey.brakeley@bonnie.org", "tadpole@pinrgconst.com", "MyEmailAddress@aol.com")
 "Sun Oct 9 13:00:00 2011"        "Ives Game Day"
   Al ("Beginning of Week", "Beginning of Day", "Day Prior", "30-minute", "Two Days Prior", "Email Read Staff")
   pR ("1215550336@mms.att.net", "1215555075@mms.att.net")
   pW ("1215550336@mms.att.net", "1215555075@mms.att.net")
   At ()
 "Sun Oct 9 16:00:00 2011"        "Jets: Montreal  @  Winnipeg"
   Al ("5-minute", "Email Attendees", "Beginning of Week", "Beginning of Day", "Email Write Staff", "Email Read Staff")
   pR ("1215550336@mms.att.net", "1215555075@mms.att.net")
   pW ("1215550336@mms.att.net", "1215555075@mms.att.net")
   At ()
 "Sun Oct 9 16:00:00 2011"        "pick carolyn up from airport"
   Al ("1-hour", "Email Attendees", "Beginning of Week", "Beginning of Day", "Day Prior", "2-hour", "On Time", "Email Write Staff", "Email Read Staff")
   pR ("1215550336@mms.att.net", "1215555075@mms.att.net")
   pW ("1215550336@mms.att.net", "1215555075@mms.att.net")
   At ("sonofabarber@yahoo.com", "mikey.brakeley@bonnie.org", "MyEmailAddress@aol.com")
As you can see, the result is a String List filled with only items from the connection field.

Note:
This function is not guaranteed to produce reliable results. You should always check your data to insure you're getting what you can expect. Connected items that contain commas are likely to screw this routine up!

Definition at line 2256 of file rowset.cpp.

QStringList getRowValueList ( int  row,
const QString &  col 
) const

Alias with String Column.

Definition at line 2280 of file rowset.cpp.

QString getRowVar ( int  row,
const QString &  col,
const QString &  field 
) const

Get a Row Var.

Definition at line 1452 of file rowset.cpp.

QString getRowVar ( const QString &  col,
const QString &  field 
) const

Get a Row Var.

Definition at line 1442 of file rowset.cpp.

QString getRowVar ( int  row,
int  col,
const QString &  field 
) const

Get Row Var.

This gets a var value from a column

Definition at line 1464 of file rowset.cpp.

bool getShared ( int  row  )  const

Get the Shared status of a Row.

Definition at line 1907 of file rowset.cpp.

bool isDirty (  )  const

True when the rowset is dirty (needs a commit).

See also:
commit

Definition at line 1727 of file rowset.cpp.

bool isValid (  )  const

RowSet Open.

This returns true if the RowSet object is open

Definition at line 752 of file rowset.cpp.

int lastCol (  )  const

Return the last column index.

This is an alias for lastColumn().

vbScript Example ~ Using lastCol
 dim i: for i = rs.firstCol to rs.lastCol
   dexe.debug rs.getRowValue(0,i)
 next
See also:
lastRow, lasColumn, firstColumn, firstCol, firstRow
Returns:
lastColumn()

Definition at line 1717 of file rowset.cpp.

int lastColumn (  )  const

Return the last column index.

This function returns the columnCount() - 1 value. It is used to make for/next loops look a little cleaner:

vbScript Example ~ Using lastColumn
 dim i: for i = rs.firstColumn to rs.lastColumn
   dexe.debug rs.getRowValue(0,i)
 next
See also:
lastRow, lastCol, firstRow, firstColumn, firstCol
Returns:
columnCount - 1

Definition at line 1696 of file rowset.cpp.

int lastRow (  )  const

Return the last row index.

This function returns the rowCount() - 1 value. It is used to make for/next loops look a little cleaner:

vbScript Example ~ Using lastRow
 dim i: for i = rs.firstRow to rs.lastRow
   dexe.debug rs.getRowValue(i,0)
 next
See also:
lastColumn, lastCol, firstRow, firstColumn, firstCol
Returns:
rowCount() - 1

Definition at line 1674 of file rowset.cpp.

int modifyRow ( int  row,
const QString &  col,
const QString &  varField,
const QString &  newVar 
) [inline]

Modify a Row Var.

This will modify a row var value.

Definition at line 412 of file rowset.h.

int modifyRow ( const char *  col,
const QString &  value 
) [inline]

Modify Current Selection.

Modify the row value by the current row selection.

Definition at line 302 of file rowset.h.

int modifyRow ( int  row,
const QString &  col,
const QString &  value,
int  flags = 0 
) [inline]

extended: Modify a Row String by column name

Note:
Calling this function from a rowset other than Add or Edit row set will generate an error.
Returns:
Integer ~ 0 on success, -1 on error
Parameters:
row index ~ (firstRow <= row <= lastRow)
col name ~ text label of column
value string value
flags optional ~ defaults to zero.

Definition at line 265 of file rowset.h.

int modifyRow ( int  row,
int  col,
const QString &  value,
int  flags = 0 
)

Modify a Row String by column number.

Note:
Calling this function from a rowset other than Add or Edit row set will generate an error.
Attention:
There appears to be a bug within Commence regarding this function. While it has been demonstrated as being possible to make a connection setting using this function, internally Commence appears to be generating an error-code result. Flag options have been provided with this wrapper to override the regular error reporting, but I am still uncertain if this is an error within Commence (that it's generating an error on call) or if Commence is not suppose to be allowing connections to be made from the cursor.rowset.modifyRow function.
vbScript Example ~ Setting Related Columns
 cursor.setRelatedColumn "Attendee", "Contacts", "Contact Name"
 dim rs: set rs = cursor.getEditRowSet

 '
 ' This resets all the assigned staff persons on the docket
 '
 dim i: for i = rs.firstRow to rs.lastRow
   rs.modifyRow i, 0, "" ' clear the connection
   dim j: for j = 0 To UBound(staff) - 1
     rs.modifyRow i, 0, staff(j), 2 ' note: (2) cmcRowSet override (hide errors)
   next
 next
 rs.commit
The preceeding code actually works, and it does not generate any errors, and the connections are reassigned as expected. However, if the (2) cmcRowSet override had not been applied the user would be looking at a handful of error messages.
Here is an example of the output of error codes the user would see if he did not override the error handling:
Error Messages when setting related columns
 FAILED(8000001f): modifyRow(category='Calendar', row=0, col=0 'Attendee Contacts Contact Name', buf='Tom', flags=0)
 FAILED(8000001f): modifyRow(category='Calendar', row=0, col=0 'Attendee Contacts Contact Name', buf='Dick', flags=0)
 FAILED(8000001f): modifyRow(category='Calendar', row=0, col=0 'Attendee Contacts Contact Name', buf='Harry', flags=0)
 FAILED(8000001f): modifyRow(category='Calendar', row=1, col=0 'Attendee Contacts Contact Name', buf='Tom', flags=0)
 FAILED(8000001f): modifyRow(category='Calendar', row=1, col=0 'Attendee Contacts Contact Name', buf='Dick', flags=0)
 FAILED(8000001f): modifyRow(category='Calendar', row=1, col=0 'Attendee Contacts Contact Name', buf='Harry', flags=0)
As it turns out, the "bug" can be attributed to opening the cursor in USE_THIDS mode. When opened in this mode, setting connections must be performed using THID values rather than categoryKey values.
Returns:
Integer ~ 0 on success, -1 on error
Parameters:
row index ~ (firstRow <= row <= lastRow)
col index ~ (firstCol <= col <= lastCol)
value string value
flags optional ~ defaults to zero.
  • flags=1 causes this function to check the current value of the row before applying the modification.
  • flags=2 causes this function to ignore return error codes from Commence

Definition at line 2002 of file rowset.cpp.

int modifyVar ( int  row,
int  col,
const QString &  varField,
const QString &  newVar 
)

Parameters:
row index ~ (firstRow <= row <= lastRow)
col index ~ (firstCol <= col <= lastCol)
varField string ~ var field name
newVar string value

Definition at line 2028 of file rowset.cpp.

RowSet operator= ( const RowSet copy  ) 

Set Operator.

Definition at line 706 of file rowset.cpp.

int rowCount (  )  const

Rowset Row Count.

The Row Count value returns the number of rows requested for this rowset object when it was requested. This may not necessarily be the same number of rows that the hosting cursor contains.

See also:
columnCount, colCount
Returns:
Integer value of RowSet item count

Definition at line 859 of file rowset.cpp.

bool rowInRange ( int  row  )  const

extended: Quick Row Range Test

This is a handy function for determining quickly if an index variable is within the row range of the rowset.

See also:
colInRange, rowCount, columnCount, colCount
Returns:
bool True if index value is within range
Parameters:
row index value to be checked

Definition at line 924 of file rowset.cpp.

void setCurrentSelection ( int  value  )  [inline]

Set the current Row.

Definition at line 481 of file rowset.h.

QString setRowGUID ( int  row  ) 

This sets a GUID on a Row.

Definition at line 1577 of file rowset.cpp.

bool setShared ( int  row  ) 

Make a row Shared.

Definition at line 2057 of file rowset.cpp.

bool setTimeStamp ( int  row  ) 

Set Row Time Stamp.

In cases where the category has been set up with a Var field, the RowSet object can be used to set Item Time Stamp values automatically.

Time Stamp Field Values
 guid={8ef74624-c1b3-4adc-9d07-cc48602b40fd}
 cmcID=1:80006501:C2A36867
 createdOn=20120207135208
 createdBy=MWP
 changedOn=20120207135208
 changedBy=MWP
Subsequent calls to setTimeStamp cause only the changedOn and changedBy field values to be updated.

Note:
For this procedure to work properly, as it pertains to storing THID values in the Var field, the Cursor must be opened in a mode to allow THIDs to be read, ~and~ the Var field must be exposed to the RowSet.
Returns:
true ~ if the row can be stamped
Parameters:
row integer ~ row to be stamped

Definition at line 1803 of file rowset.cpp.

RowSet::Type type (  )  const

extended: RowSet Type ID

This returns a type number for the type of RowSet object implemented here. This single RowSet class handles the interface for any one of the four rowset types and different functions are available depending on the type of rowset created. This type variable determines that functionality.

vbScript Example ~ Reading the RowSet Type
 if( rs.type = 2 ) then
   dexe.debug "this is an ADD rowset"
 end if
Note:
This is mostly an internal function
See also:
Type, typeName
Returns:
Integer value of RowSet type

Definition at line 793 of file rowset.cpp.

QString typeName (  )  const

extended: RowSet Type Name

See also:
Type, type
Returns:
String value of current RowSet Type

Definition at line 843 of file rowset.cpp.

QString typeName ( RowSet::Type  type  )  [static]

extended: RowSet Type Name

This function is used to convert a rowset-type-code into a string value. It is used when building the request for Commence since Commence requires a string-type request for the API.

vbScript Example ~ Making a RowSet Type String Message
 dexe.debug "Get" & rs.typeName(2) & "RowSetByID"
 ' result: "GetAddRowSetByID"
Note:
This is mostly an internal function
See also:
Type, type
Returns:
String value of RowSet Type

Definition at line 819 of file rowset.cpp.

QString varValue ( int  row,
int  col,
const QString &  field 
) const

Get a Var Value.

Definition at line 1478 of file rowset.cpp.

QString varValue ( int  col,
const QString &  field 
) const

Get a Var Value.

Definition at line 1498 of file rowset.cpp.

QString varValue ( int  row,
const QString &  col,
const QString &  field 
) const

Get a Var Value.

Definition at line 1488 of file rowset.cpp.

QString varValue ( const QString &  col,
const QString &  field 
) const

Get a Var Value.

Definition at line 1508 of file rowset.cpp.


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