set handle to NULL
John DeSoi <[email protected]> Mon, 12 Aug 2002 23:11:29 -0400
| Newsgroups | gmane.lisp.uffi.general |
|---|---|
| Message-ID | <p05111b0eb97e23c7ac8a@[192.168.1.6]> |
Ok, this seems like it should be so easy but I'm just not getting it.
I'm trying to do a little test with Firebird in LispWorks/UFFI for
the C code below.
The error I keep getting indicates that the db handle is invalid. In
the case of creating the database, the db handle needs to be NULL. So
how would I use UFFI to allocate the db (and transaction) handle so
that it would be equivalent to the C code below?
Thanks!
John DeSoi, Ph.D.
=====
int main (ARG(int, argc), ARG(char **, argv))
ARGLIST(int argc)
ARGLIST(char **argv)
{
isc_db_handle newdb = NULL; /* database handle */
isc_tr_handle trans = NULL; /* transaction handle */
long status[20]; /* status vector */
long sqlcode; /* SQLCODE */
char create_db[160]; /* 'create database' statement */
char new_dbname[128];
if (argc > 1)
strcpy(new_dbname, argv[1]);
else
strcpy(new_dbname, "new.gdb");
/*
* Construct a 'create database' statement.
* The database name could have been passed as a parameter.
*/
sprintf(create_db, "CREATE DATABASE '%s'", new_dbname);
/*
* Create a new database.
* The database handle is zero.
*/
if (isc_dsql_execute_immediate(status, &newdb, &trans, 0, create_db, 1,
NULL))
header stuff:
typedef void ISC_FAR *isc_db_handle;
typedef void ISC_FAR *isc_tr_handle;
ISC_STATUS ISC_EXPORT isc_dsql_execute_immediate (ISC_STATUS ISC_FAR *,
isc_db_handle ISC_FAR *,
isc_tr_handle ISC_FAR *,
unsigned short,
char ISC_FAR *,
unsigned short,
XSQLDA ISC_FAR *);