add packaging
[platform/upstream/db4.git] / php_db4 / php_db4.h
1 /*-
2  * Copyright (c) 2004-2009 Oracle.  All rights reserved.
3  *
4  * http://www.apache.org/licenses/LICENSE-2.0.txt
5  * 
6  * authors: George Schlossnagle <george@omniti.com>
7  */
8
9 #ifndef PHP_DB4_H
10 #define PHP_DB4_H
11
12 extern zend_module_entry db4_module_entry;
13 #define phpext_db4_ptr &db4_module_entry
14
15 #ifdef DB4_EXPORTS
16 #define PHP_DB4_API __declspec(dllexport)
17 #else
18 #define PHP_DB4_API
19 #endif
20
21 #ifdef ZTS
22 #include "TSRM.h"
23 #endif
24
25 #include "db.h"
26
27 PHP_DB4_API zend_class_entry *db_txn_ce_get(void);
28 PHP_DB4_API zend_class_entry *dbc_ce_get(void);
29 PHP_DB4_API zend_class_entry *db_env_ce_get(void);
30 PHP_DB4_API zend_class_entry *db_ce_get(void);
31 PHP_DB4_API DB_ENV *php_db4_getDbEnvFromObj(zval *z TSRMLS_DC);
32 PHP_DB4_API DB *php_db4_getDbFromObj(zval *z TSRMLS_DC);
33 PHP_DB4_API DB_TXN *php_db4_getDbTxnFromObj(zval *z TSRMLS_DC);
34 PHP_DB4_API DBC *php_db4_getDbcFromObj(zval *z TSRMLS_DC);
35 /* 
36         Declare any global variables you may need between the BEGIN
37         and END macros here:     
38
39 ZEND_BEGIN_MODULE_GLOBALS(db4)
40         long  global_value;
41         char *global_string;
42 ZEND_END_MODULE_GLOBALS(db4)
43 */
44
45 /* In every utility function you add that needs to use variables 
46    in php_db4_globals, call TSRM_FETCH(); after declaring other 
47    variables used by that function, or better yet, pass in TSRMLS_CC
48    after the last function argument and declare your utility function
49    with TSRMLS_DC after the last declared argument.  Always refer to
50    the globals in your function as DB4_G(variable).  You are 
51    encouraged to rename these macros something shorter, see
52    examples in any other php module directory.
53 */
54
55 #ifdef ZTS
56 #define DB4_G(v) TSRMG(db4_globals_id, zend_db4_globals *, v)
57 #else
58 #define DB4_G(v) (db4_globals.v)
59 #endif
60
61 #endif  /* PHP_DB4_H */
62
63
64 /*
65  * Local variables:
66  * tab-width: 4
67  * c-basic-offset: 4
68  * indent-tabs-mode: t
69  * End:
70  */