CursorAdapter

From Lianjapedia
Jump to: navigation, search

Note: property, method and event names should be referred to in lowercase in case-sensitive scripting languages.

Properties

This class supports the Common Properties plus the following:

Property Access (R/RW) Value Description
Alias RW Character Alias name
AllowDelete RW Boolean Whether delete operations are allowed
AllowInsert RW Boolean Whether insert operations are allowed
AllowSimultaneousFetch RW Boolean Whether simultaneous fetch operations are allowed
AllowUpdate RW Boolean Whether update operations are allowed
AutoSync RW Boolean Whether cursor is refreshed automatically when you insert, delete or update records so that the local cursor and the remote data source are kept in sync, but still on the same row as before the INSERT, DELETE or UPDATE operation.
BatchUpdateCount RW Numeric Number of update statements sent
BreakOnError RW Boolean Whether errors break program execution
CompareMemo RW Boolean Whether memos are included in where update clauses
ConversionFunc RW Character Comma-separated list of field and function name pairs
CursorSchema RW Character Structure of the cursor
Database RW Character Database name
DataSource RW Character Source of data
DataSourceHost RW Character Hostname or IP for DataSource
DataSourceOptions RW Character Options string for DataSource
DataSourcePassword RW Character Password for DataSource
DataSourcePort RW Numeric Port number for DataSource
DataSourceType RW Character Type of the DataSource: "LOCAL" or "ODBC"
DataSourceUsername RW Character Username for DataSource
Dbtype R Character Database type, e.g. "MYSQL", "MSSQL"
DeleteCmd RW Character Delete command string
FetchAsNeeded RW Boolean Whether records are fetched as needed
FetchSize RW Numeric Number of rows fetched
Flags RW Numeric Flag settings
InsertCmd RW Character Insert command string
KeyFieldList RW Character Comma-separated list of primary fields
MaxRecords RW Numeric Maximum number of rows returned
NoData RW Boolean Whether cursoradapter should return no data
Prepared RW Boolean Whether to prepare SQL statements for subsequent requery
QuoteString RW Character Replacement string for single quote characters
SelectCmd RW Character Select command string
SendUpdates RW Boolean Whether to send an update query
Table RW Character Table name
Tables RW Character Comma-separated list of table names
UpdatableFieldList RW Character Comma-separated list of fields
TranslateName RW Boolean Whether to translate underscores in remote table names to a dot
UpdateCmd RW Character Update command string
UpdateNameList RW Character Comma-separated list of pairs of local and remote field names
UpdateType RW Numeric Type of update: 1 = update old data with new data, 2 = delete old data and insert new data
UseMemoSize RW Numeric Minimum size in bytes for returning a value as a memo field
WhereType RW Numeric Type of fields used for where clauses: 1 = KeyFieldList, 2 = KeyFieldList and updatable fields, 3 = KeyFieldList and modified fields, 4 = KeyFieldList and comparison of time stamps

Methods

This class supports the Common Methods plus the following:

Method Args Description
Cancel None Cancel transaction
clearNamedParameter None Clear all named parameters previously set using setNamedParameter(name,value). From v4.1.
Close None Close the DataSource
Commit None Commit transaction data changes
CursorFill None Fill the cursor based on SelectCmd
CursorRefresh None Refresh the cursor based on SelectCmd
Exec command as Character Execute the specified command
Open None Open the DataSource
queryBuilder dbtype as Character, columnlist as Character,
valuelist as character, datatypes as character,
operators as character
Build a database-specific condition string for use with the requery() method.
From v5.4. See example below.
Refresh None Refresh the cursor based on SelectCmd
Requery whereclause as Character Apply whereclause to SelectCmd and requery the cursor. Notes: if the SelectCmd does not have an existing WHERE clause, requery() appends 'WHERE ' plus the specified whereclause to the end of the statement. If the SelectCmd does have an existing WHERE clause, the requery() method replaces everything after the 'WHERE ' with the specified whereclause. Other clauses following the original WHERE clause, e.g. group by, should be included in the whereclause or they will be removed.
Rollback None Rollback transaction data changes
setNamedParameter name as Character, value as Character Set the specified named parameter to the specified value. This can be used to set {parameter} or ?parameter macros in virtual table definitions. From v4.1.
Sqlvalues selectstatement as Character Returns a comma separated list of values from the result of the singleton select SQL query specified in selectstatement.
Sync None Refresh the cursor to keep it in sync with the remote data source after an INSERT, DELETE or UPDATE operation while remaining on the same row.
Transaction None Begin transaction
Example querybuilder()
ca = new cursorAdapter()
? ca.queryBuilder("mssql", "territoryid,modifieddate,lower(msg)", "10,2020-10-31,hello world", "N,D,C", ">=,<=,=")
// Return value for MS SQL Server:
isnull(territoryid,0)>=10 and isnull(modifieddate,'')<='2020-10-31' and isnull(lower(msg),'')='hello world'

Events

This class supports the Common Events plus the following:

Event Args Description
afterCursorAttach alias as Character Occurs after cursoradapter is open
afterCursorClose alias as Character Occurs after cursoradapter is closed and after afterCursorDetach
afterCursorDetach alias as Character Occurs after cursoradapter is closed
afterCursorFill cursorSchema as Character Occurs after cursor is filled
afterCursorOpen alias as Character Occurs after cursoradapter is open and afterCursorAttach
afterCursorRefresh alias as Character, refreshed as Boolean Occurs after cursor is refreshed
afterCursorUpdate rows as Numeric, result as Boolean, error as Character Occurs after cursor is updated
afterDelete fieldstate as Character, force as Boolean, deleteCmd as Character, deleted as Boolean Occurs after delete operation is performed
afterInsert fieldstate as Character, force as Boolean, insertCmd as Character, inserted as Boolean Occurs after insert operation is performed
afterUpdate fieldstate as Character, force as Boolean, insertCmd as Character, inserted as Boolean Occurs after update operation is performed
beforeCursorAttach alias as Character Occurs before cursor is open and after beforeCursorOpen
beforeCursorClose alias as Character Occurs when close method is called
beforeCursorDetach alias as Character Occurs before cursoradapter is closed and after beforeCursorClose
beforeCursorFill cursorSchema as Character, noDataOnLoad as Boolean, selectCmd as Character Occurs before when cursorFill method is called
beforeCursorOpen alias as Character Occurs when open method is called
beforeCursorRefresh alias as Character Occurs when cursorRefresh method is called
beforeCursorUpdate rows as Numeric, force as Boolean Occurs before cursor is updated
beforeDelete fieldstate as Character, force as Boolean, deleteCmd as Character Occurs before delete operation is performed
beforeInsert fieldstate as Character, force as Boolean, deleteCmd as Character Occurs before insert operation is performed
beforeUpdate fieldstate as Character, force as Boolean, deleteCmd as Character Occurs before update operation is performed