Example output
This section includes a sample output of the timeout demonstration program.
- Lines 20 - 43: The first run confirms the interrupt request as
soon as the confirmation prompt appears. (The user enters
y
.) - Lines 44 - 75: The second run does not confirm the interrupt request.
(The user enters
n
.)
The numbers that appear in the following output are for explanation only. They do not appear in the actual program output.
=======================================================================
1. TIMEOUT Sample ESQL Program running.
2. Connected to 'stores7' on default server
3. Created table 'canceltst'
4. Inserting rows into 'canceltst'...
5. Inserted 1000 rows
6. Inserted 2000 rows
7. Inserted 3000 rows
8. Inserted 4000 rows
9. Inserted 5000 rows
10. Inserted 6000 rows
11. Inserted 7000 rows
12. Inserted 8000 rows
13. Inserted 9000 rows
14. Inserted 10000 rows
15. Inserted 10000 rows into 'canceltst'.
16. Counting number of rows in 'canceltst' table...
17. Number of rows = 10000
18. Timeout interval for SQL requests is: 0.00333333 minutes
19. *** Are you ready to begin execution of the query? (y/n): y
20. Beginning execution of query...
21. +------SQL Request begins-----------------------------+
22. | |
23. +------SQL Request ends-------------------------------+
24. +------SQL Request begins-----------------------------+
25. | |
26. | An interrupt has been received by the application.|
27. | |
28. *** Do you want to confirm this interrupt? (y/n): y
29. | TIMEOUT INTERRUPT REQUESTED |
30. +------SQL Request ends-------------------------------+
=======================================================================
Lines 3 - 17
The create_tbl() function generates these lines. They indicate that the function has successfully created the canceltst table, inserted the MAX_ROWS number of rows (1,000), and confirmed that a SELECT statement can access these rows. For a description of the create_tbl() function, see the annotation beginning with Lines 262 - 281.
Lines 18 - 19
Line 18 displays the timeout interval to indicate that sqlbreakcallback() has successfully registered the callback function and established the timeout interval of 200 milliseconds (0.00333333 minutes). Line 19 asks the user to indicate the beginning of the query execution. This prompt prepares the user for the confirmation prompt (lines 28 and 43), which must be answered quickly to send an interrupt while the database server is still executing the query.
Line 20
This line indicates the beginning of the dspquery() function, the point at which the database server begins the canceltst query.
Lines 21 - 30
+------SQL Request begins-----------------------------+
| |
+------SQL Request ends-------------------------------+
Each box represents a single message request sent between the client and the server. The callback function displays the text for a message-request box. (For a description of which parts of the function display the text, see Lines 199 - 249.) To execute the OPEN statement, the client and server exchanged two message requests, which the two message-request boxes in the output indicate. For more information about message requests, see Interruptible SQL statements.
The first
message-request box (lines 21 - 23) indicates that the first message
request completes before the timeout interval elapses. The second
message-request box (lines 29 - 30) indicates that execution of this
message request exceeds the timeout interval and calls the callback
function with a status value of 2
. The callback function
prompts the user to confirm the interrupt request (line 28).
Line 29 indicates that the sqlbreak() function has requested an interrupt. The message request then completes (line 30).
=======================================================================
31. TIMEOUT INTERRUPT PROCESSED
32. *** Try another run? (y/n): y
33. Timeout interval for SQL requests is: 0.00333333 minutes
34. *** Are you ready to begin execution of the query? (y/n): y
35. Beginning execution of query...
36. +------SQL Request begins-----------------------------+
37. | |
38. +------SQL Request ends-------------------------------+
39. +------SQL Request begins-----------------------------+
40. | |
41. | An interrupt has been received by the application.|
42. | |
43. *** Do you want to confirm this interrupt? (y/n): n
44. +------SQL Request ends-------------------------------+
45. Displaying data...
46. sum(int_fld) = 25000000
47. char_fld1 = 4100 Bohannan Dr
48. char_fld2 = Menlo Park, CA
49. sum(int_fld) = 24995000
50. char_fld1 = Informix
51. char_fld2 = Software
52. Number of rows found: 2
53. *** Try another run? (y/n): n
54. Cleaning up...
55. Dropped table 'canceltst'
56. Disconnected stores7 connection
57. TIMEOUT Sample Program over.
=======================================================================
Line 31
When the database server actually
processes the interrupt request, it sets SQLCODE to -213
.
Line 31 indicates that the application program has responded to this
status.
Line 32
This prompt indicates the end of
the first run of the canceltst query. The user responds y
to
the prompt to run the query a second time.
Lines 36 - 41
The message-request box indicates
that the first message request completes before the timeout interval
elapses. The second message-request box (lines 39 - 44) indicates
that execution of this message request again exceeds the timeout interval
and calls the callback function (with when_called = 2
).
The callback function prompts the user to confirm the interrupt request
(line 43). This time the user answers n
.
Lines 45 - 52
Because the user has not interrupted the canceltst query, the program displays the row information that the query returns.
Lines 54 and 55
The drop_tbl() function generates these lines. They indicate that the function has successfully dropped the canceltst table from the database. For a description of the drop_tbl() function, see the annotation beginning with Lines 320 - 329.