Inserts are communicated to the database array at a time. To flush the buffered inserts one has to invoke flush/0 at the end of his inserts.
For setting the size of the input array See section 7.3.6.
Assuming you have imported the related base table using db_import/2, you can insert to that table by using db_insert/2 predicate. The first argument is the declared database predicate for insertions and the second argument is the imported database relation. The second argument can be declared with with some of its arguments bound to constants. For example assuming empall is imported through db_import:
|?- db_import('EMP'('EMPNO','ENAME','JOB','MGR','HIREDATE','SAL','COMM', 'DEPTNO'), empall). yes | ?- db_insert(emp_ins(A1,A2,A3,A4,A5,A6,A7),(empall(A1,A2,A3,A4,A5,A6,A7,10))). yes | ?- emp_ins(9001,'NULL'(35),'qqq',9999,'14-DEC-88',8888,'NULL'(_)). yesInserts the row: 9001,NULL,'qqq',9999,'14-DEC-88',8888,NULL,10 Note that any call to emp_ins/7 should have all its arguments bound.
See section 7.3.7 for information about NULL values.
Deletion of rows from database tables is supported by the db_delete/2 predicate. The first argument is the declared delete predicate and the second argument is the imported database relation with the condition for requested deletes, if any. The condition is limited to simple comparisons. For example assuming dept/3 is imported as above:
| ?- db_delete(dept_del(A), (dept(A,'ACCOUNTING',B), A > 10)). yes
After this declaration you can use:
| ?- dept_del(10).
to generate the SQL statement:
DELETE DEPT rel1 WHERE rel1.DEPTNO = :BIND1 AND rel1.DNAME = 'ACCOUNTING' AND rel1.DEPTNO > 10;
Note that you have to commit your inserts or deletes to tables to make them permanent. (See section 7.3.11).