* Insert a row and return it with auto-generated fields populated. * * For tables with auto-increment fields (defined with FIELD_PrimaryKeyAutoInc, * FIELD_UniqueAutoInc, FIELD_IndexAutoInc, or FIELD_AutoInc), this method * automatically integrates the generated values back into the returned row. * * @param row_data The row to insert. Auto-increment fields can be set
| 383 | * value integration automatically. |
| 384 | */ |
| 385 | T insert(const T& row_data) { |
| 386 | auto result = try_insert(row_data); |
| 387 | if (result.is_err()) { |
| 388 | const auto& error = result.err(); |
| 389 | // Convert to LOG_FATAL to maintain current behavior |
| 390 | LOG_FATAL("Table::insert failed: " + error.message); |
| 391 | } |
| 392 | return result.take_ok(); |
| 393 | } |
| 394 | |
| 395 | /** |
| 396 | * Insert a row and return Result-like type instead of throwing on error. |