| 619 | //------------------------------------------------------------------------------ |
| 620 | |
| 621 | const char* vtkMySQLQuery::GetFieldName(int column) |
| 622 | { |
| 623 | if (!this->Active) |
| 624 | { |
| 625 | vtkErrorMacro(<< "GetFieldName(): Query is not active!"); |
| 626 | return nullptr; |
| 627 | } |
| 628 | else if (column < 0 || column >= this->GetNumberOfFields()) |
| 629 | { |
| 630 | vtkErrorMacro(<< "GetFieldName(): Illegal field index " << column); |
| 631 | return nullptr; |
| 632 | } |
| 633 | else |
| 634 | { |
| 635 | MYSQL_FIELD* field = mysql_fetch_field_direct(this->Internals->Result, column); |
| 636 | if (field == nullptr) |
| 637 | { |
| 638 | vtkErrorMacro(<< "GetFieldName(): MySQL returned null field for column " << column); |
| 639 | return nullptr; |
| 640 | } |
| 641 | else |
| 642 | { |
| 643 | return field->name; |
| 644 | } |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | //------------------------------------------------------------------------------ |
| 649 | |