LabWindows/CVI SQL Toolkit for Windows 2000/NT/9x, Version 2.0.6
Documentation File
(c) Copyright 1995-2002 National Instruments Corporation.
All rights reserved.
Product and company names listed are trademarks
or trade names of their respective companies.
This file contains installation and programming considerations and
changes that are too recent to be included in the printed LabWindows/CVI
SQL Toolkit documentation. This file contains information about the
following topics:
Before Installation
After Installation
Available SQL Toolkit ODBC Drivers
Additions and Corrections to Documentation
Distribution of an SQL Toolkit Executable or DLL
Before Installation
===================
1. If your LabWindows/CVI compatibility mode is "Visual C/C++," install the
toolkit by running Sql2.exe. If your LabWindows/CVI compatibility mode is
"Borland," install the toolkit by running BorlandInstaller\Sql2-borland.exe.
If you are not sure what your compatibility mode is, select Options>>Build Options
from the Project window of LabWindows/CVI.
2. This toolkit must be used with LabWindows/CVI for Windows 2000/NT/9x,
version 5.0 or later.
3. This toolkit installs ADO version 2.5.
After Installation
==================
1. The SQL Toolkit will install three sample executable icons in your
SQL Toolkit program group.
2. If you plan to use the SQL Toolkit with an external compiler, a
library file for the current compatible external compiler is in the
/sql20/ext directory.
Also, the sample programs are written to be compatible with previous
versions of LabWindows/CVI. The following changes must be made to
the source code when used in an external compiler.
* Use the WinMain() entry point instead of main()
* Add appropriate calls to InitCVIRTE and CloseCVIRTE
Please refer to the LabWindows/CVI Programmer Reference Manual for more
information.
3. Patches for the LabWindows/CVI Test Executive and LabWindows/CVI SPC
toolkits are available in the /sql20/patches directory.
4. To view the included online version of the manual, you must install
the free Adobe Acrobat PDF viewer version 3.0 or later. The
Adobe Acrobat PDF viewer available at:
http://www.adobe.com/prodindex/acrobat/readstep.html.
Additions and Corrections to Documentation
==========================================
Notes and Known Problems
------------------------
The Microsoft Access ODBC drivers that ship with ADO 2.0 and 2.1.x
incorrectly update MEMO field values with NULL for all records if the
value of the first record written is not specified. A bug for this
problem was reported to Microsoft. This behavior does not occur when
using the Microsoft Access OLE-DB Provider.
You must include cvi_db.h before any other LabWindows/CVI includes.
If multiple threads in your application use this toolkit, you must
call DBInit before you call any other toolkit function.
You also can change the OLE threading model of ADO with two batch
files located in the Program Files\Common Files\System\ADO
directory, makfre15.bat and makapt15.bat.
Using the toolkit in multiple threads will not work when using Microsoft
Access or any of the Microsoft Jet based drivers with version 3.50 or
earlier because the Jet components are not multithread safe.
Starting with toolkit version 2.0, functions that return statement
or connection handles now return the error code instead of zero if
the function fails. You can use DBSetBackwardCompatibility to force
these functions to return 0 on failure. You also can use
DBSetBackwardCompatibility to force DBColumnType to return one of
the eight types supported by toolkit version 1.x instead of the actual
type.
Starting with toolkit version 2.0, the DBSources, DBDatabases, DBTables,
DBIndexes, DBPrimaryKeys, and DBForeignKeys functions now return different
fields. You must correct bindings for each of these functions.
ADO cannot close a statement if there are unsaved changes to a record.
You can call DBCancelRecordChanges to cancel the changes. The most common
use of DBCancelRecordChanges is to cancel changes when DBPutRecord fails.
Some ODBC drivers update all identical records when you change one record.
This action occurs when the driver does not support the features required for
positioned updates and must use a query based update.
In some cases where ADO 2.0 returned the empty string "", ADO 2.1.x and
ADO 2.5 return NULL. This change is common in attribute functions such
as DBGetStatementAttribute and DBGetConnectionAttribute.
If you delete the last record in a recordset, ADO 2.0 and 2.5 position
the cursor at EOF. ADO 2.1.x positions the cursor on the last undeleted
record. If you delete the last record within a fetch loop, 2.1.x will
fetch the last undeleted record again the next time through the loop.
Some ADO providers and ODBC drivers allow you to fetch deleted records
in the current recordset until you close the recordset. Because ADO 2.1.x
sets the cursor to the previous undeleted record when you delete a record,
a fetch loop that finds and deletes record can attempt to delete a deleted
record and cause an error.
ODBC drivers are not required to support the command timeout attribute.
When you attempt to set the timeout attribute, ADO 2.0 ignores the
error, but ADO 2.1.x and 2.5 report an unknown error.
When an ODBC driver returns a value of type Decimal (BCD) and the value
is a multiple of 10, ADO 2.0 corrupts the value and ADO 2.1.x drops all
trailing zeroes. There is no workaround for ADO 2.1.x. ADO 2.5 works
correctly. For ADO 2.0, the SQL Toolkit detects and corrects this problem
for all cases except for functions that return values in variants. If you
use DBGetColVariant, DBGetVariantArrayColumn, DBGetVariantArrayValue, or
DBGetParamVariant, you can work around this problem in one of two ways:
Set the statement attribute ATTR_DB_STMT_CURSOR_LOCATION to
DB_CURSOR_LOC_CLIENT. This method requires using DBNewSQLStatement,
DBSetStatementAttribute, and DBOpenSQLStatement.
Use SP_VariantConvertToType shown instead of CA_VariantConvertToType
/* the variant type defined within CVI does not include the */
/* decimal type (a new feature of variants), so we fake it */
#ifndef VT_DECIMAL
#define VT_DECIMAL 14
#endif
typedef struct tagDEC_FAKE {
USHORT wReserved;
union {
struct {
BYTE scale;
BYTE sign;
}s1;
USHORT signscale;
}n1;
ULONG Hi32;
union {
struct {
ULONG Lo32;
ULONG Mid32;
}n2;
char Lo64[8];
}n3;
} MSVC_DECIMAL;
typedef struct tagVARIANT_FAKE VARIANT_FAKE;
struct tagVARIANT_FAKE
{
union
{
struct __tagVARIANT
{
VARTYPE vt;
WORD wReserved1;
WORD wReserved2;
WORD wReserved3;
union
{
char dummy[8];
} n1;
} n2;
MSVC_DECIMAL decVal;
} n3;
};
HRESULT CVIFUNC SP_VariantConvertToType(
VARIANT *variant,
unsigned cavt,
void *ptrToResult)
{
HRESULT firstStat;
char msg[50];
firstStat = CA_VariantConvertToType((VARIANT *)variant, cavt,
ptrToResult);
if ((firstStat == -2147024809) && (variant->vt == VT_DECIMAL)) {
double value;
HRESULT temp;
char scale;
VARIANT_FAKE* fakeVariant;
fakeVariant = (VARIANT_FAKE *)variant;
/* ADO has improperly set the scale of the value */
/* set the scale
- 1
- 2
- 3
- 4
- 5
前往页