[freetds] ct_param differences between 0.62 and 0.63

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Mon Jul 25 07:44:23 EDT 2005


> 
> Hi Iain,
> 
> Your diagnosis is correct. 
> This functionality did regress somewhere between 0.62 and 0.63, 
> as a result of improvements to the "query with ? 
> placeholders" logic for
> both ODBC and ct-library (ct_dynamic)
> 
> I have fixed and improved this now. 
> A patch will be on its way to freetds this week.
> 
> Bill
> 

Mmm... why doesn't ct_results return CS_CMD_FAIL?

It seems that problem is in token.c

case TDS_DONEPROC_TOKEN:
        SET_RETURN(TDS_DONEPROC_RESULT, DONE);
        rc = tds_process_end(tds, marker, done_flags);
        switch (tds->internal_sp_called ) {
                case 0:
                case TDS_SP_PREPARE:
                case TDS_SP_EXECUTE:
                case TDS_SP_UNPREPARE:
                        break;
                case TDS_SP_CURSOROPEN:
                        *result_type       = TDS_DONE_RESULT;
                        tds->rows_affected = saved_rows_affected;
                        break;
                case TDS_SP_CURSORCLOSE:
                        tdsdump_log(TDS_DBG_FUNC,
"TDS_SP_CURSORCLOSE\n");
                        if (tds->cur_cursor) {

                                TDSCURSOR  *cursor = tds->cur_cursor;

                                cursor->srv_status &=
~TDS_CUR_ISTAT_OPEN;
                                cursor->srv_status |=
TDS_CUR_ISTAT_CLOSED;
                                cursor->srv_status |=
TDS_CUR_ISTAT_DECLARED;
                                if (cursor->status.dealloc == 2) {
                                        tds_free_cursor(tds, cursor);
                                }
                        }
                        *result_type = TDS_NO_MORE_RESULTS;
                        rc = TDS_NO_MORE_RESULTS;
                        break;
                default:
                        *result_type = TDS_NO_MORE_RESULTS;
                        rc = TDS_NO_MORE_RESULTS;
                        break;
        }
        break;

on parameters tds_submit_query_params is called (ct.c), then
tds->internal_sp_called is set to TDS_SP_EXECUTESQL so
TDS_DONEPROC_TOKENS (that contains error) is not returned, error is not
detected and lang_ct_param test pass... 
Note also that tds_submit_query_params do not accept @param style in
language...

freddy77



More information about the FreeTDS mailing list