diff options
| author | Wez Furlong <wez@php.net> | 2004-09-19 10:55:41 +0000 | 
|---|---|---|
| committer | Wez Furlong <wez@php.net> | 2004-09-19 10:55:41 +0000 | 
| commit | 2f161ab79d4af52fc7b21e98c0450f3900f83bce (patch) | |
| tree | b7d2d09b45173dadeeada5e32457efe32a36715f /ext/pdo_sqlite/pdo_sqlite.c | |
| parent | db7af4d8f00d489384406d5ebbfc66c42a74c6f4 (diff) | |
| download | php-git-2f161ab79d4af52fc7b21e98c0450f3900f83bce.tar.gz | |
First cut at a PDO driver for SQLite 3.x
Features:
- native prepare/execute and bound parameters.
- finally supports binary data (via bound parameter api)
- full unicode/utf-8 support
Missing:
- UDF functions
- authorizer hooks for safe_mode/open_basedir restrictions
You need to download, compile and install sqlite3 yourself; we're not bundling
it (at least, not yet).
Diffstat (limited to 'ext/pdo_sqlite/pdo_sqlite.c')
| -rw-r--r-- | ext/pdo_sqlite/pdo_sqlite.c | 122 | 
1 files changed, 122 insertions, 0 deletions
| diff --git a/ext/pdo_sqlite/pdo_sqlite.c b/ext/pdo_sqlite/pdo_sqlite.c new file mode 100644 index 0000000000..072246f743 --- /dev/null +++ b/ext/pdo_sqlite/pdo_sqlite.c @@ -0,0 +1,122 @@ +/* +  +----------------------------------------------------------------------+ +  | PHP Version 5                                                        | +  +----------------------------------------------------------------------+ +  | Copyright (c) 1997-2004 The PHP Group                                | +  +----------------------------------------------------------------------+ +  | This source file is subject to version 3.0 of the PHP license,       | +  | that is bundled with this package in the file LICENSE, and is        | +  | available through the world-wide-web at the following url:           | +  | http://www.php.net/license/3_0.txt.                                  | +  | 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.               | +  +----------------------------------------------------------------------+ +  | Author: Wez Furlong <wez@php.net>                                    | +  +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "php.h" +#include "php_ini.h" +#include "ext/standard/info.h" +#include "pdo/php_pdo.h" +#include "pdo/php_pdo_driver.h" +#include "php_pdo_sqlite.h" +#include "php_pdo_sqlite_int.h" +#include "zend_exceptions.h" + +#define PHP_PDO_SQLITE_MODULE_VERSION	"0.1-dev" + +/* {{{ pdo_sqlite_functions[] */ +function_entry pdo_sqlite_functions[] = { +	{NULL, NULL, NULL} +}; +/* }}} */ + +/* {{{ pdo_sqlite_module_entry + */ +zend_module_entry pdo_sqlite_module_entry = { +	STANDARD_MODULE_HEADER, +	"pdo_sqlite", +	pdo_sqlite_functions, +	PHP_MINIT(pdo_sqlite), +	PHP_MSHUTDOWN(pdo_sqlite), +	PHP_RINIT(pdo_sqlite), +	PHP_RSHUTDOWN(pdo_sqlite), +	PHP_MINFO(pdo_sqlite), +	PHP_PDO_SQLITE_MODULE_VERSION, +	STANDARD_MODULE_PROPERTIES +}; +/* }}} */ + +#ifdef COMPILE_DL_PDO_SQLITE +ZEND_GET_MODULE(pdo_sqlite) +#endif + +/* {{{ PHP_MINIT_FUNCTION */ +PHP_MINIT_FUNCTION(pdo_sqlite) +{ +	/* If you have INI entries, uncomment these lines  +	ZEND_INIT_MODULE_GLOBALS(pdo_sqlite, php_pdo_sqlite_init_globals, NULL); +	REGISTER_INI_ENTRIES(); +	*/ +	return SUCCESS; +} +/* }}} */ + +/* {{{ PHP_MSHUTDOWN_FUNCTION + */ +PHP_MSHUTDOWN_FUNCTION(pdo_sqlite) +{ +	/* uncomment this line if you have INI entries +	UNREGISTER_INI_ENTRIES(); +	*/ +	return SUCCESS; +} +/* }}} */ + +/* Remove if there's nothing to do at request start */ +/* {{{ PHP_RINIT_FUNCTION + */ +PHP_RINIT_FUNCTION(pdo_sqlite) +{ +	return php_pdo_register_driver(&pdo_sqlite_driver); +} +/* }}} */ + +/* Remove if there's nothing to do at request end */ +/* {{{ PHP_RSHUTDOWN_FUNCTION + */ +PHP_RSHUTDOWN_FUNCTION(pdo_sqlite) +{ +	php_pdo_unregister_driver(&pdo_sqlite_driver); +	return SUCCESS; +} +/* }}} */ + +/* {{{ PHP_MINFO_FUNCTION + */ +PHP_MINFO_FUNCTION(pdo_sqlite) +{ +	php_info_print_table_start(); +	php_info_print_table_header(2, "PDO Driver for SQLite 3.x", "enabled"); +	php_info_print_table_row(2, "PECL Module version", PHP_PDO_SQLITE_MODULE_VERSION " $Id$"); +	php_info_print_table_row(2, "SQLite Library", sqlite3_libversion()); +	php_info_print_table_end(); +} +/* }}} */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ | 
