User`s guide
set
7-221
Example 2 — Set the AutoCommit Flag to On
This example shows what happens when you run a database update function on a
database whose AutoCommit flag is set to on.
1
Determine the status of the AutoCommit flag for the database connection conn.
get(conn, 'AutoCommit')
ans =
off
The flag is off.
2
Set the flag status to on and verify its value.
set(conn, 'AutoCommit', 'on');
get(conn, 'AutoCommit')
ans =
on
3
Insert a cell array exdata into column names colnames in the table Growth.
fastinsert(conn, 'Growth', colnames, exdata)
The data is inserted and committed to the database.
Example 3 — Set the AutoCommit Flag to Off and Commit Data
This example shows the results of running fastinsert and commit to insert and
commit data into a database whose AutoCommit flag is off.
1
First set the AutoCommit flag to off for database connection conn.
set(conn, 'AutoCommit', 'off');
2
Insert a cell array exdata into the column names colnames in the table
Avg_Freight_Cost.
fastinsert(conn, 'Avg_Freight_Cost', colnames, exdata)
3
Commit the data to the database.
commit(conn)