mirror of
https://github.com/hotspotbilling/phpnuxbill.git
synced 2025-02-23 23:17:05 +08:00
add Function getEnum in ORM
This commit is contained in:
parent
51c4909308
commit
37a245c94a
1 changed files with 10 additions and 0 deletions
|
@ -939,6 +939,8 @@ class ORM implements ArrayAccess
|
|||
return $this->_add_result_column($column, $alias);
|
||||
}
|
||||
|
||||
## ibnux add function
|
||||
|
||||
/**
|
||||
* Add a column to the list of columns returned by the SELECT
|
||||
* query. This defaults to '*'. The second optional argument is
|
||||
|
@ -959,6 +961,14 @@ class ORM implements ArrayAccess
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getEnum($column){
|
||||
$result = $this->raw_query("SHOW COLUMNS FROM ".$this->_table_name." WHERE Field = '$column'")->findArray();
|
||||
preg_match("/^enum\(\'(.*)\'\)$/", $result[0]['Type'], $matches);
|
||||
return explode("','", $matches[1]);
|
||||
}
|
||||
|
||||
## END ibnux add function
|
||||
|
||||
/**
|
||||
* Add an unquoted expression to the list of columns returned
|
||||
* by the SELECT query. The second optional argument is
|
||||
|
|
Loading…
Reference in a new issue