FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
CovidVaultAPI/model/db.php at master · SimpleProgrammingAU/CovidVaultAPI · GitHub
This repository was archived by the owner on Jun 8, 2023. It is now read-only.
SimpleProgrammingAU
/
CovidVaultAPI
Public archive
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
3
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
CovidVaultAPI
/
model
/
db.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (31 loc) · 1.18 KB
Breadcrumbs
CovidVaultAPI
/
model
/
db.php
Copy path
File metadata and controls
35 lines (31 loc) · 1.18 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<?php
//TODO - Update with different connections between read / write.
class
DB
{
/**
* @var PDO
*/
private
static
$
writeDBConnection
;
/**
* @var PDO
*/
private
static
$
readDBConnection
;
public
static
function
connectWriteDB
()
{
if
(
is_null
(
self
::
$
writeDBConnection
)) {
self
::
$
writeDBConnection
=
new
PDO
(
'
mysql:host=localhost;dbname=simplepr_covid;charset=utf8
'
,
getenv
(
"
DB_USERNAME
"
),
getenv
(
"
DB_PASSWORD
"
));
self
::
$
writeDBConnection
->
setAttribute
(
PDO
::
ATTR_ERRMODE
,
PDO
::
ERRMODE_EXCEPTION
);
self
::
$
writeDBConnection
->
setAttribute
(
PDO
::
ATTR_EMULATE_PREPARES
,
false
);
}
return
self
::
$
writeDBConnection
;
}
public
static
function
connectReadDB
()
{
if
(
is_null
(
self
::
$
readDBConnection
)) {
self
::
$
readDBConnection
=
new
PDO
(
'
mysql:host=localhost;dbname=simplepr_covid;charset=utf8
'
,
getenv
(
"
DB_USERNAME
"
),
getenv
(
"
DB_PASSWORD
"
));
self
::
$
readDBConnection
->
setAttribute
(
PDO
::
ATTR_ERRMODE
,
PDO
::
ERRMODE_EXCEPTION
);
self
::
$
readDBConnection
->
setAttribute
(
PDO
::
ATTR_EMULATE_PREPARES
,
false
);
}
return
self
::
$
readDBConnection
;
}
}
Back
|
FazBrowse Home
|
New Git URL