Db.insertRow
Db.insertRow($table, $rowMap) -> false
Description
Insert a row into a table, where each Map key corresponds to a table column.
$row = { name: 'Ann', role: 'Analyst', createDate: Date.now(), } Db.insertRow('users', $row) // Runs query: // INSERT INTO users (name, role, createDate) // VALUES ("Ann", "Analyst", "2021-03-23 16:38:11")
Object Values
If an inserted value is an object, it will try to convert it to a string:
- Date:
$date.format('sql')
- Password:
$password.hash()
- Other:
$object.zSqlString()
(usually the same astoString()
)