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