background image
<< Async command | Connect command >>

Before First command

<< Async command | Connect command >>
Derby Tools and Utilities Guide
34
Description
Turns the connection's auto-commit mode on or off. JDBC specifies that the default
auto-commit mode is
ON
. Certain types of processing require that auto-commit mode be
OFF
. For information about auto-commit, see the Derby Developer's Guide.
If auto-commit mode is changed from off to on when there is a transaction outstanding,
that work is committed when the current transaction commits, not at the time auto-commit
is turned on. Use
Commit
or
Rollback
before turning on auto-commit when there
is a transaction outstanding, so that all prior work is completed before the return to
auto-commit mode.
Example
ij> autocommit off;
ij> DROP TABLE menu;
0 rows inserted/updated/deleted
ij> CREATE TABLE menu (course CHAR(10), item CHAR(20), price INT);
0 rows inserted/updated/deleted
ij> INSERT INTO menu VALUES ('entree', 'lamb chop', 14),
('dessert', 'creme brulee', 6),
('appetizer', 'baby greens', 7);
3 rows inserted/updated/deleted
ij> commit;
ij> autocommit on;
ij>
Before First command
Syntax
BEFORE FIRST int
Identifier
Description
Moves the cursor to before the first row, then fetches the row. (Since there is no current
row, it returns the message
No current row
.)
The cursor must have been created with the
Get Scroll Insensitive Cursor
command.
Example
ij> get scroll insensitive cursor scrollCursor as
'SELECT * FROM menu FOR UPDATE OF price';
ij> before first scrollcursor;
No current row
Close command
Syntax
CLOSE
Identifier
Description
Closes the named cursor. The cursor must have previously been successfully created
with the
ij
Get Cursor
or
Get Scroll Insensitive Cursor
commands.
Example
ij> get cursor menuCursor as 'SELECT * FROM menu';
ij> next menuCursor;
COURSE |ITEM |PRICE
-----------------------------------------------
entree |lamb chop |14