RETCODE SQL_API SQLConnectW(HDBC ConnectionHandle, SQLWCHAR *ServerName, SQLSMALLINT NameLength1, SQLWCHAR *UserName, SQLSMALLINT NameLength2, SQLWCHAR *Authentication, SQLSMALLINT NameLength3) { CSTR func = "SQLConnectW"; char *svName, *usName, *auth; SQLLEN nmlen1, nmlen2, nmlen3; RETCODE ret; ConnectionClass *conn = (ConnectionClass *) ConnectionHandle; mylog("[%s]", func); CC_examine_global_transaction(conn); ENTER_CONN_CS(conn); CC_clear_error(conn); CC_set_in_unicode_driver(conn); svName = ucs2_to_utf8(ServerName, NameLength1, &nmlen1, FALSE); usName = ucs2_to_utf8(UserName, NameLength2, &nmlen2, FALSE); auth = ucs2_to_utf8(Authentication, NameLength3, &nmlen3, FALSE); ret = PGAPI_Connect(ConnectionHandle, (SQLCHAR *) svName, (SQLSMALLINT) nmlen1, (SQLCHAR *) usName, (SQLSMALLINT) nmlen2, (SQLCHAR *) auth, (SQLSMALLINT) nmlen3); LEAVE_CONN_CS(conn); if (svName) free(svName); if (usName) free(usName); if (auth) free(auth); return ret; }
RETCODE SQL_API SQLConnect(HDBC ConnectionHandle, SQLCHAR *ServerName, SQLSMALLINT NameLength1, SQLCHAR *UserName, SQLSMALLINT NameLength2, SQLCHAR *Authentication, SQLSMALLINT NameLength3) { RETCODE ret; ConnectionClass *conn = (ConnectionClass *) ConnectionHandle; mylog("[SQLConnect]"); ENTER_CONN_CS(conn); CC_clear_error(conn); ret = PGAPI_Connect(ConnectionHandle, ServerName, NameLength1, UserName, NameLength2, Authentication, NameLength3); LEAVE_CONN_CS(conn); return ret; }