/************************************************************************ * name: SQLGetInfoW * arguments: * returns/side-effects: * description: * NOTE: ************************************************************************/ ODBC_INTERFACE RETCODE SQL_API SQLGetInfoW (SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, SQLPOINTER InfoValue, SQLSMALLINT BufferLength, SQLSMALLINT * StringLength) { RETCODE rc = SQL_SUCCESS; SQLLEN tmp_StringLength; SQLWCHAR *wvalue; OutputDebugString ("SQLGetInfoW called\n"); DEBUG_TIMESTAMP (START_SQLGetInfoW); odbc_free_diag (((ODBC_CONNECTION *) ConnectionHandle)->diag, RESET); rc = odbc_get_info ((ODBC_CONNECTION *) ConnectionHandle, InfoType, InfoValue, BufferLength, &tmp_StringLength); if (InfoValue) { BufferLength /= sizeof (SQLWCHAR); if (StringLength != NULL) { *StringLength = (SQLSMALLINT)tmp_StringLength * sizeof (SQLWCHAR); } if (InfoValue && StringLength) { bytes_to_wide_char (InfoValue, tmp_StringLength, &wvalue, 0, NULL, "utf-8"); if(wvalue != NULL) { (void)memcpy ((char *)InfoValue, (const char *)wvalue, *StringLength); ((SQLWCHAR *)InfoValue)[*StringLength / 2] = 0; UT_FREE_BSTR (wvalue); } } } DEBUG_TIMESTAMP (END_SQLGetInfo); ODBC_RETURN (rc, ConnectionHandle); }
/************************************************************************ * name: odbc_free_desc * arguments: * returns/side-effects: * description: * NOTE: * desc->con이 null이 아니면 con에 연결된 explicit desc로 간주한다. ************************************************************************/ PUBLIC RETCODE odbc_free_desc (ODBC_DESC * desc) { ODBC_DESC *d, *prev; if (desc == NULL) { goto error; } // for explicit, remove link with connection handle if (desc->conn != NULL) { for (d = desc->conn->descriptors, prev = NULL; d != NULL && d != desc; d = d->next) { prev = d; } if (d == desc) { if (prev != NULL) prev->next = desc->next; else desc->conn->descriptors = desc->next; } } odbc_free_all_records (desc->records); desc->records = NULL; odbc_free_diag (desc->diag, FREE_ALL); desc->diag = NULL; UT_FREE (desc); return ODBC_SUCCESS; error: return ODBC_ERROR; }
PUBLIC RETCODE odbc_free_env (ODBC_ENV * env) { ODBC_ENV *e, *prev; if (env->conn != NULL) { /* HY010 - DM */ odbc_set_diag (env->diag, "HY010", 0, NULL); return ODBC_ERROR; } /* remove from list */ for (e = odbc_environments, prev = NULL; e != NULL && e != env; e = e->next) { prev = e; } if (e == env) { if (prev != NULL) { prev->next = env->next; } else { odbc_environments = env->next; } } odbc_free_diag (env->diag, FREE_ALL); env->diag = NULL; NC_FREE (env->program_name); UT_FREE (env); return ODBC_SUCCESS; }