noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 06/12: Add function __toString


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 06/12: Add function __toString
Date: Wed, 16 Nov 2022 14:39:15 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 9cc6318b32cb1189ff2bdeca3ce7a38f71d9f9a0
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sun Nov 6 20:21:20 2022 +0100

    Add function __toString
---
 include/lib/data_sql.class.php | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/include/lib/data_sql.class.php b/include/lib/data_sql.class.php
index 1629148fa..e79860cf2 100644
--- a/include/lib/data_sql.class.php
+++ b/include/lib/data_sql.class.php
@@ -76,8 +76,23 @@ abstract class Data_SQL
    var $type;           //! Type of the data
    var $date_format;    //! defaullt date format
    var $default;
-   
-   function __construct(DatabaseCore $p_cn, $p_id=-1)
+
+    public function __toString(): string
+    {
+        $ret="values ";
+        foreach ($this->name as $name) {
+            $ret.="[ $name => {$this->$name} ]";
+        }
+
+        $ret.="| type ".print_r($this->type,true);
+        $ret.="| default ".print_r($this->default,true);
+        $ret.="| primary key ".$this->primary_key;
+        $ret.="| date_format ".$this->date_format;
+        return $ret;
+    }
+
+
+    function __construct(DatabaseCore $p_cn, $p_id=-1)
     {
         $this->cn=$p_cn;
         $pk=$this->primary_key;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]