| 1 | #if __has_include(<mysql.h>) |
|---|---|
| 2 | #include <mysql.h> |
| 3 | #else |
| 4 | #include <mysql/mysql.h> |
| 5 | #endif |
| 6 | #include <mysqlxx/Row.h> |
| 7 | |
| 8 | |
| 9 | namespace mysqlxx |
| 10 | { |
| 11 | |
| 12 | Value Row::operator[] (const char * name) const |
| 13 | { |
| 14 | unsigned n = res->getNumFields(); |
| 15 | MYSQL_FIELDS fields = res->getFields(); |
| 16 | |
| 17 | for (unsigned i = 0; i < n; ++i) |
| 18 | if (!strcmp(name, fields[i].name)) |
| 19 | return operator[](i); |
| 20 | |
| 21 | throw Exception(std::string("Unknown column ") + name); |
| 22 | } |
| 23 | |
| 24 | } |
| 25 |