summaryrefslogtreecommitdiff
path: root/core/classes/Database.php
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-05-04 03:02:01 +0300
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-05-04 03:02:01 +0300
commit63f714d5a78b765c117ebf6bbdfdbd748dd45644 (patch)
tree87a4db40e1ff699222ccfdf699a3904d1c665bfc /core/classes/Database.php
parent931a93cd7bae092e2752064568cebe407d2bf46e (diff)
downloadgyraf1gov-63f714d5a78b765c117ebf6bbdfdbd748dd45644.tar.gz
gyraf1gov-63f714d5a78b765c117ebf6bbdfdbd748dd45644.tar.bz2
gyraf1gov-63f714d5a78b765c117ebf6bbdfdbd748dd45644.zip
authentication; invitation; activation; base form setup
Diffstat (limited to 'core/classes/Database.php')
-rw-r--r--core/classes/Database.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/core/classes/Database.php b/core/classes/Database.php
index 8cac479..0a8a10a 100644
--- a/core/classes/Database.php
+++ b/core/classes/Database.php
@@ -14,6 +14,8 @@ class Database {
private $result = null;
+ private $rowCount;
+
/** METHODS
* -------------------------------------------------------------------------
@@ -78,6 +80,25 @@ class Database {
}
+
+ /** rowCount
+ *
+ * returns the number of affected rows from the last modification query
+ * (that inludes any of INSERT, UPDATE or DELETE; not the SELECT ones)
+ *
+ * NOTE:
+ * originally in php PDO driver, rowCount is applied onto the stamement;
+ * here it is applied onto the actual object, making the call much easier
+ *
+ * @param void;
+ * @return (int) : number of affected rows
+ */
+ public function rowCount()
+ {
+ return $this->rowCount;
+ }
+
+
/** query
* ---
* set and execute a query safely;
@@ -103,6 +124,9 @@ class Database {
}
+ // keep rowCount (valid for INSERT, UPDATE, DELETE)
+ $this->rowCount = $stmt->rowCount();
+
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
$this->result = $result;