forked from PocketRent/hhvm-pgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpdo_pgsql.cpp
More file actions
52 lines (43 loc) · 1.27 KB
/
pdo_pgsql.cpp
File metadata and controls
52 lines (43 loc) · 1.27 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
#include "pdo_pgsql.h"
#include "pdo_pgsql_connection.h"
namespace HPHP {
// Initialize the extension
static PDOPgSql s_pgsql_driver;
PDOPgSql::PDOPgSql() : PDODriver("pgsql") {
}
PDOConnection *PDOPgSql::createConnectionObject() {
return new PDOPgSqlConnection();
}
long pdo_attr_lval(const Array& options, int opt, long defaultValue){
if(options.exists(opt)){
return options[opt].toInt64();
}
return defaultValue;
}
String pdo_attr_strval(const Array& options, int opt, const char *def){
if(options.exists(opt)){
return options[opt].toString();
}
if(def){
return def;
}
return String();
}
const StaticString s_PDO("PDO");
static class PDOPGSQLExtension : public Extension {
public:
PDOPGSQLExtension() : Extension("pdo_pgsql") {}
virtual void moduleLoad(const IniSetting::Map& ini, Hdf hdf) {
Native::registerClassConstant<KindOfInt64>(
s_PDO.get(),
s_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT.get(),
PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT
);
Native::registerClassConstant<KindOfInt64>(
s_PDO.get(),
s_PGSQL_ATTR_DISABLE_PREPARES.get(),
PDO_PGSQL_ATTR_DISABLE_PREPARES
);
}
} s_pdopgsql_extension;
}