Ejemplo n.º 1
0
 public function log()
 {
     $ar = func_get_args();
     $cn = \bbn\str\text::encode_filename(str_replace('\\', '_', get_class($this)));
     foreach ($ar as $a) {
         \bbn\tools::log($a, $cn);
     }
 }
Ejemplo n.º 2
0
 private function parseCMD($st)
 {
     if (!mb_detect_encoding($st)) {
         $st = utf8_encode($st);
     }
     $tmp = explode("\n", $st);
     $res = [];
     foreach ($tmp as $t) {
         $i = strpos($t, ':');
         if ($i > 0) {
             $res[\bbn\str\text::change_case(\bbn\str\text::encode_filename(substr($t, 0, $i)), 'lower')] = trim(substr($t, $i + 1));
         }
     }
     return $res;
 }
Ejemplo n.º 3
0
 /**
  * @return void 
  */
 public function create_db_index($table, $column, $unique = false, $length = null)
 {
     if (!is_array($column)) {
         $column = [$column];
     }
     if (!is_null($length)) {
         if (!is_array($length)) {
             $length = [$length];
         }
     }
     $iname = text::encode_filename($table);
     foreach ($column as $i => $c) {
         if (!text::check_name($c)) {
             die("Illegal column {$c}");
         }
         $iname .= '_' . $c;
         $column[$i] = "`" . $column[$i] . "`";
         if (is_int($length[$i]) && $length[$i] > 0) {
             $column[$i] .= "(" . $length[$i] . ")";
         }
     }
     $iname = text::cut($iname, 50);
     if ($table = $this->table_full_name($table, 1)) {
         $this->db->raw_query("\n\t\t\tCREATE " . ($unique ? "UNIQUE " : "") . "INDEX `{$iname}`\n      ON {$table} ( " . implode(", ", $column) . " )");
     }
     return $this;
 }