1
irmtfan
Core feature: alter/change/show functionality on database (add changeField and showFields)
  • 2013/4/7 9:58

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Now we dont have any function/class in xoops to do alter/change/show functionality on database.
i suggest to add some of them ASAP in xoops 26 like this:

le="color: #000000"><?php public function changeField($field = null, $structure = null) { $sql = "ALTER TABLE {$this->table} CHANGE {$field} {$field} {$structure}"; if (!$result = $this->db->queryF($sql)) { xoops_error($this->db->error().'<br />'.$sql); return false; } return true; } public function showFields($field = null) { $sql = "SHOW FIELDS FROM {$this->table}"; if (isset($field)) { $sql .= " LIKE '{$field}'"; } if (!$result = $this->db->queryF($sql)) { xoops_error($this->db->error().'<br />'.$sql); return false; } $ret = array(); while ($myrow = $this->db->fetchArray($result)) { $ret[$myrow["Field"]] = $myrow; } return $ret; }


do you think it needs more functionality eg: WHERE
please discuss then we can add it to sf.net feature request.

Login

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits