forked from patrickallaert/php-apm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdriver_sqlite3.h
More file actions
77 lines (61 loc) · 2.68 KB
/
driver_sqlite3.h
File metadata and controls
77 lines (61 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
+----------------------------------------------------------------------+
| APM stands for Alternative PHP Monitor |
+----------------------------------------------------------------------+
| Copyright (c) 2008-2013 Davide Mendolia, Patrick Allaert |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 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_01.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 |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Patrick Allaert <[email protected]> |
+----------------------------------------------------------------------+
*/
#ifndef DRIVER_SQLITE3_H
#define DRIVER_SQLITE3_H
#include <sqlite3.h>
#include "zend_API.h"
#define APM_E_sqlite3 APM_E_ALL
#define SQLITE_INSTANCE_INIT_EX(ret) connection = sqlite_get_instance(); \
if (connection == NULL) { \
return ret; \
}
#define SQLITE_INSTANCE_INIT SQLITE_INSTANCE_INIT_EX()
#define DB_FILE "events"
apm_driver_entry * apm_driver_sqlite3_create();
void apm_driver_sqlite3_insert_request(char * uri, char * host, char * ip, char * cookies, char * post_vars, char * referer TSRMLS_DC);
void apm_driver_sqlite3_insert_event(int type, char * error_filename, uint error_lineno, char * msg, char * trace TSRMLS_DC);
int apm_driver_sqlite3_minit(int);
int apm_driver_sqlite3_rinit();
int apm_driver_sqlite3_mshutdown();
int apm_driver_sqlite3_rshutdown();
void apm_driver_sqlite3_insert_slow_request(float duration TSRMLS_DC);
/* Extension globals */
ZEND_BEGIN_MODULE_GLOBALS(apm_sqlite3)
/* Boolean controlling whether the driver is active or not */
zend_bool enabled;
/* driver error reporting */
int error_reporting;
/* Path to the SQLite database file */
char *db_path;
/* The actual db file */
char db_file[MAXPATHLEN];
/* DB handle */
sqlite3 *event_db;
/* Max timeout to wait for storing the event in the DB */
long timeout;
/* Request ID */
sqlite3_int64 request_id;
/* Boolean to ensure request content is only inserted once */
zend_bool is_request_created;
ZEND_END_MODULE_GLOBALS(apm_sqlite3)
#ifdef ZTS
#define APM_S3_G(v) TSRMG(apm_sqlite3_globals_id, zend_apm_sqlite3_globals *, v)
#else
#define APM_S3_G(v) (apm_sqlite3_globals.v)
#endif
#endif