File: esqlc_v5.ec

package info (click to toggle)
libdbd-informix-perl 2003.04-3
  • links: PTS
  • area: contrib
  • in suites: etch, etch-m68k, sarge
  • size: 1,232 kB
  • ctags: 467
  • sloc: perl: 7,349; ansic: 5,340; sh: 184; makefile: 58
file content (71 lines) | stat: -rw-r--r-- 1,831 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * @(#)$Id: esqlc_v5.ec,v 100.2 2002/12/06 22:18:24 jleffler Exp $
 *
 * DBD::Informix for Perl Version 5 -- implementation details
 *
 * Code acceptable to ESQL/C Version 5.0x
 *
 * Copyright 1996-98 Jonathan Leffler
 * Copyright 2002    IBM
 *
 * You may distribute under the terms of either the GNU General Public
 * License or the Artistic License, as specified in the Perl README file.
 */

/*TABSTOP=4*/

#include <string.h>
#include "esqlperl.h"

#ifndef lint
static const char rcs[] = "@(#)$Id: esqlc_v5.ec,v 100.2 2002/12/06 22:18:24 jleffler Exp $";
#endif

/* ================================================================= */
/* =================== Database Level Operations =================== */
/* ================================================================= */

/* Open database, possibly on a 'remote' host */
Boolean
dbd_ix_opendatabase(char *dbase)
{
	EXEC SQL BEGIN DECLARE SECTION;
	char           *dbname = dbase;
	EXEC SQL END DECLARE SECTION;
	Boolean         conn_ok = False;

	if (dbase == (char *)0 || *dbase == '\0')
	{
		dbd_ix_debug(1, "ESQL/C 5.0x 'implicit' DATABASE - %s\n", "no-op");
		sqlca.sqlcode = 0;
		conn_ok = True;
	}
	else
	{
		dbd_ix_debug(1, "DATABASE %s\n", dbname);
		EXEC SQL DATABASE :dbname;
		if (sqlca.sqlcode == 0)
			conn_ok = True;
	}
	return(conn_ok);
}

void
dbd_ix_closedatabase(char *dbname)
{
	dbd_ix_debug(1, "CLOSE DATABASE %s\n", (dbname ? dbname : ""));
	EXEC SQL CLOSE DATABASE;
	if ((dbname == 0 || *dbname == '\0') && sqlca.sqlcode == -349)
	{
		/* -349: Database not selected yet. */
		/* Fib about failure to close database */
		sqlca.sqlcode = 0;
	}
}

/* Ensure that the correct connection is current -- a no-op in version 5.0x */
void dbd_ix_setconnection(char *conn)
{
	dbd_ix_debug(1, "SET CONNECTION - %s (NO-OP)\n", conn);
	sqlca.sqlcode = 0;
}