| @@ 1252-1278 (lines=27) @@ | ||
| 1249 | $this->data_cache['table_names'] = array(); |
|
| 1250 | $query = $this->query($sql); |
|
| 1251 | ||
| 1252 | foreach ($query->result_array() as $row) |
|
| 1253 | { |
|
| 1254 | // Do we know from which column to get the table name? |
|
| 1255 | if ( ! isset($key)) |
|
| 1256 | { |
|
| 1257 | if (isset($row['table_name'])) |
|
| 1258 | { |
|
| 1259 | $key = 'table_name'; |
|
| 1260 | } |
|
| 1261 | elseif (isset($row['TABLE_NAME'])) |
|
| 1262 | { |
|
| 1263 | $key = 'TABLE_NAME'; |
|
| 1264 | } |
|
| 1265 | else |
|
| 1266 | { |
|
| 1267 | /* We have no other choice but to just get the first element's key. |
|
| 1268 | * Due to array_shift() accepting its argument by reference, if |
|
| 1269 | * E_STRICT is on, this would trigger a warning. So we'll have to |
|
| 1270 | * assign it first. |
|
| 1271 | */ |
|
| 1272 | $key = array_keys($row); |
|
| 1273 | $key = array_shift($key); |
|
| 1274 | } |
|
| 1275 | } |
|
| 1276 | ||
| 1277 | $this->data_cache['table_names'][] = $row[$key]; |
|
| 1278 | } |
|
| 1279 | ||
| 1280 | return $this->data_cache['table_names']; |
|
| 1281 | } |
|
| @@ 1320-1341 (lines=22) @@ | ||
| 1317 | $query = $this->query($sql); |
|
| 1318 | $this->data_cache['field_names'][$table] = array(); |
|
| 1319 | ||
| 1320 | foreach ($query->result_array() as $row) |
|
| 1321 | { |
|
| 1322 | // Do we know from where to get the column's name? |
|
| 1323 | if ( ! isset($key)) |
|
| 1324 | { |
|
| 1325 | if (isset($row['column_name'])) |
|
| 1326 | { |
|
| 1327 | $key = 'column_name'; |
|
| 1328 | } |
|
| 1329 | elseif (isset($row['COLUMN_NAME'])) |
|
| 1330 | { |
|
| 1331 | $key = 'COLUMN_NAME'; |
|
| 1332 | } |
|
| 1333 | else |
|
| 1334 | { |
|
| 1335 | // We have no other choice but to just get the first element's key. |
|
| 1336 | $key = key($row); |
|
| 1337 | } |
|
| 1338 | } |
|
| 1339 | ||
| 1340 | $this->data_cache['field_names'][$table][] = $row[$key]; |
|
| 1341 | } |
|
| 1342 | ||
| 1343 | return $this->data_cache['field_names'][$table]; |
|
| 1344 | } |
|