| Home | How To | Online Documentation | Support | Download | Order |
|
|
Server Specific GuideSQL Server
|
| Name | C enum constant |
| LongBinary | SA_dtLongBinary |
| LongChar | SA_dtLongChar |
| BLob (Binary Large object) | SA_dtBLob |
| CLob (Character Large object) | SA_dtCLob |
The table below shows how SQLAPI++ data types correspond with SQL Server's (OLE DB) original data types:
SA_dtLongBinary <= > IMAGE
SA_dtLongChar <= > TEXT
SA_dtBLob = > IMAGE
SA_dtCLob => TEXT
For more details see How To - Working with Long or Lob(CLob, BLob) data , How To - Binding input parameters.
SQL Server stored procedures can have integer return codes and output parameters. The return codes and output parameters are sent in the last packet from the server and are therefore not available to the application until all result sets from stored procedure (if any) are completely processed using SACommand::FetchNext method.
SQLAPI++ Library automatically creates SAParam object to represent procedure status return code or function return value. You can refer to this SAParam object using SQLAPI++ predefined name "RETURN_VALUE".
For more details see SACommand::Execute, SACommand::FetchNext, SAParam object, How To - Returning Output Parameters.
Using SACommand::Cancel method you can cancel the following types of processing on a statement:
SQLAPI++ calls ICommand::Cancel function to cancel a query. To get more details see ICommand::Cancel function description in SQL Server OLE DB documentation.
For more details see SACommand::Cancel, SQL Server (OLE DB) connection and command options.
A server specific option can relate to a connection, command, parameter or field. We recommend you specify each option in an appropriate object, although it is possible to specify them in the parental object as well. In that case the option affects all the child objects.
A connection related option must be specified in a SAConnection object.
A command related option may be specified in either SAConnection object or SACommand object. If it is specified in SAConnection object it affects all the commands on that connection.
A parameter related option may be specified in SAConnection object, SACommand object or SAParam object. If it is specified in SAConnection object it affects all the commands and therefore all the parameters on that connection. If it is specified in SACommand object it affects all the parameters on that command.
A field related option may be specified in SAConnection object, SACommand object or SAField object. If it is specified in SAConnection object it affects all the commands and therefore all the fields on that connection. If it is specified in SACommand object it affects all the fields on that command.
Specific options for SQL Server (OLE DB):
|
Option name / Scope |
Description |
|
UseAPI Connection related |
Forces SQLAPI++ Library to use OLE DB or DB-Library API. |
|
OLEDBProvider Connection related. Should be specified before connection is made. |
Forces SQLAPI++ Library to
use specified OLEDB provider. Valid values : empty, "SQLNCLI", "SQLOLEDB", "Microsoft.SQLSERVER.MOBILE.OLEDB.3.0"... Special value : "CompactEdition" can be used with SQLServer Compact Edition. Then SQLAPI++ uses "Microsoft.SQLSERVER.CE.OLEDB.3.5" or "Microsoft.SQLSERVER.MOBILE.OLEDB.3.0" OLEDB provider, sets the "Execute_riid" = "IID_IRowset" option for related SACommand instances, uses string buffer for numeric data types. The following CE options also available if this option value is used: DBPROP_SSCE_ENCRYPTDATABASE DBPROP_SSCE_TEMPFILE_DIRECTORY DBPROP_SSCE_TEMPFILE_MAX_SIZE DBPROP_SSCE_DEFAULT_LOCK_ESCALATION DBPROP_SSCE_AUTO_SHRINK_THRESHOLD DBPROP_SSCE_MAX_DATABASE_SIZE DBPROP_SSCE_FLUSH_INTERVAL DBPROP_SSCE_DEFAULT_LOCK_TIMEOUT DBPROP_SSCE_ENCRYPTIONMODE DBPROP_SSCE_MAXBUFFERSIZE See CE documentation. DBPROP_SSCE_DBPASSWORD property is set when the password is defined with the SAConnection::Connect(...) method. Default value: empty. SQLAPI++ tries to initialize "SQLNCLI" first and then (if it fails) "SQLOLEDB". |
|
SSPROP_INIT_AUTOTRANSLATE Connection related. Should be specified before connection is made. |
This option configures OEM/ANSI character translation.
See SQLOLEDB documentation for more information. |
|
SSPROP_INIT_ENCRYPT Connection related. Should be specified before connection is made. |
This option configures
the data going over the network encryption.
See SQLOLEDB documentation for more information. Valid values: "VARIANT_TRUE", "VARIANT_FALSE". Default value: see SQLOLEDB documentation. |
|
SSPROP_INIT_FILENAME Connection related. Should be specified before connection is made. |
Specifies the primary file
name of an attachable database. See SQLOLEDB documentation for more
information. Valid values: String containing. |
|
SSPROP_INIT_PACKETSIZE Connection related. Should be specified before connection is made. |
This option configures
packet size.
See SQLOLEDB documentation for more information. Valid values: String containing number. Default value: see SQLOLEDB documentation. |
|
SSPROP_INIT_MARSCONNECTION Connection related. Should be specified before connection is made. |
Forces SQLAPI++ to
initiate MARS connection.
See SQLOLEDB documentation for more information. Valid values: "VARIANT_TRUE", "VARIANT_FALSE". |
|
SSPROP_INIT_FAILOVERPARTNER Connection related. Should be specified before connection is made. |
Allows to set the
connection mirror partner. See SQLOLEDB documentation for more
information. Valid values: String containing. |
|
SSPROP_INIT_APPNAME Connection related. Should be specified before connection is made. |
Specifies the client application name. See SQLOLEDB
documentation for more information. |
|
SSPROP_INIT_WSID Connection related. Should be specified before connection is made. |
Specifies the client
workstation name. See SQLOLEDB
documentation for more information. Valid values: client workstation name string. Default value: none. |
|
CoInitializeEx_COINIT Connection related. Should be specified before connection is made. |
Specifies the COM library initialization mode. See
SQLOLEDB documentation for more information. |
|
PreFetchRows Command related. Should be specified before command execution. |
Forces SQLAPI++ Library to fetch rows in bulk, rather
than retrieving records one by one. Valid values: String containing number of rows
in the fetch buffer. |
|
ICommandPrepare Command related. Should be specified before command preparation (either explicit or implicit). |
Controls current command preparation with
ICommandPrepare interface.
Default value : "optional", SQLAPI++ calls ICommandPrepare->Prepare() for the command, but doesn't check for errors. |
|
DBPROP_SERVERCURSOR
DBPROP_OTHERINSERT DBPROP_OTHERUPDATEDELETE DBPROP_OWNINSERT DBPROP_OWNUPDATEDELETE DBPROP_REMOVEDELETED DBPROP_CANSCROLLBACKWARDS
Command related. Should be specified before command execution. |
Forces SQL Server to return result sets using one of the following methods:
You can request different cursor behaviors in a rowset
by setting rowset properties DBPROP_SERVERCURSOR, DBPROP_OTHERINSERT,
DBPROP_OTHERUPDATEDELETE, DBPROP_OWNINSERT, DBPROP_OWNUPDATEDELETE,
DBPROP_REMOVEDELETED. Some properties can be safely combined
with others. See SQLOLEDB documentation to get more about how they
affect SQL Server cursors. Valid values for DBPROP_SERVERCURSOR option: "VARIANT_TRUE" (SQLOLEDB implements the rowset using a server cursor), "VARIANT_FALSE" (SQLOLEDB implements the rowset using a default result set). Valid values for other options : "VARIANT_TRUE",
"VARIANT_FALSE". See SQLOLEDB documantation for more
detailes. |
|
UseDynamicCursor Command related. Should
be specified
before describing parameters or command execution.
|
Forces SQLAPI++ to use
scrollable dynamic server side cursor. Sets DBPROP_OTHERINSERT =
VARIANT_TRUE, DBPROP_OTHERUPDATEDELETE = VARIANT_TRUE,
DBPROP_CANSCROLLBACKWARDS = VARIANT_TRUE. Valid values: "True", "1". Default value: "false". |
|
DBPROP_INIT_TIMEOUT Connection related. |
Sets Connection Time Out. |
|
DBPROP_COMMANDTIMEOUT Command related. Should be specified before command execution. |
Sets Command Time Out. Valid values: String containing number of seconds before a command times out. A value of "0" indicates an infinite time-out. By default SQLAPI++ doesn't change this option and uses the value set by SQLOLEDB. See SQLOLEDB documentation for details. |
|
Execute_riid Command related. Should be specified before command execution. |
Sets the requested interface for the rowset returned by
the command. See SQLOLEDB documentation (ICommand::Execute()
function) for details. |
For more details see SAConnection::setOption, SACommand::setOption, SAField::setOption, SAParam::setOption.
You can call client specific API functions which are not directly supported by SQLAPI++ Library. SAConnection::NativeAPI method returns a pointer to the set of native API functions available for SQL Server (OLE DB). To use the database API directly you have to downcast this saAPI pointer to the appropriate type and use its implementation-specific members. The following table shows what type cast you have to make and what additional header file you have to include to work with OLE DB API. Note that using appropriate type casting depends on an API version (that generally mean that you have to explicitly check client version before casting, see SAConnection::ClientVersion method).
|
Type casting |
Additional |
|
Cast the result to class ssOleDbAPI: saAPI *pResult = con.NativeAPI(); |
#include <ssOleDbAPI.h> |
To get more information about DBMS API functions see this DBMS specific documentation.
For more details see SAConnection::NativeAPI.
You have to use native API handles when you want to call specific SQL Server OLE DB API functions which are not directly supported by the Library. API functions usually need to receive one or more active handles as a parameter(s). SAConnection::NativeHandles method returns a pointer to the set of native API connection related handles. To use API handles directly you have to downcast saConnectionHandles pointer to the appropriate type and use its implementation-specific members. The following table shows what type cast you have to make and what additional header file you have to include to work with specific OLE DB API. Note that using appropriate type casting depends on an API version (that generally mean that you have to explicitly check client version before casting, see SAConnection::ClientVersion method).
|
Type casting |
|
Cast the result to class ssOleDbConnectionHandles: #include <ssOleDbAPI.h> saConnectionHandles *pResult = con.NativeHandles(); Available handles:
|
To get more information about DBMS API functions and handles see this DBMS specific documentation.
For more details see SAConnection::NativeHandles.
You have to use native API handles when you want to call specific SQL Server OLE DB API functions which are not directly supported by the Library. API functions usually need to receive one or more active handles as a parameter(s). SACommand::NativeHandles method returns a pointer to the set of native API command related handles. To use API handles directly you have to downcast saCommandHandles pointer to the appropriate type and use its implementation-specific members. The following table shows what type cast you have to make and what additional header file you have to include to work with specific SQL Server OLE DB API. Note that using appropriate type casting depends on an API version (that generally mean that you have to explicitly check client version before casting, see SAConnection::ClientVersion method).
|
Type casting |
|
Cast the result to class ssOleDbCommandHandles: #include <ssOleDbAPI.h> saCommandHandles *pResult = cmd.NativeHandles (); Available handles:
|
To get more information about DBMS API functions and handles see this DBMS specific documentation.
For more details see SACommand::NativeHandles.
When an error occurs inside SQLAPI++ Library it throws an exception of type SAException. SAException::ErrPos method gets an error position in SQL statement. In SQL Server (OLE DB) SAException::ErrPos method returns the number of line within SQL statement where error occured.
For more details see How To - Error handling, SAException object.
The header file in the include subdirectory
of SQLAPI++ distributions:
#include <SQLAPI.h> - main header, should
be used whenever SQLAPI++ is used.
#include <ssOleDbAPI.h> - SQLServer
API, should be included if direct SQL Server OLE DB
calls are required.
For more details see Online Documentation - Instructions for Compiling and Linking Applications with SQLAPI++
If you haven't found the answer to you questions or have some problems on using the Library, please, send e-mail to howto@sqlapi.com.