Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
X Lib
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
XLibs
X Lib
Commits
8657c792
Commit
8657c792
authored
Oct 15, 2016
by
Alex Ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PDO add Count()
parent
ffaf2bd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
PDO.php
Database/Driver/PDO.php
+18
-0
No files found.
Database/Driver/PDO.php
View file @
8657c792
...
@@ -233,6 +233,24 @@ class PDO {
...
@@ -233,6 +233,24 @@ class PDO {
return
$statement
->
execute
();
return
$statement
->
execute
();
}
}
/**
* @param $table
* @param $where
* @param $column
*/
public
function
count
(
$table
,
$where
,
$column
=
"*"
)
{
$whete_obj
=
new
PDOWhereConstructor
(
$where
);
$SQL
=
"SELECT count(
{
$column
}
) FROM `
{
$table
}
`
{
$whete_obj
->
get_sql
()
}
"
;
$statement
=
$this
->
prepare
(
$SQL
);
$whete_obj
->
bind
(
$statement
);
$statement
->
execute
();
if
(
$statement
->
rowCount
()
>
0
)
{
return
$statement
->
fetchAll
(
\PDO
::
FETCH_ASSOC
)[
0
][
"count(
{
$column
}
)"
];
}
else
{
return
false
;
}
}
/**
/**
* @param $table
* @param $table
* @param array $where
* @param array $where
...
...
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