| | 324 | |
| | 325 | /* |
| | 326 | * getFieldsFromTableAsCSV get Fields from table with or without auto_increment Fields |
| | 327 | * @param $table Tablename |
| | 328 | * @param $with_auto_increment if true include auto_increment Fields, if false no auto_increment |
| | 329 | * @return string comma separiert Fieldlist for SQL-Syntax |
| | 330 | * @author m.waldeck@ibased.de |
| | 331 | * @todo Errorhandling |
| | 332 | */ |
| | 333 | function getFieldsFromTableAsCSV ($table, $with_auto_increment = false) |
| | 334 | { |
| | 335 | |
| | 336 | $querystatement = "desc " . $table; |
| | 337 | $queryresult = $this->query($querystatement); |
| | 338 | |
| | 339 | if ( !$queryresult ) return FALSE; |
| | 340 | |
| | 341 | $fields =''; |
| | 342 | while ($cols = $this->fetchArray ($queryresult)) |
| | 343 | { |
| | 344 | if ( !$with_auto_increment && $cols['Extra'] == 'auto_increment' ) continue; |
| | 345 | $fields .= "`" . $cols['Field'] . "`,"; |
| | 346 | } |
| | 347 | $fields = substr ($fields,0,-1); |
| | 348 | if ( $fields == '' ) return FALSE; |
| | 349 | |
| | 350 | return $fields; |
| | 351 | } |
| | 352 | |