-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.26 2008/02/07 11:09:13 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.26.2.1 2008/05/12 16:30:17 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
struct sqlca_t *sqlca = ECPGget_sqlca();
PGresult *query;
- ecpg_init_sqlca(sqlca);
-
con = ecpg_get_connection(connection_name);
+ if (!ecpg_init(con, connection_name, lineno))
+ return false;
+
/* check if we already have prepared this statement */
this = find_prepared_statement(name, con, &prev);
if (this && !deallocate_one(lineno, ECPG_COMPAT_PGSQL, con, prev, this))
con = ecpg_get_connection(connection_name);
+ if (!ecpg_init(con, connection_name, lineno))
+ return false;
+
this = find_prepared_statement(name, con, &prev);
if (this)
return deallocate_one(lineno, c, con, prev, this);
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.359.2.2 2008/03/01 03:26:44 tgl Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.359.2.3 2008/05/12 16:30:17 meskes Exp $ */
/* Copyright comment */
%{
ret_value = error_code;
break;
case ET_FATAL:
- fclose(yyin);
- fclose(yyout);
+ if (yyin)
+ fclose(yyin);
+ if (yyout)
+ fclose(yyout);
if (unlink(output_filename) != 0 && *output_filename != '-')
fprintf(stderr, "Could not remove output file %s!\n", output_filename);
exit(error_code);