Re: Re: [freetds] SQLPutData error

brazilchina at mail.goo.ne.jp brazilchina at mail.goo.ne.jp
Fri Mar 12 21:08:50 EST 2004


thanks freddy77

I can't execute yet.
Should I use right optino in configure or make.
Please tell me how to execute the program using "SQLPutData",if you can.



> > 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
> 


More information about the FreeTDS mailing list