Topic: proposed new interface additions
the following are additions i am proposing to the current interface. questions/comments would be much appreciated.
' additions to the existing ISQLDB type
Type ISQLDB
' driver supports transactions
Const FETR_TRANSACTIONS:Int
' driver supports transaction save points
Const FETR_TRANSACTION_SAVEPOINTS:Int
' driver supports keeping results on the server
Const FETR_FETCH_ON_DEMAND:Int
' can prepare statements
Const FETR_PREPARED_STMTS:Int
' returns True if the implementation supports the passed feature
Method hasFeature:Int(feature:Int) Abstract
' same as the MySQL implementation, but with the addition of hasFeature can now be moved here
Method setPrefetch:Int(bPrefetch:Int=True) Abstract
' passed string contains only text
Const ESCT_STRING:Int
' passed string has binary values
Const ESCT_BINARY_STRING:Int
' escape a string to make it compatible with the native engine
Method escapeString:String(stmt:String,esc_type:Int=ESCT_STRING) Abstract
' creates a transaction object to be used with commands
Method BeginTransaction:ISQLTransaction(Options:String) Abstract
' creates a command object for use by the driver
Method CreateDBCommand:ISQLCommand(Transaction:ISQLTransaction = Null) Abstract
' returns the version info for the native server
Method getNativeServerVer:String() Abstract
' returns the version info for the native client
Method getNativeClientVer:String() Abstract
' returns the version info for the driver implementation
Method getISQLDriverVer:String() Abstract
' returns "about" type information regarding the driver implementation
Method getISQLDriverInfo:String() Abstract
EndType
' type enabling transaction support and performing transaction functionality
Type ISQLTransaction
' commits a transaction
Method Commit() Abstract
' rollsback a transaction
Method RollBack(SavePoint:String) Abstract ' Save Points are better for nesting... and method used by SQL Standards
' begins a transaction
Method BeginTransaction(SavePoint:String) Abstract
EndType
' collection of parameters
Type ISQLParmeterCollection Extends TMap
' creates a new parameter object, sets its value, adds to collection, and returns it
Method addParam:ISQLParameter(pname:String,value:String,ptype:Int=TYPE_STRING) Abstract
' removes a parameter from the collection. returns true if successful.
Method removeParam:Int(pname:String)
' gets the parameter from the collection.
Method getParam:ISQLParameter(pname:String) Abstract
EndType
' parameter for ISQLCommand
Type ISQLParameter
' based on this type, the underlying implementation will convert the value
' to a format supported by the SQL database engine
Const TYPE_STRING:Int=0
Const TYPE_BINARY:Int=1
Const TYPE_BYTE:Int=2
Const TYPE_BOOLEAN:Int=3
Const TYPE_CURRENCY:Int=4
Const TYPE_DATE:Int=5
Const TYPE_TIME:Int=6
Const TYPE_DATETIME:Int=7
Const TYPE_SHORT:Int=8
Const TYPE_INT:Int=9
Const TYPE_LONG:Int=10
Const TYPE_FLOAT:Int=11
Const TYPE_DOUBLE:Int=12
' returns the data type of this parameter
Method getISQLType:Int() Abstract
' sets the data type of this parameter. default is TYPE_STRING.
Method setISQLType(isqltype:Int=TYPE_STRING)
' gets the parameter value
Method getVal:String() Abstract
' sets the parameter value
Method setVal(value:String) Abstract
' gets the parameter name
Method getName:String() Abstract
' sets the parameter name
Method setName:String() Abstract
' returns True if the parameter accepts null values
Method getIsNullable:Int() Abstract
' sets whether the value can be Null or not
Method setIsNullable(bIsNullable:Int) Abstract
EndType
' This is what you will need to do prepared Statements
Type ISQLCommand
' this command will run an SQL statement
Const SQLQUERYCOMMAND=1
' this command will run a stored procedure
Const SQLSTOREDPROCEDURE=2
' returns the connection object associated with this command
Method GetConnection:ISQLDB() Abstract
' sets the transaction object for this command
Method SetTransaction(Transaction : ISQLTransaction) Abstract
' returns the transaction object for this command
Method GetTransaction:ISQLTransaction() Abstract
' sets the command that will run
Method SetCommandText(SQLStatement:String) Abstract
' returns the command set to run
Method GetCommandText:String() Abstract
' sets the command type
Method SetCommandType(SQLCommandType:Int=SQLQUERYCOMMAND) Abstract
' returns the command type
Method GetCommandType:Int() Abstract
' executes the statement and returns the result set
Method Execute:ISQLResultSet() Abstract
' executes this statement as a scaler and returns either the first row/col
' value or the value of the field passed from the first row
Method ExecuteScaler:String(field_nm:String=Null) Abstract
' gets the parameters collection
Method getParameters:ISQLParmeterCollection() Abstract
' prepares a statement for better performance
Method Prepare() Abstract
EndType