]> git.nbdom.net Git - nb.git/commitdiff
Replace ar_map with array_map
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 15 Dec 2022 11:10:19 +0000 (12:10 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 15 Dec 2022 11:10:19 +0000 (12:10 +0100)
lib/php/db/table.php
lib/php/nb.php
lib/php/page.php

index 1eb35f61fdb419ca1494e40fd9c6a40f86f7104e..e0673e49bc3512d49a41a51775b9d64d1d814b21 100644 (file)
@@ -123,11 +123,13 @@ Class Table extends nb {
                $sql_names = $this->sql_names($fields);
 
                $this->db()->conn->query("CREATE ".$this->sql_temporary()." TABLE $this->name ("
-                       .join(',',$this->ar_map('"$a text"',$sql_names))
+                       # NB 15.12.22 .join(',',$this->ar_map('"$a text"',$sql_names))
+               .join(',',array_map(function($a){return("$a=text");},$sql_names))
                .')');
                $sql = 'INSERT INTO '. $this->sql_name("$this->name")
                        . ' (' . join(',',array_values($sql_names)).')'
-                       .' VALUES (' . join(',',$this->ar_map('":$a"',$fields)) . ')'
+                       # NB 15.12.22 .' VALUES (' . join(',',$this->ar_map('":$a"',$fields)) . ')'
+               .' VALUES (' . join(',',array_map(function($a){return(":$a");},$fields)).')'
                ;
 
                #debug($sql);
@@ -1778,7 +1780,8 @@ Class Table extends nb {
 
                $sql = 
                        $insert_word.' INTO '. $this->sql_name() . ' (' . join(',',array_values($sql_names)).')'
-                       .' VALUES (' . join(',',$this->ar_map('":$a"',array_keys($fields))) . ')'
+                       # NB 15.12.22 .' VALUES (' . join(',',$this->ar_map('":$a"',array_keys($fields))) . ')'
+               .' VALUES ('.join(',',array_map(function($a){return(":$a");},array_keys($fields))).')'
                ;
 
                if (!empty($info['fct'])) {
index 5dc0b54b31c9f7a3a6988680678af88f72e3f733..853f796dac8fa27b5dce5caf9237a0f41956c229 100644 (file)
@@ -194,6 +194,7 @@ class Nb {
         * Does what it says
         */
        public static function ar_map($return,$array,$as_hash=false) {
+       # NB 15.12.22: Depreciated use direct php arra_map functions  
        $map = $array;
        # NB 30.11.22: Does not work get error message mb_strlen does not exists 
        #bye($return);
index 68e75e3e6cb5c39b94e34335275effd7f210bb51..3b55d215911c125ad692828d7c20dd676b89d6d4 100644 (file)
@@ -256,7 +256,8 @@ class Page extends nb {
     foreach ($tags as $t) echo "</$t>".NB_EOL;
     $tags = [];
     return $tags;
-    return join('',self::ar_map('',$tags));
+       return join(',',array_map(function($a){return('');},$tags));
+    # NB 15.12.22 return join('',self::ar_map('',$tags));
     if ($tag === null) return $tags;
     array_unshift($tags,$tag);
   }