On Mon, 2003-03-10 at 09:40, Naumann, Frank wrote:
> Hi all,

Hi !!

> 
> I found a problem (bug?) when updating a blob column via MyODBC. The
> statement i run is like that:
> 
> UPDATE blob_table SET blob_col = ? where id = ?
> 
> when i do NOT bind the restriction as input parameter, but write it directly
> in the string, it works perfectly.
> 
> but when i want to bind the restriction directly, the following happens:
> 
> 1. I bind the blob_col with SQL_LEN_DATA_AT_EXEC(length) as indikator
> (SQLBindParameter returns SQL_SUCCESS)
> 2. I bind the id restriction directly to a program variable
> (SQLBindParameter returns SQL_SUCCESS)
> 3. I call SQLExecute, it returns SQL_NEED_DATA as expected.
> 4. I call SQLParamData to access the blob_col, it returns also SQL_NEED_DATA
> as expected.
> 5. I call several times SQLPutData to fill the blob_col, each returns with
> SQL_SUCCESS
> 6. I call SQLParamData to indicate that the blob_col is populated with data
> completely and would expect SQL_SUCCESS.

I just tested it, and it returns SQL_SUCCESS unless if you have more
parameters data to be supplied during the run-time. 

Possible reason could be, you might have specified the same pcbLength
buffer to all parameters in SQLBindParameter.

Here is a simple snippet from the test suite for the similar case:

..
..
rc = SQLPrepare(hstmt,"update t_putdata set c2= ? where c1 =
?",SQL_NTS);
mystmt(hstmt,rc);

rc = SQLBindParameter(hstmt,1,SQL_PARAM_INPUT,SQL_C_CHAR,
                      SQL_LONGVARCHAR,0,0,
                      (SQLPOINTER)1,0,&pcbLength);

rc = SQLBindParameter(hstmt,2,SQL_PARAM_INPUT,SQL_C_LONG,
                      SQL_INTEGER,0,0,&c1,0,NULL);

pcbLength =  SQL_LEN_DATA_AT_EXEC(0);

c1 = 10;
rc = SQLExecute(hstmt);
myassert(rc == SQL_NEED_DATA);

rc = SQLParamData(hstmt, &token);
myassert(rc == SQL_NEED_DATA);

strcpy(data,"mysql ab");
rc = SQLPutData(hstmt,data,6);
mystmt(hstmt,rc);

strcpy(data,"- the open source database company");
rc = SQLPutData(hstmt,data,strlen(data));
mystmt(hstmt,rc);

rc = SQLParamData(hstmt, &token);
mystmt(hstmt,rc);

SQLFreeStmt(hstmt, SQL_RESET_PARAMS);
SQLFreeStmt(hstmt, SQL_CLOSE);

..
..

The data updated is:

 data: mysql - the open source database company(40)

Thanks

-- 
Regards, Venu
For technical support contracts, go to https://order.mysql.com
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Mr. Venu <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, Developer
/_/  /_/\_, /___/\___\_\___/  Palo Alto, CA-94306, USA
       <___/  www.mysql.com

Join MySQL Users Conference and Expo:
http://www.mysql.com/events/uc2003/


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to