10 m_pResultSetMetaData = NULL;
42 while ((rc = tds_process_tokens(
m_pDatabase, &result_type, NULL, TDS_RETURN_ROW|TDS_TOKEN_RESULTS|TDS_RETURN_COMPUTE)) == TDS_SUCCESS)
48 case TDS_DONEPROC_RESULT:
49 case TDS_DONEINPROC_RESULT:
51 case TDS_STATUS_RESULT:
53 case TDS_ROWFMT_RESULT:
54 case TDS_COMPUTEFMT_RESULT:
55 case TDS_DESCRIBE_RESULT:
62 fprintf(stderr,
"Info: wxTdsResultSet processing tokens\n");
63 while (tds_process_tokens(
m_pDatabase, &result_type, NULL, TDS_RETURN_ROWFMT|TDS_RETURN_DONE|TDS_RETURN_ROW) == TDS_SUCCESS)
66 if (result_type != TDS_ROW_RESULT)
72 fprintf(stderr,
"Info: wxTdsResultSet done processing tokens\n");
76 fprintf(stderr,
"Info: wxTdsResultSet NOT processing tokens\n");
103 else if (rc != TDS_NO_MORE_RESULTS)
117 int nReturn = tds_process_tokens(
m_pDatabase, &nResultType, NULL, TDS_RETURN_ROWFMT|TDS_RETURN_ROW|TDS_RETURN_COMPUTE);
120 if (nReturn == TDS_SUCCESS && nResultType == TDS_ROWFMT_RESULT)
125 nReturn = tds_process_tokens(
m_pDatabase, &nResultType, NULL, TDS_RETURN_ROWFMT|TDS_RETURN_ROW);
129 return (nReturn == TDS_SUCCESS);
144 char* pCharBuffer =
new char[(curcol->column_name->dstr_size)+1];
145 memset(pCharBuffer, 0, (curcol->column_name->dstr_size)+1);
146 strncpy(pCharBuffer, curcol->column_name->dstr_s, curcol->column_name->dstr_size);
148 wxDELETEA(pCharBuffer);
200 TDSCOLUMN *curcol =
m_pDatabase->current_results->columns[nField-1];
201 TDS_CHAR *src = (TDS_CHAR *) curcol->column_data;
203 wxString strValue = wxEmptyString;
204 if (curcol->column_cur_size > 0)
206 char* pCharBuffer =
new char[(curcol->column_cur_size)+1];
207 memset(pCharBuffer, 0, (curcol->column_cur_size)+1);
208 strncpy(pCharBuffer, src, curcol->column_cur_size);
212 wxDELETEA(pCharBuffer);
221 TDSCOLUMN* curcol =
m_pDatabase->current_results->columns[nField-1];
222 const int* src = (
const int*) curcol->column_data;
226 wxString strValue = wxString::Format(_(
"%d"), *src);
227 strValue.ToLong(&nValue);
236 return (nValue != 0);
242 TDSCOLUMN* curcol =
m_pDatabase->current_results->columns[nField-1];
243 TDS_DATETIME* dateTime = (TDS_DATETIME*) curcol->column_data;
246 if (curcol->column_cur_size < 0)
247 return wxInvalidDateTime;
250 TDS_INT nReturn = tds_datecrack(SYBDATETIME, dateTime, &dateRec);
251 if (nReturn == TDS_FAIL)
252 return wxInvalidDateTime;
257 date.Set(dateRec.day, wxDateTime::Month(dateRec.month), dateRec.year,
258 dateRec.hour, dateRec.minute, dateRec.second, dateRec.decimicrosecond*10000);
265 TDSCOLUMN *curcol =
m_pDatabase->current_results->columns[nField-1];
266 const double* src = (
const double*) curcol->column_data;
268 double dblValue = *src;
275 TDSCOLUMN *curcol =
m_pDatabase->current_results->columns[nField-1];
276 TDS_CHAR *src = (TDS_CHAR *) curcol->column_data;
278 if (curcol->column_cur_size < 0)
281 if (is_blob_type(curcol->column_type))
283 TDSBLOB *blob = (TDSBLOB*) src;
285 src = blob->textvalue;
293 int nLength = curcol->column_cur_size;
295 void* pBuffer = Buffer.GetWriteBuf(nLength);
296 memcpy(pBuffer, src, nLength);
298 Buffer.SetDataLen(nLength);
301 return Buffer.GetData();
329 TDSCOLUMN *curcol =
m_pDatabase->current_results->columns[nField-1];
332 if (curcol->column_cur_size < 0)
343 wxString msg(_(
"Field '") + strField + _(
"' not found in the resultset"));
344 #if wxUSE_DATABASE_EXCEPTIONS 354 return ((*SearchIterator).second + 1);
370 int nReturn = tds_process_tokens(
m_pDatabase, &nResultType, NULL, TDS_RETURN_ROWFMT);
372 if (nReturn == TDS_SUCCESS && nResultType == TDS_ROWFMT_RESULT)
385 if (pDatabase != NULL)
392 #endif//wxUSE_DATABASE_TDS
virtual wxString GetResultString(int nField)
Retrieve a wxString from the result set by the 1-based field index.
void SetErrorInformationFromDatabaseLayer()
wxResultSetMetaData * m_pResultSetMetaData
virtual bool IsFieldNull(int nField)
Check if a field in the current result set record is NULL.
static wxTdsDatabase * LookupTdsLayer(const TDSCONTEXT *pContext)
void LogMetaDataForCleanup(wxResultSetMetaData *pMetaData)
Add meta data object pointer to the list for "garbage collection".
wxTdsResultSet(TDSSOCKET *pDatabase)
virtual int GetResultInt(int nField)
Retrieve an integer from the result set by the 1-based field index.
virtual bool GetResultBool(int nField)
Retrieve a boolean from the result set by the 1-based field index.
virtual ~wxTdsResultSet()
virtual long GetResultLong(int nField)
Retrieve a long from the result set by the 1-based field index.
virtual bool Next()
Move to the next record in the result set.
#define wxDATABASE_FIELD_NOT_IN_RESULTSET
void ThrowDatabaseException()
const wxString & GetErrorMessage()
virtual wxResultSetMetaData * GetMetaData()
Retrieve the MetaData associated with this result set.
void CloseMetaData()
Close all meta data objects that have been generated but not yet closed.
void SetErrorMessage(const wxString &strErrorMessage)
virtual void Close()
Close the result set (call wxDatabase::CloseResultSet() instead on the result set)
virtual void * GetResultBlob(int nField, wxMemoryBuffer &Buffer)
Retrieve a BLOB from the result set by the 1-based field index.
StringToIntMap m_FieldLookupMap
void CreateResultSetMetaData()
virtual int LookupField(const wxString &strField)
void SetErrorCode(int nErrorCode)
TDSRESULTINFO * m_pResultInfo
virtual wxDateTime GetResultDate(int nField)
Retrieve a wxDateTime from the result set by the 1-based field index.
virtual wxString ConvertFromUnicodeStream(const char *inputBuffer)
virtual double GetResultDouble(int nField)
Retrieve a double from the result set by the 1-based field index.