6 * Environment object management functions
8 * The iODBC driver manager.
10 * Copyright (C) 1995 by Ke Jin <kejin@empress.com>
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
40 SQLAllocEnv (HENV FAR
* phenv
)
44 genv
= (GENV_t
*) MEM_ALLOC (sizeof (GENV_t
));
48 *phenv
= SQL_NULL_HENV
;
53 #if (ODBCVER >= 0x0300 )
54 genv
->type
= SQL_HANDLE_ENV
;
57 genv
->henv
= SQL_NULL_HENV
; /* driver's env list */
58 genv
->hdbc
= SQL_NULL_HDBC
; /* driver's dbc list */
59 genv
->herr
= SQL_NULL_HERR
; /* err list */
68 SQLFreeEnv (HENV henv
)
70 GENV_t FAR
*genv
= (GENV_t
*) henv
;
72 if (henv
== SQL_NULL_HENV
)
74 return SQL_INVALID_HANDLE
;
77 if (genv
->hdbc
!= SQL_NULL_HDBC
)
79 PUSHSQLERR (genv
->herr
, en_S1010
);
84 _iodbcdm_freesqlerrlist (genv
->herr
);