Re: DATABASE EXCLUSIVE Error
Posted in 1993
robert,
the 'bug' is not necessarily with the 'DATABASE EXCLUSIVE' statement.
im not sure why the following works, but i have tried it. changes
to the original code are blocked with #####. i have also removed the
sleep statements.
================================================================================
{ error.4gl }
DATABASE db_name
MAIN
WHENEVER ERROR STOP
CALL do_first_cursor()
CALL do_next_step()
CALL do_first_cursor()
END MAIN
FUNCTION do_first_cursor()
DEFINE tr_first_fld CHAR(12),
tr_second_fld CHAR(35),
tr_cnt INTEGER,
wbuf CHAR(500)
######
DEFINE insert_sql CHAR(200)
LET insert_sql = "INSERT INTO new_table VALUES ( ?,? )"
PREPARE INSERT_IT FROM insert_sql
######
OPEN WINDOW w1 AT 5,5 WITH FORM "error" ATTRIBUTE(BORDER)
CONSTRUCT wbuf ON
table_name.acct_no,
table_name.acctname,
table_name.source,
table_name.usr
FROM
sc_table_name.acct_no,
sc_table_name.acctname,
sc_table_name.source,
sc_table_name.usr
DELETE FROM new_table
LET wbuf = "SELECT acct_no,acctname FROM db_name:table_name WHERE ",wbuf clipped
PREPARE first_prep FROM wbuf
DECLARE first_curs CURSOR FOR first_prep
LET tr_cnt = 0
FOREACH first_curs INTO tr_first_fld,tr_second_fld
######
EXECUTE INSERT_IT using tr_first_fld,tr_second_fld
######
LET tr_cnt = tr_cnt + 1
END FOREACH
FREE first_prep
ERROR "Inserted ",tr_cnt," record(s)"
FREE first_prep
CLEAR SCREEN
CLOSE WINDOW w1
END FUNCTION
FUNCTION do_next_step()
ERROR "Setting Database to exclusive mode"
DATABASE db_name EXCLUSIVE
ERROR "Closing Database"
CLOSE DATABASE
ERROR "Setting Database to normal mode"
DATABASE db_name
DISPLAY sqlca.sqlawarn
END FUNCTION
================================================================================
regards,
------------------------------------------------------------------------------
| . .
Bob Baskett | ... ...
Software Engineer, DBA | ..... .....
Business Systems Integration Group | .. ... ..
Semiconductor Products Sector | . . .
Mesa, AZ |
| Motorola, Inc
------------------------------------------------------------------------------
Sun 690-MP
Informix Versions:
Online - 5.00.UC2
ISQL - 4.10.UD1
4GL-RDS- 4.10.UC1
------------------------------------------------------------------------------