public class SQLDataSource extends BasicDataSource implements RPCManagerCompletionCallback
` SmartClient Server's SQL support is mature, feature-rich and very customizable. See the client reference documentation for details of configuring and using SQL DataSources - search for "sqlDataSource". For a wider general discussion of data integration options with SmartClient Server, search the client documentation for "serverDataIntegration"
|Modifier and Type||Method and Description|
| || |
Executes an array of DSRequests in a single JDBC
| || |
Convenience implementation of
| || |
Returns the text of the generated SQL we will use to implement a clause of the supplied type for the supplied DSRequest.
getAuditDataSource, getProperty, shouldAutoJoinTransaction, shouldAutoStartTransaction, transformMultipleFields, transformMultipleFields
add, addDynamicDSGenerator, addDynamicDSGenerator, addDynamicDSGenerator, clearDynamicDSGenerators, execute, executeAdd, executeClientExport, executeCustom, executeFetch, executeFileSource, executeRemove, executeUpdate, fetch, fetch, fetchById, fetchSingle, fetchSingle, filter, filter, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, fromXML, getAuditRevisionFieldName, getAuditTimestampFieldName, getAuditTypeFieldName, getAuditUserFieldName, getDefaultDynamicDSGenerator, getDynamicDSGenerators, getEnumConstantProperty, getEnumOrdinalProperty, getEnumTranslateStrategy, getField, getFieldNames, getFile, getFileAsInputStream, getFileAsString, getFileContentsField, getFileFormatField, getFileNameField, getFileTypeField, getListProperties, getListProperties, getPrimaryKey, getProperties, getProperties, getProperties, getPropertyJavaClass, getRecordXPath, getTransactionObject, getTransactionObject, hasFile, hasRecord, hasRecord, initialized, isModificationOperation, isServerOnly, listFiles, listFiles, remove, removeDynamicDSGenerator, removeDynamicDSGenerator, removeDynamicDSGenerator, removeFile, renameFile, saveFile, setEnumConstantProperty, setEnumOrdinalProperty, setEnumTranslateStrategy, setProperties, update, validate
public static java.lang.String getSQLClause(SQLClauseType type, DSRequest dsRequest) throws java.lang.Exception
$defaultXxxxxClauseVelocity variable that you can use when developing your own
customSQLqueries. Clauses consist of just the variable part and exclude the SQL keywords. The one exception to this is the special clause type "All"; if you specify this clause type, we return a full-formed SQL query suitable for passing straight to the executeQuery() or executeUpdate() method of a JDBC driver or equivalent.
Note that we ordinarily generate SQL that is self-contained and context-free, so you can store the clauses that this API returns and use them to construct a query for later execution without any dependence on the DSRequest. However, we are not always able to do this; binary columns and CLOBs cannot be assigned inline, so we have to generate SQL containing '?' markers, which can only be executed as parameterized queries. This in turn means that you need to store the values of any such fields in order to provide them as parameters when you come to execute the query.
Also note that the query clauses produced by SQLDataSource are database-specific and will only work if run against the same database product they were generated for.
clauseType- The type of clause to generate and return
dsRequest- The DSRequest embodying the fetch or update operation
clauseTypefor the supplied
public static java.util.List executeAsBatch(java.util.List dsRequests) throws java.lang.Exception
SQLDataSource.executeAsBatch(DSRequest), if you prefer to pass and return Lists instead of arrays.
dsRequests- List of DSRequests to execute as a batch
public static int executeAsBatch(DSRequest dsRequests) throws java.lang.Exception
java.sql.Statement.executeBatch()call. The implementation builds up the batch by calling
SQLDataSource.getSQLClause(SQLClauseType,DSRequest)to obtain the query text to execute for each DSRequest, and then adding each query with calls to
java.sql.Statement.addBatch(). This means that many of the sophistications of DSRequest processing are bypassed. Note the follwoing:
This method is intended to be used for edge cases where a large number of records must be updated, and the performance overhead of updating them singly makes normal DSRequest processing impractical. exeuteAsBatch() can give dramatic performance improvements in these circumstances, but at the cost of losing much of the functionality of a DSRequest.
dsRequests- Array of DSRequests to execute as a batch