TableName | Name of the table to do search / insert on. |
DictValue | Dict containing values to search for and insert if not found. |
Note that for the dicts, you (currently) must put quotes around any values that will go into text columns or receive an error. We may add support in a future release for automatically detecting the column type and quoting values as necessary.
Note that, as with other commands, this command assumes that the table will have a column "id", which is the primary key.
If you want to break the dict down into two dicts, one used to check if the entry exists and the other with the values, then take a look at RunSqlEnter
.
Check this page for info about how to set up Gen for using database-related commands.
% RunSqlCreate my_table {id {integer primary key} desc text notes text}
% QQ [SqlInsertStatement my_table {desc 'one' notes 'uno'}]
% RunSqlInsertIfDoesNotExist my_table {desc 'one' notes 'uno'}
% RunSqlInsertIfDoesNotExist my_table {desc 'two' notes 'dos'}
% QQ [SqlSelectStatement my_table {desc notes}]
one uno two dos