Skip to content

Commit

Permalink
support for SQLGetColAttributes and SQLDescribeCol
Browse files Browse the repository at this point in the history
- functions just use the IRD values; these will need to be populated
properly from the result set.
- change tracing handling of integer pointers -- added descriptors for
all SQL integer types;
- changed handling of SQL_DESC_MAX_LENGTH attribute;
- added a metatype to records, to distinguish the numerics, intervals
etc.
  • Loading branch information
bpintea committed Feb 9, 2018
1 parent 736ce91 commit 639a333
Show file tree
Hide file tree
Showing 10 changed files with 789 additions and 292 deletions.
12 changes: 9 additions & 3 deletions driver/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "connect.h"
#include "queries.h"
#include "log.h"
#include "info.h"

/*
* Not authoriative (there's no formal limit), but pretty informed:
Expand Down Expand Up @@ -143,7 +144,7 @@ static size_t write_callback(char *ptr, size_t size, size_t nmemb,
memcpy(dbc->abuff + dbc->apos, ptr, have);
dbc->apos += have;
DBG("libcurl: DBC@0x%p, copied: %zd bytes.", dbc, have);
DBG("libcurl: DBC@0x%p, copied: `%.*s`.", dbc, have, ptr);
//DBG("libcurl: DBC@0x%p, copied: `%.*s`.", dbc, have, ptr);


/*
Expand Down Expand Up @@ -837,6 +838,8 @@ SQLRETURN EsSQLGetConnectAttrW(
_Out_opt_ SQLINTEGER* StringLengthPtr)
{
esodbc_dbc_st *dbc = DBCH(ConnectionHandle);
SQLRETURN ret;
SQLSMALLINT used;
// SQLTCHAR *val;

switch(Attribute) {
Expand Down Expand Up @@ -870,8 +873,11 @@ SQLRETURN EsSQLGetConnectAttrW(
*(SQLTCHAR **)ValuePtr = val;
#else //0
// FIXME;
memcpy(ValuePtr, MK_TSTR("NulL"), 8);
((SQLTCHAR *)ValuePtr)[5] = 0;
ret = write_tstr(&dbc->diag, (SQLTCHAR *)ValuePtr,
MK_TSTR("NulL"), (SQLSMALLINT)BufferLength, &used);
if (StringLengthPtr);
*StringLengthPtr = (SQLINTEGER)used;
return ret;

#endif //0
break;
Expand Down
4 changes: 2 additions & 2 deletions driver/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ SQLRETURN post_diagnostic(esodbc_diag_st *dest, esodbc_state_et state,
assert(pos < ebufsz);
wcsncpy(dest->text, MK_TSTR(ESODBC_DIAG_PREFIX), pos);

if (ebufsz - pos <= tlen) {
if (ebufsz <= pos + tlen) {
wcsncpy(dest->text + pos, text, ebufsz - (pos + 1));
dest->text[ebufsz - 1] = 0;
dest->text_len = (int)ebufsz - 1;
} else {
wcsncpy(dest->text + pos, text, tlen + /* 0-term */1);
dest->text_len = (int)tlen;
dest->text_len = (int)(pos + tlen);
}
DBG("diagnostic message: `" LTPD "` (%d), native code: %d.", dest->text,
dest->text_len, dest->native_code);
Expand Down
Loading

0 comments on commit 639a333

Please sign in to comment.