Skip to Content.
Sympa Menu

freetds - Re: [freetds] SQLPutData error

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] SQLPutData error
  • Date: Thu, 11 Mar 2004 21:29:32 +0100

Il mer, 2004-03-10 alle 08:23, brazilchina AT mail.goo.ne.jp ha scritto:
> Hi
>
> I have failed to insert data with below program.
> Do i use "SQLPutData" invalidly ?
>
> I'm developing on these environment
> -turbolinux workstation 8
> -FreeTDS 0.62.1
> -unixODBC 2.2.7
> -SQL Server 2000
>
> please help me.
>
> source: -------------------------------
> int rc;
>
> SWORD nId;
> SDWORD strLen = 0;
> PTR pToken;
>
> SDWORD cbName;
>
> rc = SQLPrepare( hstmt, "INSERT INTO TEST_TABLE1 (ID, NAME) VALUES (?, ?)",
> SQL_NTS);
> if( rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO ){
> SQLBindParameter(hstmt,
> 1,
> SQL_PARAM_INPUT,
> SQL_C_SSHORT,
> SQL_SMALLINT,
> 0,
> 0,
> &nId,
> 0,
> &strLen);
> SQLBindParameter(hstmt,
> 2,
> SQL_PARAM_INPUT,
> SQL_C_CHAR,
> SQL_VARCHAR,
> 50,
> 0,
> (PTR)2,
> 0,
> &cbName);
>
> cbName = SQL_LEN_DATA_AT_EXEC(0);
> nId = 123;
> rc = SQLExecute( hstmt );
> while( rc == SQL_NEED_DATA ){
> rc = SQLParamData( hstmt, &pToken );
>
> if( rc == SQL_NEED_DATA ){
> SQLPutData( hstmt, "abc", 3);
> }
> }
> }
>
> error message: -------------------------
> Assertion failed: curcol->column_cur_size < curcol->column_size, file
> prepare_query.c, line 510
> Abort (core dumped)

I imported this test in CVS. You are right, it fails but it shouldn't.
On the other side I don't know the right behavior... you are trying to
send 0 bytes so perhaps SQLExecute should return SQL_SUCCESS instead of
SQL_NEED_DATA...

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page