RETCODE SQL_API SQLAllocEnv(HENV FAR * EnvironmentHandle) { RETCODE ret; mylog("[SQLAllocEnv]"); ret = PGAPI_AllocEnv(EnvironmentHandle); return ret; }
/* SQLAllocConnect/SQLAllocEnv/SQLAllocStmt -> SQLAllocHandle */ RETCODE SQL_API SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE * OutputHandle) { CSTR func = "SQLAllocHandle"; RETCODE ret; ConnectionClass *conn; mylog("[[%s]]", func); switch (HandleType) { case SQL_HANDLE_ENV: ret = PGAPI_AllocEnv(OutputHandle); break; case SQL_HANDLE_DBC: ENTER_ENV_CS((EnvironmentClass *) InputHandle); ret = PGAPI_AllocConnect(InputHandle, OutputHandle); LEAVE_ENV_CS((EnvironmentClass *) InputHandle); break; case SQL_HANDLE_STMT: ENTER_CONN_CS((ConnectionClass *) InputHandle); ret = PGAPI_AllocStmt(InputHandle, OutputHandle); LEAVE_CONN_CS((ConnectionClass *) InputHandle); break; case SQL_HANDLE_DESC: conn = (ConnectionClass *) InputHandle; ENTER_CONN_CS(conn); ret = PGAPI_AllocDesc(InputHandle, OutputHandle); LEAVE_CONN_CS(conn); inolog("OutputHandle=%p\n", *OutputHandle); break; default: ret = SQL_ERROR; break; } return ret; }