1999-04-22 10:48:28 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
2001-12-11 23:32:16 +08:00
|
|
|
| PHP Version 4 |
|
1999-04-22 10:48:28 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2003-01-01 00:08:15 +08:00
|
|
|
| Copyright (c) 1997-2003 The PHP Group |
|
1999-04-22 10:48:28 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2003-06-11 04:04:29 +08:00
|
|
|
| This source file is subject to version 3.0 of the PHP license, |
|
2000-03-13 03:44:23 +08:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
2003-06-11 04:04:29 +08:00
|
|
|
| available through the world-wide-web at the following url: |
|
|
|
|
| http://www.php.net/license/3_0.txt. |
|
2000-03-13 03:44:23 +08:00
|
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@php.net so we can mail you a copy immediately. |
|
1999-04-22 10:48:28 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2001-01-04 19:15:35 +08:00
|
|
|
| Authors: Jouni Ahto <jouni.ahto@exdec.fi> |
|
|
|
|
| Andrew Avdeev <andy@simgts.mv.ru> |
|
2003-08-16 00:13:51 +08:00
|
|
|
| Ard Biesheuvel <a.k.biesheuvel@its.tudelft.nl> |
|
1999-04-22 10:48:28 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
2000-07-03 08:41:19 +08:00
|
|
|
#ifndef PHP_INTERBASE_H
|
|
|
|
#define PHP_INTERBASE_H
|
1999-04-22 10:48:28 +08:00
|
|
|
|
|
|
|
#include <ibase.h>
|
|
|
|
|
1999-12-18 04:55:31 +08:00
|
|
|
extern zend_module_entry ibase_module_entry;
|
2000-03-13 03:44:23 +08:00
|
|
|
#define phpext_interbase_ptr &ibase_module_entry
|
|
|
|
|
2001-07-30 09:56:43 +08:00
|
|
|
PHP_MINIT_FUNCTION(ibase);
|
|
|
|
PHP_RINIT_FUNCTION(ibase);
|
|
|
|
PHP_MSHUTDOWN_FUNCTION(ibase);
|
|
|
|
PHP_RSHUTDOWN_FUNCTION(ibase);
|
1999-08-02 23:02:52 +08:00
|
|
|
PHP_MINFO_FUNCTION(ibase);
|
|
|
|
|
1999-05-21 18:06:25 +08:00
|
|
|
PHP_FUNCTION(ibase_connect);
|
|
|
|
PHP_FUNCTION(ibase_pconnect);
|
|
|
|
PHP_FUNCTION(ibase_close);
|
2003-08-05 21:17:16 +08:00
|
|
|
PHP_FUNCTION(ibase_drop_db);
|
1999-05-21 18:06:25 +08:00
|
|
|
PHP_FUNCTION(ibase_query);
|
|
|
|
PHP_FUNCTION(ibase_fetch_row);
|
2002-03-15 23:26:01 +08:00
|
|
|
PHP_FUNCTION(ibase_fetch_assoc);
|
2000-03-13 03:44:23 +08:00
|
|
|
PHP_FUNCTION(ibase_fetch_object);
|
1999-05-21 18:06:25 +08:00
|
|
|
PHP_FUNCTION(ibase_free_result);
|
2003-08-07 01:51:46 +08:00
|
|
|
PHP_FUNCTION(ibase_name_result);
|
1999-05-21 18:06:25 +08:00
|
|
|
PHP_FUNCTION(ibase_prepare);
|
|
|
|
PHP_FUNCTION(ibase_execute);
|
|
|
|
PHP_FUNCTION(ibase_free_query);
|
2002-09-12 19:18:47 +08:00
|
|
|
#if HAVE_STRFTIME
|
1999-05-21 18:06:25 +08:00
|
|
|
PHP_FUNCTION(ibase_timefmt);
|
2002-09-12 19:18:47 +08:00
|
|
|
#endif
|
2003-09-24 04:58:14 +08:00
|
|
|
PHP_FUNCTION(ibase_gen_id);
|
2000-03-13 03:44:23 +08:00
|
|
|
PHP_FUNCTION(ibase_num_fields);
|
2003-08-11 04:53:19 +08:00
|
|
|
PHP_FUNCTION(ibase_num_params);
|
2003-08-16 09:58:29 +08:00
|
|
|
#if abies_0
|
2003-08-11 00:21:26 +08:00
|
|
|
PHP_FUNCTION(ibase_num_rows);
|
2003-08-16 09:58:29 +08:00
|
|
|
#endif
|
2003-08-11 00:21:26 +08:00
|
|
|
PHP_FUNCTION(ibase_affected_rows);
|
2000-03-13 03:44:23 +08:00
|
|
|
PHP_FUNCTION(ibase_field_info);
|
2003-08-11 04:53:19 +08:00
|
|
|
PHP_FUNCTION(ibase_param_info);
|
2000-03-13 03:44:23 +08:00
|
|
|
|
|
|
|
PHP_FUNCTION(ibase_trans);
|
|
|
|
PHP_FUNCTION(ibase_commit);
|
|
|
|
PHP_FUNCTION(ibase_rollback);
|
2003-08-07 01:51:46 +08:00
|
|
|
PHP_FUNCTION(ibase_commit_ret);
|
2000-03-13 03:44:23 +08:00
|
|
|
|
|
|
|
PHP_FUNCTION(ibase_blob_create);
|
|
|
|
PHP_FUNCTION(ibase_blob_add);
|
|
|
|
PHP_FUNCTION(ibase_blob_cancel);
|
|
|
|
PHP_FUNCTION(ibase_blob_open);
|
|
|
|
PHP_FUNCTION(ibase_blob_get);
|
|
|
|
PHP_FUNCTION(ibase_blob_close);
|
|
|
|
PHP_FUNCTION(ibase_blob_echo);
|
|
|
|
PHP_FUNCTION(ibase_blob_info);
|
|
|
|
PHP_FUNCTION(ibase_blob_import);
|
2002-06-07 03:51:04 +08:00
|
|
|
#ifdef SQL_DIALECT_V6
|
2002-01-27 23:31:15 +08:00
|
|
|
PHP_FUNCTION(ibase_add_user);
|
|
|
|
PHP_FUNCTION(ibase_modify_user);
|
|
|
|
PHP_FUNCTION(ibase_delete_user);
|
2003-09-04 22:18:39 +08:00
|
|
|
|
|
|
|
PHP_FUNCTION(ibase_rollback_ret);
|
2002-06-07 03:51:04 +08:00
|
|
|
#endif
|
2000-03-13 03:44:23 +08:00
|
|
|
PHP_FUNCTION(ibase_errmsg);
|
2003-08-08 19:04:12 +08:00
|
|
|
PHP_FUNCTION(ibase_errcode);
|
2000-03-13 03:44:23 +08:00
|
|
|
|
2003-08-14 18:55:02 +08:00
|
|
|
PHP_FUNCTION(ibase_wait_event);
|
2003-08-15 08:06:07 +08:00
|
|
|
PHP_FUNCTION(ibase_set_event_handler);
|
2003-08-16 00:13:51 +08:00
|
|
|
PHP_FUNCTION(ibase_free_event_handler);
|
2003-08-14 18:55:02 +08:00
|
|
|
|
2000-03-13 03:44:23 +08:00
|
|
|
#define IBASE_MSGSIZE 256
|
|
|
|
#define MAX_ERRMSG (IBASE_MSGSIZE*2)
|
2003-08-20 20:22:58 +08:00
|
|
|
|
|
|
|
/* this value should never be > USHRT_MAX */
|
2000-03-13 03:44:23 +08:00
|
|
|
#define IBASE_BLOB_SEG 4096
|
|
|
|
|
2000-07-05 12:21:00 +08:00
|
|
|
ZEND_BEGIN_MODULE_GLOBALS(ibase)
|
2003-07-10 09:40:01 +08:00
|
|
|
ISC_STATUS status[20];
|
1999-04-22 10:48:28 +08:00
|
|
|
long default_link;
|
|
|
|
long num_links, num_persistent;
|
|
|
|
long max_links, max_persistent;
|
|
|
|
long allow_persistent;
|
|
|
|
char *default_user, *default_password;
|
2000-05-12 11:02:14 +08:00
|
|
|
char *timestampformat;
|
|
|
|
char *cfg_timestampformat;
|
|
|
|
char *dateformat;
|
|
|
|
char *cfg_dateformat;
|
1999-04-22 10:48:28 +08:00
|
|
|
char *timeformat;
|
2000-03-13 03:44:23 +08:00
|
|
|
char *cfg_timeformat;
|
2003-08-07 09:00:22 +08:00
|
|
|
char errmsg[MAX_ERRMSG];
|
2003-08-08 19:04:12 +08:00
|
|
|
long sql_code;
|
2000-07-05 12:21:00 +08:00
|
|
|
ZEND_END_MODULE_GLOBALS(ibase)
|
2000-03-13 03:44:23 +08:00
|
|
|
|
|
|
|
typedef struct {
|
2003-08-13 02:08:13 +08:00
|
|
|
isc_db_handle handle;
|
2003-08-08 19:04:12 +08:00
|
|
|
struct tr_list *tr_list;
|
2000-07-18 04:51:47 +08:00
|
|
|
unsigned short dialect;
|
2000-03-13 03:44:23 +08:00
|
|
|
} ibase_db_link;
|
1999-04-22 10:48:28 +08:00
|
|
|
|
2000-07-07 20:06:05 +08:00
|
|
|
typedef struct {
|
2003-08-05 21:17:16 +08:00
|
|
|
isc_tr_handle handle;
|
2003-08-11 00:21:26 +08:00
|
|
|
unsigned short link_cnt;
|
|
|
|
unsigned long affected_rows;
|
2003-09-04 22:18:39 +08:00
|
|
|
ibase_db_link *db_link[1]; /* last member */
|
2003-08-05 21:17:16 +08:00
|
|
|
} ibase_trans;
|
|
|
|
|
|
|
|
typedef struct tr_list {
|
|
|
|
ibase_trans *trans;
|
|
|
|
struct tr_list *next;
|
|
|
|
} ibase_tr_list;
|
2000-07-07 20:06:05 +08:00
|
|
|
|
2000-03-13 03:44:23 +08:00
|
|
|
typedef struct {
|
|
|
|
ISC_ARRAY_DESC ar_desc;
|
2003-09-04 19:09:46 +08:00
|
|
|
ISC_LONG ar_size; /* size of entire array in bytes */
|
|
|
|
unsigned short el_type, el_size;
|
2000-03-13 03:44:23 +08:00
|
|
|
} ibase_array;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
isc_blob_handle bl_handle;
|
2003-08-18 08:14:53 +08:00
|
|
|
ISC_QUAD bl_qd;
|
|
|
|
unsigned short type;
|
2003-08-20 20:22:58 +08:00
|
|
|
} ibase_blob;
|
2000-03-13 03:44:23 +08:00
|
|
|
|
|
|
|
typedef struct {
|
2003-08-13 02:08:13 +08:00
|
|
|
ibase_db_link *link;
|
|
|
|
ibase_trans *trans;
|
2003-08-21 03:47:00 +08:00
|
|
|
isc_stmt_handle stmt;
|
2003-08-28 06:55:06 +08:00
|
|
|
unsigned short type;
|
2003-09-03 06:37:26 +08:00
|
|
|
unsigned char has_more_rows, statement_type;
|
2003-08-21 03:47:00 +08:00
|
|
|
XSQLDA *out_sqlda;
|
2003-09-04 22:18:39 +08:00
|
|
|
ibase_array out_array[1]; /* last member */
|
2003-08-21 03:47:00 +08:00
|
|
|
} ibase_result;
|
|
|
|
|
2003-08-28 06:55:06 +08:00
|
|
|
typedef struct {
|
2003-08-21 03:47:00 +08:00
|
|
|
ibase_db_link *link;
|
|
|
|
ibase_trans *trans;
|
|
|
|
int result_res_id;
|
2000-03-13 03:44:23 +08:00
|
|
|
isc_stmt_handle stmt;
|
|
|
|
XSQLDA *in_sqlda, *out_sqlda;
|
|
|
|
ibase_array *in_array, *out_array;
|
2000-07-18 04:51:47 +08:00
|
|
|
unsigned short dialect;
|
2003-08-13 02:01:59 +08:00
|
|
|
char statement_type;
|
|
|
|
char *query;
|
2003-09-03 06:37:26 +08:00
|
|
|
long trans_res_id;
|
2000-03-13 03:44:23 +08:00
|
|
|
} ibase_query;
|
1999-04-22 10:48:28 +08:00
|
|
|
|
2000-03-13 03:44:23 +08:00
|
|
|
typedef struct {
|
2003-08-18 08:14:53 +08:00
|
|
|
ibase_db_link *link;
|
2003-09-03 06:37:26 +08:00
|
|
|
long link_res_id;
|
2003-08-15 08:06:07 +08:00
|
|
|
ISC_LONG event_id;
|
|
|
|
unsigned short event_count;
|
|
|
|
char **events;
|
|
|
|
char *event_buffer, *result_buffer;
|
|
|
|
zval *callback;
|
|
|
|
void **thread_ctx;
|
|
|
|
} ibase_event;
|
|
|
|
|
2000-03-13 03:44:23 +08:00
|
|
|
enum php_interbase_option {
|
2003-06-15 00:38:10 +08:00
|
|
|
PHP_IBASE_DEFAULT = 0,
|
2003-08-21 00:13:51 +08:00
|
|
|
/* fetch flags */
|
2003-08-16 23:31:06 +08:00
|
|
|
PHP_IBASE_FETCH_BLOBS = 1,
|
|
|
|
PHP_IBASE_FETCH_ARRAYS = 2,
|
2003-08-21 00:13:51 +08:00
|
|
|
PHP_IBASE_UNIXTIME = 4,
|
|
|
|
/* timefmt flags */
|
|
|
|
PHP_IBASE_TIMESTAMP = 1,
|
|
|
|
PHP_IBASE_DATE = 2,
|
|
|
|
PHP_IBASE_TIME = 4,
|
|
|
|
/* transaction access mode */
|
2003-09-26 18:06:22 +08:00
|
|
|
PHP_IBASE_WRITE = 1,
|
|
|
|
PHP_IBASE_READ = 2,
|
2003-08-21 00:13:51 +08:00
|
|
|
/* transaction isolation level */
|
2003-09-26 18:06:22 +08:00
|
|
|
PHP_IBASE_CONCURRENCY = 4,
|
|
|
|
PHP_IBASE_COMMITTED = 8,
|
|
|
|
PHP_IBASE_REC_NO_VERSION = 32,
|
|
|
|
PHP_IBASE_REC_VERSION = 64,
|
|
|
|
PHP_IBASE_CONSISTENCY = 16,
|
2003-08-21 00:13:51 +08:00
|
|
|
/* transaction lock resolution */
|
2003-09-26 18:06:22 +08:00
|
|
|
PHP_IBASE_WAIT = 128,
|
|
|
|
PHP_IBASE_NOWAIT = 256
|
2000-03-13 03:44:23 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef ZTS
|
2001-07-28 19:36:37 +08:00
|
|
|
#define IBG(v) TSRMG(ibase_globals_id, zend_ibase_globals *, v)
|
2000-03-13 03:44:23 +08:00
|
|
|
#else
|
|
|
|
#define IBG(v) (ibase_globals.v)
|
|
|
|
#endif
|
1999-04-22 10:48:28 +08:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
2000-03-13 03:44:23 +08:00
|
|
|
#define phpext_interbase_ptr NULL
|
1999-04-22 10:48:28 +08:00
|
|
|
|
2000-07-03 08:41:19 +08:00
|
|
|
#endif /* PHP_INTERBASE_H */
|
1999-04-22 10:48:28 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* End:
|
|
|
|
*/
|