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

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 SQLHENVFREE_check, SQLHDBC_check;
  17. // NDB_COMMAND(SQLTest1, ......., 65535)
  18. int NDBT_ALLOCHANDLE_HDBC()
  19. {
  20.       SQLHENV     henv;
  21.       SQLHDBC     hdbc;
  22.       /*****************************HDBC Handle*****************************/
  23.       SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
  24.       SQLHDBC_check = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
  25.       if (SQLHDBC_check == -1) {
  26.       return NDBT_ProgramExit(NDBT_FAILED);
  27.       }
  28.       if (SQLHDBC_check == 0) {
  29.       return 0;
  30.       }
  31.       SQLHENVFREE_check = SQLFreeHandle(SQL_HANDLE_ENV, henv);
  32.       if (SQLHENVFREE_check == -1) {
  33. // Deallocate any allocated memory, if it exists
  34. return(-1);
  35. //return NDBT_ProgramExit(NDBT_FAILED);
  36.       }
  37.       if (SQLHENVFREE_check == 0) {
  38.       return 0;
  39.       }
  40. }