| Home | How To | Online Documentation | Support | Download | Order |
|
|
Server Specific GuideSQL Server
|
| Name | C enum constant |
| image |
SA_dtLongBinary |
| text | SA_dtLongChar |
| varbinary(max) | SA_dtBLob |
| [n]varchar(max) |
SA_dtCLob |
SQLAPI++ maps data types to ODBC constants. Actual mapping from constant to SQL type is ODBC driver specific. The table below shows how SQLAPI++ data types correspond with ODBC constants:
SA_dtLongBinary <= > SQL_LONGVARBINARY
SA_dtLongChar <= > SQL_LONGVARCHAR
SA_dtBLob = > SQL_VARBINARY
SA_dtCLob => SQL_VARCHAR
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".
SQLAPI++ Library doesn't support output [n]varchar(max)/varbinary(max) parameters because they aren't supported by ODBC API.
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 SQLCancel function to cancel a query. To get more details see SQLCancel function description in SQLServer Native Client ODBC documentation.
For more details see SACommand::Cancel, SQL Server (ODBC) 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 (ODBC):
|
Option name / Scope |
Description |
|
UseAPI Connection related. Should be specified before connection is made. |
Forces SQLAPI++ Library to use OLE DB, ODBC or
DB-Library API. |
|
SQLNCLI.LIBS
Connection related. Should be specified before the first connection is made. |
Specifies SQL Server
Native client library list. SQLAPI++ tries to load libraries from this
list one by one for loading SQL Server Natvie API. Valid values : shared library names separated by ';'. Default value: "sqlncli10.dll;sqlncli.dll;sqlsrv32.dll". |
|
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. |
|
UseDynamicCursor Command related.
|
Forces SQLAPI++ to use
scrollable dynamic server side cursor. Valid values: "True", "1". Default value: "false". |
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 (ODBC). 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 SQL Server with ODBC API. Note that using appropriate type casting depends on an API (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 ssNCliAPI: saAPI *pResult = con.NativeAPI(); |
#include <ssNcliAPI.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 ODBC 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 SQL Server with ODBC API. Note that using appropriate type casting depends on an API (that generally mean that you have to explicitly check client version before casting, see SAConnection::ClientVersion method).
|
Type casting |
|
Cast the result to class ssConnectionHandles: #include <ssNcliAPI.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 ODBC 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 SQL Server with ODBC API. Note that using appropriate type casting depends on an API (that generally mean that you have to explicitly check client version before casting, see SAConnection::ClientVersion method).
|
Type casting |
|
Cast the result to class ssCommandHandles: #include <ssNcliAPI.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 (ODBC) SAException::ErrPos method returns the number of the line within SQL statement where an 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 <ssNcliAPI.h> - SQLServer
API, should be included if direct ODBC 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.