| @@ 129-149 (lines=21) @@ | ||
| 126 | * @param string $table Table name |
|
| 127 | * @return array |
|
| 128 | */ |
|
| 129 | public function list_fields($table) |
|
| 130 | { |
|
| 131 | // Is there a cached result? |
|
| 132 | if (isset($this->data_cache['field_names'][$table])) |
|
| 133 | { |
|
| 134 | return $this->data_cache['field_names'][$table]; |
|
| 135 | } |
|
| 136 | ||
| 137 | if (($result = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE) |
|
| 138 | { |
|
| 139 | return FALSE; |
|
| 140 | } |
|
| 141 | ||
| 142 | $this->data_cache['field_names'][$table] = array(); |
|
| 143 | foreach ($result->result_array() as $row) |
|
| 144 | { |
|
| 145 | $this->data_cache['field_names'][$table][] = $row['name']; |
|
| 146 | } |
|
| 147 | ||
| 148 | return $this->data_cache['field_names'][$table]; |
|
| 149 | } |
|
| 150 | ||
| 151 | // -------------------------------------------------------------------- |
|
| 152 | ||
| @@ 231-251 (lines=21) @@ | ||
| 228 | * @param string $table Table name |
|
| 229 | * @return array |
|
| 230 | */ |
|
| 231 | public function list_fields($table) |
|
| 232 | { |
|
| 233 | // Is there a cached result? |
|
| 234 | if (isset($this->data_cache['field_names'][$table])) |
|
| 235 | { |
|
| 236 | return $this->data_cache['field_names'][$table]; |
|
| 237 | } |
|
| 238 | ||
| 239 | if (($result = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE) |
|
| 240 | { |
|
| 241 | return FALSE; |
|
| 242 | } |
|
| 243 | ||
| 244 | $this->data_cache['field_names'][$table] = array(); |
|
| 245 | foreach ($result->result_array() as $row) |
|
| 246 | { |
|
| 247 | $this->data_cache['field_names'][$table][] = $row['name']; |
|
| 248 | } |
|
| 249 | ||
| 250 | return $this->data_cache['field_names'][$table]; |
|
| 251 | } |
|
| 252 | ||
| 253 | // -------------------------------------------------------------------- |
|
| 254 | ||