summaryrefslogtreecommitdiff
path: root/idiorm.php
diff options
context:
space:
mode:
authorSimon Holywell <[email protected]>2014-04-20 15:24:12 +0100
committerSimon Holywell <[email protected]>2014-04-20 15:24:12 +0100
commitf22cee9ecd56c19aa40bee9f8bc74ea853f30646 (patch)
tree1f1ce033864c4b599357e68bdc7013bc51c2028b /idiorm.php
parenta90d51defb25ec22e6d542f0c721592f1ef486c4 (diff)
parentfd83741a7d1841e0e46f4ac24c85981c412ad22a (diff)
Merge branch 'master' of github.com:AgelxNash/idiorm into develop
Conflicts: idiorm.php
Diffstat (limited to 'idiorm.php')
-rw-r--r--idiorm.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/idiorm.php b/idiorm.php
index f1ce00c..6b021ad 100644
--- a/idiorm.php
+++ b/idiorm.php
@@ -406,12 +406,13 @@
* @return bool Response of PDOStatement::execute()
*/
protected static function _execute($query, $parameters = array(), $connection_name = self::DEFAULT_CONNECTION) {
- self::_log_query($query, $parameters, $connection_name);
$statement = self::get_db($connection_name)->prepare($query);
-
self::$_last_statement = $statement;
+ $time = microtime(true);
+ $q = $statement->execute($parameters);
+ self::_log_query($query, $parameters, $connection_name, (microtime(true)-$time));
- return $statement->execute($parameters);
+ return $q;
}
/**
@@ -425,9 +426,10 @@
* @param string $query
* @param array $parameters An array of parameters to be bound in to the query
* @param string $connection_name Which connection to use
+ * @param float $query_time Query time
* @return bool
*/
- protected static function _log_query($query, $parameters, $connection_name) {
+ protected static function _log_query($query, $parameters, $connection_name, $query_time) {
// If logging is not enabled, do nothing
if (!self::$_config[$connection_name]['logging']) {
return false;
@@ -463,7 +465,7 @@
if(is_callable(self::$_config[$connection_name]['logger'])){
$logger = self::$_config[$connection_name]['logger'];
- $logger($bound_query);
+ $logger($bound_query, $query_time);
}
return true;
@@ -2155,4 +2157,4 @@
*/
class IdiormStringException extends Exception {}
- class IdiormMethodMissingException extends Exception {} \ No newline at end of file
+ class IdiormMethodMissingException extends Exception {}