suche 36x36
  • Admin-Scout-small-Banner
           

    CURSOR Admin-Scout

    get the ultimate tool for Informix

    pfeil  
Latest versionsfixlist
14.10.xC10 FixList
12.10.xC16.X5 FixList
11.70.xC9.XB FixList
11.50.xC9.X2 FixList
11.10.xC3.W5 FixList
Have problems? - contact us.
Register for free anmeldung-x26
Contact form kontakt-x26

Informix - Problem description

Problem IT30719 Status: Closed

LVARCHAR DATA IS NOT CORRECTLY SENT TO THE SERVER WHEN USING INSERT
CURSORS (ODBC)

product:
IBM CSDK / 5724C2381 / 410 - CSDK 4.10
Problem description:
Doing a SQLBindParameter of a LVARCHAR column using anything
other than SQL_NTS may cause incorrect data been send to the
server when the InsertCursor feature is enable in the ODBC
driver.

---------
---------

Still need to find out why, but we are adding some extra zeros
to the TUPLE package we send to the server.
This is only a problem if we use WCHAR + LVARCHAR and only if we
have InsertCursors enabled.


/*
drop  table "informix".t1;
create table "informix".t1 (c1 lvarchar(2000),c2 char(36) not
null  );

C->S (66)                               Time: 2019-10-17
15:33:15.16500
        SQ_ID
                0
        SQ_RET_TYPE
                Direction: 0    (FOR PUT)
                # of types: 2

                        Type.....: VARCHAR; NULLABLE
                        Variable Length: 8

                        Type.....: CHAR; NULLABLE
                        Variable Length: 20
        SQ_PUT
                Size of data row: 33
                # rows..........: 1
================================================================
================
HEX DUMP:
       0:  00 00 00 00 04 74 65 73 74 00 00 00 00 74 65 73
.....test....tes
    0x10:  74 32 20 20 20 20 20 20 20 20 20 20 20 20 20 20
t2
    0x20:  20 00
.
================================================================
================
        SQ_EOT


the 4 00s after "test"    shouldn't be there.

*/

#include 
#include 
#include 

#ifdef WIN32
#include 
#include 
#include 
#include 
#include 
#endif

#include "infxcli.h"

int main (long argc, char* argv[])
{
SQLHDBC hdbc;
SQLHENV henv;
SQLHSTMT hstmt;
SQLRETURN rc = 0;
SQLPOINTER cbNULL = SQL_NULL_DATA;
SQLCHAR           SqlState[200] = "", ErrorMsg[200] = "";
SQLINTEGER      IsamError = 0;
SDWORD          NativeError = 0L;
SWORD           ErrorMsgp = 0;
SQLSMALLINT     recnum = 1;

SQLWCHAR Values1[100]=L"test";
SQLWCHAR Values2[100]=L"test2";

SQLLEN Lens1 = 8;  // SQL_NTS
SQLLEN Lens2 = 10;  // SQL_NTS

SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION,(SQLPOINTER)
SQL_OV_ODBC3, 0);

// Connect
SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
SQLDriverConnectW(hdbc, 0,
L"DSN=ids1210_32;uid=informix;pwd=ximrofni", SQL_NTS, NULL, 0,
0,SQL_DRIVER_NOPROMPT);
SQLSetConnectAttr(hdbc, SQL_INFX_ATTR_ENABLE_INSERT_CURSORS,
(SQLUINTEGER*) 1, 0);

// Prepare the statment and bind its one parameter
SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
SQLPrepare(hstmt, (char*) "insert into informix.t1  values
(?,?)", SQL_NTS);

rc=SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_WCHAR,
SQL_CHAR, 5, 0, Values1, 10, &Lens1);

rc=SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_WCHAR,
SQL_CHAR, 6, 0, Values2, 12, &Lens2);

SQLSetStmtAttr(hstmt, SQL_ATTR_PARAMSET_SIZE, (SQLPOINTER*) 1,
SQL_IS_INTEGER);
rc=SQLExecute(hstmt);
if (rc != SQL_SUCCESS)
{
   SQLGetDiagRec(SQL_HANDLE_STMT, hstmt, recnum, SqlState,
&NativeError, ErrorMsg, 199, &ErrorMsgp);
   fprintf(stdout, "SqlState = %s
 Native Error = %d
 Error
Message = %s
", SqlState, NativeError, ErrorMsg);
   fprintf (stdout, "Connection failed!
");
   return (1);
}
 fprintf (stdout, "DONE
");
// Clean up
SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
SQLDisconnect(hdbc);
SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
SQLFreeHandle(SQL_HANDLE_ENV, henv);

return (rc);
}
// ----------------
Problem Summary:
****************************************************************
* USERS AFFECTED:                                              *
* Users of Informix Client SDK 4.10.xC11 or earlier versions.  *
****************************************************************
* PROBLEM DESCRIPTION:                                         *
* LVARCHAR DATA IS NOT CORRECTLY SENT TO THE SERVER WHEN USING *
* INSERT CURSORS (ODBC)                                        *
****************************************************************
* RECOMMENDATION:                                              *
****************************************************************
Local Fix:
Solution
Workaround
****************************************************************
* USERS AFFECTED:                                              *
* Users of Informix Client SDK 4.10.xC11 or earlier versions.  *
****************************************************************
* PROBLEM DESCRIPTION:                                         *
* LVARCHAR DATA IS NOT CORRECTLY SENT TO THE SERVER WHEN USING *
* INSERT CURSORS (ODBC)                                        *
****************************************************************
* RECOMMENDATION:                                              *
****************************************************************
Comment
Fixed in Informix Client SDK 4.10.xC14 and 4.50.FC3.
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
28.10.2019
03.03.2020
03.03.2020
Problem solved at the following versions (IBM BugInfos)
4.10.xC14,
4.50.FC3
Problem solved according to the fixlist(s) of the following version(s)
Informix EditionsInformix Editions
Informix Editions
DocumentationDocumentation
Documentation
IBM NewsletterIBM Newsletter
IBM Newsletter
Current BugsCurrent Bugs
Current Bugs
Bug ResearchBug Research
Bug Research
Bug FixlistsBug Fixlists
Bug Fixlists
Release NotesRelease Notes
Release Notes
Machine NotesMachine Notes
Machine Notes
Release NewsRelease News
Release News
Product LifecycleProduct Lifecycle
Lifecycle
Media DownloadMedia Download
Media Download