Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
014c2ebf
Commit
014c2ebf
authored
Jul 06, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removing comment bloat from DB class.
parent
3c7dd282
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
16 deletions
+8
-16
system/db.php
+8
-16
No files found.
system/db.php
View file @
014c2ebf
...
...
@@ -10,7 +10,7 @@ class DB {
private
static
$connections
=
array
();
/**
* Get a database connection.
* Get a database connection.
Database connections are managed as singletons.
*
* @param string $connection
* @return PDO
...
...
@@ -22,12 +22,6 @@ class DB {
$connection
=
Config
::
get
(
'db.default'
);
}
// ---------------------------------------------------
// If we have already established this connection,
// simply return the existing connection.
//
// Don't want to establish the same connection twice!
// ---------------------------------------------------
if
(
!
array_key_exists
(
$connection
,
static
::
$connections
))
{
$config
=
Config
::
get
(
'db.connections'
);
...
...
@@ -46,6 +40,13 @@ class DB {
/**
* Execute a SQL query against the connection.
*
* The method returns the following based on query type:
*
* SELECT -> Array of stdClasses
* UPDATE -> Number of rows affected.
* DELETE -> Number of Rows affected.
* ELSE -> Boolean true / false depending on success.
*
* @param string $sql
* @param array $bindings
* @param string $connection
...
...
@@ -57,15 +58,6 @@ class DB {
$result
=
$query
->
execute
(
$bindings
);
// ---------------------------------------------------
// For SELECT statements, the results will be returned
// as an array of stdClasses.
//
// For UPDATE and DELETE statements, the number of
// rows affected by the query will be returned.
//
// For all other statements, return a boolean.
// ---------------------------------------------------
if
(
strpos
(
strtoupper
(
$sql
),
'SELECT'
)
===
0
)
{
return
$query
->
fetchAll
(
\PDO
::
FETCH_CLASS
,
'stdClass'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment