NDBT_ALLOCHANDLE.cpp
上传用户:romrleung
上传日期:2022-05-23
资源大小:18897k
文件大小:1k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. /* Copyright (C) 2003 MySQL AB
  2.    This program is free software; you can redistribute it and/or modify
  3.    it under the terms of the GNU General Public License as published by
  4.    the Free Software Foundation; either version 2 of the License, or
  5.    (at your option) any later version.
  6.    This program is distributed in the hope that it will be useful,
  7.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  8.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  9.    GNU General Public License for more details.
  10.    You should have received a copy of the GNU General Public License
  11.    along with this program; if not, write to the Free Software
  12.    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
  13. #include "common.h"
  14. #include <NdbTest.hpp>
  15. #include <NdbMain.h>
  16. SQLRETURN SQLHENV_check, SQLHENV_FREE_check;
  17. int NDBT_ALLOCHANDLE()
  18. {
  19.       /*****************************HENV Handle*****************************/
  20.       SQLHENV     henv;
  21.       SQLHENV_check = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
  22.       if (SQLHENV_check == -1) {
  23. return(-1);
  24. //return NDBT_ProgramExit(NDBT_FAILED);
  25.       }
  26.       if (SQLHENV_check == 0) {
  27. return 0;
  28.       }
  29.       SQLHENV_FREE_check = SQLFreeHandle(SQL_HANDLE_ENV, henv);
  30.       if (SQLHENV_FREE_check == -1) {
  31. // Deallocate any allocated memory, if it exists
  32. return(-1);
  33. //return NDBT_ProgramExit(NDBT_FAILED);
  34.       }
  35.       if (SQLHENV_FREE_check == 0) {
  36.       return 0;
  37.       }
  38.       return 0;
  39. }