# Compiles. Doesn't work yet. Unless leaking memory counts as 'working'.

# Trying to finish before RC1...
This commit is contained in:
Jouni Ahto 2000-03-12 19:44:23 +00:00
parent 85940d676f
commit bd1140e71d
2 changed files with 2407 additions and 798 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,30 +1,19 @@
/* /*
+----------------------------------------------------------------------+ +----------------------------------------------------------------------+
| PHP HTML Embedded Scripting Language Version 3.0 | | PHP version 4.0 |
+----------------------------------------------------------------------+ +----------------------------------------------------------------------+
| Copyright (c) 1997,1998 PHP Development Team (See Credits file) | | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
+----------------------------------------------------------------------+ +----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify | | This source file is subject to version 2.01 of the PHP license, |
| it under the terms of one of the following licenses: | | that is bundled with this package in the file LICENSE, and is |
| | | available at through the world-wide-web at |
| A) the GNU General Public License as published by the Free Software | | http://www.php.net/license/2_01.txt. |
| Foundation; either version 2 of the License, or (at your option) | | If you did not receive a copy of the PHP license and are unable to |
| any later version. | | obtain it through the world-wide-web, please send a note to |
| | | license@php.net so we can mail you a copy immediately. |
| B) the PHP License as published by the PHP Development Team and |
| included in the distribution in the file: LICENSE |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of both licenses referred to here. |
| If you did not, or have any questions about PHP licensing, please |
| contact core@php.net. |
+----------------------------------------------------------------------+ +----------------------------------------------------------------------+
| Authors: Jouni Ahto <jah@cultnet.fi> | | Authors: Jouni Ahto <jah@mork.net> |
| | | Andrew Avdeev <andy@simgts.mv.ru> |
+----------------------------------------------------------------------+ +----------------------------------------------------------------------+
*/ */
@ -42,11 +31,18 @@
#include <ibase.h> #include <ibase.h>
extern zend_module_entry ibase_module_entry; extern zend_module_entry ibase_module_entry;
#define php_ibase_module_ptr &ibase_module_entry #define phpext_interbase_ptr &ibase_module_entry
#ifdef PHP_WIN32
#define PHP_IBASE_API __declspec(dllexport)
#else
#define PHP_IBASE_API
#endif
extern PHP_MINIT_FUNCTION(ibase); extern PHP_MINIT_FUNCTION(ibase);
extern PHP_RINIT_FUNCTION(ibase); extern PHP_RINIT_FUNCTION(ibase);
extern PHP_MSHUTDOWN_FUNCTION(ibase); extern PHP_MSHUTDOWN_FUNCTION(ibase);
extern PHP_MSHUTDOWN_FUNCTION(ibase);
PHP_MINFO_FUNCTION(ibase); PHP_MINFO_FUNCTION(ibase);
PHP_FUNCTION(ibase_connect); PHP_FUNCTION(ibase_connect);
@ -54,53 +50,123 @@ PHP_FUNCTION(ibase_pconnect);
PHP_FUNCTION(ibase_close); PHP_FUNCTION(ibase_close);
PHP_FUNCTION(ibase_query); PHP_FUNCTION(ibase_query);
PHP_FUNCTION(ibase_fetch_row); PHP_FUNCTION(ibase_fetch_row);
PHP_FUNCTION(ibase_fetch_object);
PHP_FUNCTION(ibase_free_result); PHP_FUNCTION(ibase_free_result);
PHP_FUNCTION(ibase_prepare); PHP_FUNCTION(ibase_prepare);
PHP_FUNCTION(ibase_bind);
PHP_FUNCTION(ibase_execute); PHP_FUNCTION(ibase_execute);
PHP_FUNCTION(ibase_free_query); PHP_FUNCTION(ibase_free_query);
PHP_FUNCTION(ibase_timefmt); PHP_FUNCTION(ibase_timefmt);
PHP_FUNCTION(ibase_num_fields);
PHP_FUNCTION(ibase_field_info);
PHP_FUNCTION(ibase_trans);
PHP_FUNCTION(ibase_commit);
PHP_FUNCTION(ibase_rollback);
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);
PHP_FUNCTION(ibase_errmsg);
#define IBASE_MSGSIZE 256
#define MAX_ERRMSG (IBASE_MSGSIZE*2)
#define IBASE_TRANS_ON_LINK 10
#define IBASE_BLOB_SEG 4096
typedef struct { typedef struct {
ISC_STATUS status[20];
long default_link; long default_link;
long num_links, num_persistent; long num_links, num_persistent;
long max_links, max_persistent; long max_links, max_persistent;
long allow_persistent; long allow_persistent;
int le_link, le_plink, le_result, le_query; int le_blob, le_link, le_plink, le_result, le_query;
char *default_user, *default_password; char *default_user, *default_password;
long manualtransactions;
char *timeformat; char *timeformat;
} ibase_module; char *cfg_timeformat;
char *errmsg;
} php_ibase_globals;
typedef struct _php_ibase_result { typedef struct {
isc_stmt_handle result; isc_tr_handle trans[IBASE_TRANS_ON_LINK];
isc_tr_handle trans; isc_db_handle link;
XSQLDA *sqlda; } ibase_db_link;
int commitok;
} ibase_result_handle;
typedef struct _php_ibase_query { typedef struct {
isc_stmt_handle query; ISC_ARRAY_DESC ar_desc;
int el_type, /* sqltype kinda SQL_TEXT, ...*/
el_size; /* element size in bytes */
ISC_LONG ISC_FAR ar_size; /* all array size in bytes */
} ibase_array;
typedef struct {
isc_tr_handle trans_handle;
isc_db_handle link;
ISC_QUAD bl_qd;
isc_blob_handle bl_handle;
} ibase_blob_handle;
typedef struct {
isc_db_handle link; /* db link for this result */
isc_tr_handle trans; isc_tr_handle trans;
XSQLDA *sqlda; isc_stmt_handle stmt;
int alloced; XSQLDA *in_sqlda, *out_sqlda;
} ibase_query_handle; ibase_array *in_array, *out_array;
int in_array_cnt, out_array_cnt;
} ibase_query;
typedef struct {
isc_db_handle link; /* db link for this result */
isc_tr_handle trans;
isc_stmt_handle stmt;
int drop_stmt;
XSQLDA *out_sqlda;
ibase_array *out_array;
} ibase_result;
typedef struct _php_ibase_varchar { typedef struct _php_ibase_varchar {
short var_len; short var_len;
char var_str[1]; char var_str[1];
} IBASE_VCHAR; } IBASE_VCHAR;
/*
extern ibase_module php_ibase_module; extern ibase_module php_ibase_module;
*/
enum php_interbase_option {
PHP_IBASE_DEFAULT = 0,
PHP_IBASE_TEXT = 1,
PHP_IBASE_TIMESTAMP = 2,
PHP_IBASE_READ = 4,
PHP_IBASE_COMMITTED = 8,
PHP_IBASE_CONSISTENCY = 16,
PHP_IBASE_NOWAIT = 32
};
#ifdef ZTS
#define IBLS_D php_ibase_globals *ibase_globals
#define IBG(v) (ibase_globals->v)
#define IBLS_FETCH() php_ibase_globals *ibase_globals = ts_resource(ibase_globals_id)
#else
#define IBLS_D
#define IBG(v) (ibase_globals.v)
#define IBLS_FETCH()
extern PHP_IBASE_API php_ibase_globals ibase_globals;
#endif
#else #else
#define php_ibase_module_ptr NULL #define phpext_interbase_ptr NULL
#endif /* HAVE_IBASE */ #endif /* HAVE_IBASE */
#define phpext_interbase_ptr php_ibase_module_ptr
#endif /* _PHP_IBASE_H */ #endif /* _PHP_IBASE_H */
/* /*