- Use narrow functions in sql_odbc.cpp

- Remove use of TCHAR types
This commit is contained in:
xboi209 2016-08-12 20:54:35 -07:00
parent 1e36d4995d
commit 96d017284f

View file

@ -93,14 +93,14 @@ namespace pvpgn
#define p_SQLAllocConnect SQLAllocConnect
#define p_SQLAllocStmt SQLAllocStmt
#define p_SQLBindCol SQLBindCol
#define p_SQLColAttribute SQLColAttribute
#define p_SQLConnect SQLConnect
#define p_SQLColAttribute SQLColAttributeA
#define p_SQLConnect SQLConnectA
#define p_SQLDisconnect SQLDisconnect
#define p_SQLExecDirect SQLExecDirect
#define p_SQLExecDirect SQLExecDirectA
#define p_SQLFetch SQLFetch
#define p_SQLFreeHandle SQLFreeHandle
#define p_SQLRowCount SQLRowCount
#define p_SQLGetDiagRec SQLGetDiagRec
#define p_SQLGetDiagRec SQLGetDiagRecA
#define p_SQLNumResultCols SQLNumResultCols
#else
/* RUNTIME_LIBS */
@ -387,18 +387,21 @@ namespace pvpgn
return NULL;
}
fields[fieldCount] = NULL;
for (i = 0; i < fieldCount; i++) {
TCHAR *fName;
TCHAR *tmp;
for (i = 0; i < fieldCount; i++)
{
SQLSMALLINT fNameSz;
p_SQLColAttribute(res->stmt, i + 1, SQL_DESC_NAME, NULL, 0, &fNameSz, NULL);
fName = (TCHAR *)xmalloc(fNameSz);
if (!fName) {
char* fName = (char*)xmalloc(fNameSz);
if (!fName)
{
return NULL;
}
p_SQLColAttribute(res->stmt, i + 1, SQL_DESC_NAME, fName, fNameSz, &fNameSz, NULL);
tmp = fName;
for (; *tmp; ++tmp) *tmp = safe_toupper(*tmp);
char* tmp = fName;
for (; *tmp; ++tmp)
{
*tmp = safe_toupper(*tmp);
}
fields[i] = fName;
}
return fields;
@ -450,12 +453,13 @@ namespace pvpgn
row[fieldCount] = NULL;
sizes = (SQLINTEGER *)xcalloc(sizeof *sizes, fieldCount);
for (i = 0; i < fieldCount; i++) {
TCHAR *cell;
for (i = 0; i < fieldCount; i++)
{
SQLLEN cellSz;
p_SQLColAttribute(stmt, i + 1, SQL_DESC_DISPLAY_SIZE, NULL, 0, NULL, &cellSz);
cell = (TCHAR *)xcalloc(sizeof *cell, ++cellSz);
if (!cell) {
char* cell = (char*)xcalloc(sizeof *cell, ++cellSz);
if (!cell)
{
return NULL;
}
p_SQLBindCol(stmt, i + 1, SQL_C_CHAR, cell, cellSz, &sizes[i]);