📄 faq.html
字号:
<html>
<head>
<meta name="KEYWORDS" content="
library, C++,
Oracle, SQLServer, DB2, Sybase, Informix, InterBase, SQLBase, ODBC,
SQL, server, client, database, programming, development, software,
Win32, Windows, Linux, Unix, Solaris,
Microsoft, Borland, Centura, Gupta, IBM">
<meta name="DESCRIPTION" content="SQLAPI++ is C++ library for accessing SQL databases (Oracle, SQLServer, Sybase, DB2, InterBase, SQLBase, Informix, ODBC).
It uses native APIs, provides low-level access to database-specific features.">
<title>SQLAPI++ Library - Q&A</title>
</head>
<body bgcolor="#ffffff" BACKGROUND="../images/bg.gif" text="#000000"><!--class="GlbHdr"-->
<table WIDTH="600" height="40" frame="hsides" BORDER="2" BORDERCOLOR="#004fcd" align="right" cellpadding="0" cellspacing="2" id="TABLE1">
<tr><!--class="GlbDefault"-->
<td width="70" bgcolor="#000094" bordercolor="black" align="middle">
<a href="../index.html" style="TEXT-DECORATION: none">
<font color="white" size="3" face="sans-serif">
<b>Home</b></font></a></td></td>
<td width="70" bgcolor="#000094" bordercolor="black" align="middle">
<a href="../HowTo/index.html" style="TEXT-DECORATION: none">
<font color="white" size="3" face="sans-serif">
<b>How To</b></font></a></td><!--class="GlbDefault"-->
<td width="70" bgcolor="#000094" bordercolor="black" align="middle">
<a href="../OnLineDoc/index.html" style="TEXT-DECORATION: none">
<font color="white" size="3" face="sans-serif">
<b>Online Documentation</b></font></a></td><!--class="GlbActive"-->
<td width="70" bgcolor="#00bb00" bordercolor="black" align="middle">
<a href="index.html" style="TEXT-DECORATION: none">
<font color="white" size="3" face="sans-serif">
<b>Support</b></font></a></td>
<td width="70" bgcolor="#000094" bordercolor="black" align="middle">
<a href="../Download/index.html" style="TEXT-DECORATION: none">
<font color="white" size="3" face="sans-serif">
<b>Download</b></font></a></td>
<td width="70" bgcolor="#000094" bordercolor="black" align="middle">
<a href="../Order/index.html" style="TEXT-DECORATION: none">
<font color="white" size="3" face="sans-serif">
<b>Order</b></font></a></td>
</tr>
</table>
<p> </p>
<p> </p>
<table width="100%">
<tr>
<td valign="top" width="165"><!--class="LeftMenu"-->
<table frame="void" CELLSPACING="5" width="165">
<tr>
<td><p><br></p></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</td><!--empty column-->
<td width="20">
<p> </p>
</td><!--Content-->
<td valign="top" align="left" style="LEFT: 195px; TOP: 0px">
<center>
<h1> SQLAPI++ Q&A</h1></center>
<p>1. <a href="FAQ.html#QandA1">When linking a programm that uses SQLAPI++ I got an
error: <strong>unresolved external symbol "__declspec(dllimport)
public: virtual __thiscall ..."</strong>.
What is missing?</a>
</p>
<p>2. <a href="FAQ.html#QandA2">How can I get status return code
from stored procedure on Sybase?</a>
</p>
<p>3. <a href="FAQ.html#QandA3">I work with Sybase ASE. I have a stored procedure that
has an input-output parameter. But when I call
SAParam::ParamDirType method for this parameter it always returns SA_ParamInput,
and when I try to get the parameter's value after the command execution
I receive nothing. What is wrong?</a>
</p>
<p>4. <a href="FAQ.html#QandA4">Why is the "sybinit.err" file sometimes being
appended to at a successful SQLAPI++ connection to ASE/ASA using Open Client?
Console application also outputs some warning(s) about context allocation failure.</a>
</p>
<p>5. <a href="FAQ.html#QandA5">I execute a "Select..." statement
and then call SACommand::RowsAffected() method to determine the number of
rows to be returned by the command, but
the result is always incorrect (-1 or 0 most of the times).
What is wrong?</a>
</p>
<hr>
<h3 align="left"><a name="QandA1"></a>1. When linking a programm that uses SQLAPI++
I got an error: unresolved external symbol "__declspec(dllimport)
public: virtual __thiscall ...". What is
missing?</h3>
<p align="left">Probably you forgot to include sqlapi.lib<sup>*</sup> (or
other SQLAPI++ library, depends on the compiler and/or static/dynamic version)
into the project. To link with SQLAPI++ Library you have to
include sqlapi.lib into you project (as well as *.cpp).<br>For example, in Visual
C++ you have to do the following:</p>
<ol>
<li>
<div align="left">In workspace tree select the project that you link with
SQLAPI++.</div>
<li>
<div align="left">Use "Add Files to Project..." command on the right click
menu and add sqlapi.lib to you project.</div>
<li>
<div align="left">Press F7 button to compile and link you
project.</div></li></ol>
<p align="left">* sqlapi.lib should be used when linking with dynamic version
of SQLAPI++ using Microsoft Visual C++.<br>To link with a
static version using MSVC++ use sqlapis.lib.<br>To link with a dynamic version
using Borland C++ compiler use sqlapib.lib.<br>To link with a static version
using Borland C++ compiler use sqlapibs.lib.<br>To link with a dynamic version using
Borland C++ Builder compiler use sqlapibb.lib.<br>To link with a static version using
Borland C++ Builder compiler use sqlapibbs.lib.<br>To link with a debug
version use appropriate lib file that ends with 'd'.</p>
<h3 align="left"><a name="QandA2"></a>2. How can I get status return code from stored procedure
on Sybase (or SQL Server)?</h3>
<p align="left">
SQLAPI++
Library automatically creates <strong>SAParam object</strong> to
represent procedure status return code. After a command execution
you can check it value. This SAParam object's name
is <strong>"RETURN_VALUE"</strong>, object's type is
<strong>SA_dtLong</strong>
, object's direction type is <strong>SA_ParamReturn</strong>.
</p>
<h3 align="left"><a name="QandA3"></a>3. I work with Sybase ASE. I
have a stored procedure that
has an input-output parameter. But when I call
SAParam::ParamDirType method for this parameter it always returns SA_ParamInput,
and when I try to get the parameter's value after the command execution
I receive nothing. What is wrong?</h3>
<p><strong>Sybase
ASE</strong> server does not provide information about parameter's
direction type, that's why SQLAPI++ Library defines all parameters
(except status result code) as input (SA_ParamInput). If you have
input-output parameters in the procedure you have to call <strong>SAParam::setParamDirType</strong> method for
these parameters before command execution and set parameter's
direction type explicitly (SA_ParamInputOutput).<br>You shouldn't call this method for procedure status result
code because it is detected correctly (as SA_ParamReturn) by the
Library.</p>
<p>There is no need to call this method for
<strong>Sybase ASA</strong> because all
parameters are detected correctly automatically (including the
direction type).</p>
<h3 align="left"><a name="QandA4"></a>4. Why is the "sybinit.err" file sometimes being
appended to at a successful SQLAPI++ connection to ASE/ASA using Open Client?
Console application also outputs some warning(s) about context allocation failure.</h3>
<p>SQLAPI++ has to set the version of
Client-Library behavior when it connects to Sybase. By default
SQLAPI++ tries to set
12.5 behavior; if it fails, SQLAPI++ tries to
set 11.0 behavior and so on from the highest version to the
lowest one until it succeeds. Finally the
connection is successful, but every time when it fails Sybase server generates
the appropriate error message and adds the same error message
to the "sybinit.err" file. </p>
<p>The solution is to set the CS_VERSION option
to "Detect" using <a href="../OnLineDoc/Connection_setOption.html">SAConnection::setOption</a>
method. In that case SQLAPI++ automatically detects the maximum
available version of behavior via the version
of Client-Library.</p>
<h3 align="left"><a name="QandA5"></a>5. I execute a "Select..." statement
and then call SACommand::RowsAffected() method to determine the number of
rows to be returned by the command, but
the result is always incorrect (-1 or 0 most of the times).
What is wrong?</h3>
<p>SACommand::RowsAffected() is only applicable
to INSERT/UPDATE/DELETE queries. It is database APIs limitation, not
the one of SQLAPI++. The only way to get to<br>
know result set size in advance is to
execute "Select count(*)..." command. </p>
<p align="left">
</p>
</td>
<tr></tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -