close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 9 years ago

Closed 9 years ago

#1913 closed defect (fixed)

ODBC falla recuperando varchar(max) desde SQL Server

Reported by: Jorge Owned by: Jorge
Priority: highest Milestone: Mantainance
Component: Database Version: head
Severity: blocker Keywords:
Cc:

Description

Cuando se intenta recuperar los datos para una consulta que contienen un campo varchar(max) desde un servidor SQLServer, se produce un fallo de memoria ya que no se trata correctamente el valor de retorno SQL_NO_TOTAL (-4)

Ver el mismo problema reportado aquí.

http://blogs.msdn.com/b/sqldev/archive/2008/08/26/sqlgetdata-function-returns-sql-no-total-4-for-strlen-or-indptr-argument-in-snac-odbc.aspx

Change History (3)

comment:1 Changed 9 years ago by Jorge

Status: newaccepted

comment:2 Changed 9 years ago by Jorge

WCHAR* pBufOrig, pBuffer = new WCHAR[100];
SQLGetData(.... iCol … pBuffer, 100, &iSize);   // Get original chunk
while(NOT ALL DATA RETREIVED (SQL_NO_TOTAL, ...) ) {
    pBuffer += 50;   // Advance buffer for data retrieved
    // May need to realloc the buffer when you reach current size
    SQLGetData(.... iCol … pBuffer, 100, &iSize);   // Get next chunk
}

comment:3 Changed 9 years ago by Jorge

Resolution: fixed
Status: acceptedclosed

(In [7235]) fixes #1913, se reimplementa la lógica para extraer las cadenas de caracteres muy grandes. SQlGetData retorna SQL_NO_DATA cuando ya no hay más datos por retornar. Correciones a los test.

Note: See TracTickets for help on using tickets.