]> git.saurik.com Git - wxWidgets.git/blame - src/iodbc/henv.c
Better disabling of toolbars and menubars
[wxWidgets.git] / src / iodbc / henv.c
CommitLineData
1a6944fd 1/** Environment object managment functions
7e616b10
RR
2
3 Copyright (C) 1995 by Ke Jin <kejin@empress.com>
1a6944fd
RR
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14**/
15
16#include <../iodbc/iodbc.h>
17
18#include <../iodbc/isql.h>
19#include <../iodbc/isqlext.h>
20
21#include <../iodbc/dlproc.h>
22
23#include <../iodbc/herr.h>
24#include <../iodbc/henv.h>
25
26#include <../iodbc/itrace.h>
27
7e616b10 28RETCODE SQL_API SQLAllocEnv( HENV FAR* phenv )
1a6944fd 29{
7e616b10 30 GENV_t FAR* genv;
1a6944fd 31
7e616b10 32 genv = (GENV_t*)MEM_ALLOC( sizeof(GENV_t) );
1a6944fd 33
7e616b10
RR
34 if( genv == NULL )
35 {
36 *phenv = SQL_NULL_HENV;
1a6944fd 37
7e616b10
RR
38 return SQL_ERROR;
39 }
1a6944fd
RR
40
41#if (ODBCVER >= 0x0300 )
7e616b10 42 genv->type = SQL_HANDLE_ENV;
1a6944fd
RR
43#endif
44
7e616b10
RR
45 genv->henv = SQL_NULL_HENV; /* driver's env list */
46 genv->hdbc = SQL_NULL_HDBC; /* driver's dbc list */
47 genv->herr = SQL_NULL_HERR; /* err list */
1a6944fd 48
7e616b10 49 *phenv = (HENV)genv;
1a6944fd 50
7e616b10 51 return SQL_SUCCESS;
1a6944fd
RR
52}
53
7e616b10 54RETCODE SQL_API SQLFreeEnv ( HENV henv )
1a6944fd 55{
7e616b10 56 GENV_t FAR* genv = (GENV_t*)henv;
1a6944fd 57
7e616b10
RR
58 if( henv == SQL_NULL_HENV )
59 {
60 return SQL_INVALID_HANDLE;
61 }
1a6944fd 62
7e616b10
RR
63 if( genv->hdbc != SQL_NULL_HDBC )
64 {
65 PUSHSQLERR ( genv->herr, en_S1010 );
1a6944fd 66
7e616b10
RR
67 return SQL_ERROR;
68 }
1a6944fd 69
7e616b10 70 _iodbcdm_freesqlerrlist( genv->herr );
1a6944fd 71
7e616b10 72 MEM_FREE( henv );
1a6944fd 73
7e616b10 74 return SQL_SUCCESS;
1a6944fd 75}