QVariantMap values;//...if(!values.value("TIMESTAMP_X").toDateTime().isValid()) values.insert("TIMESTAMP_X", "now()");//...QSqlRecord rec = model()->record();for(QVariantMap::ConstIterator it = values.constBegin(); it != values.constEnd(); ++it){ int fi = model()->fieldIndex(it.key()); if(fi >= 0) rec.setValue(fi, it.value());}if(model()->insertRecord(-1, rec)) ;// ну и дальше по смыслу...//...
model -> setQuery("INSERT.... SET my_date = CURDATE();")
13.2.4. INSERT SyntaxINSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE] [INTO] tbl_name [(col_name,...)] VALUES ({expr | DEFAULT},...),(...),... [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]Or: INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE] [INTO] tbl_name SET col_name={expr | DEFAULT}, ... [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]Or: INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE] [INTO] tbl_name [(col_name,...)] SELECT ... [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]