1 |
tony |
158 |
/*
|
2 |
|
|
* The contents of this file are subject to the Initial
|
3 |
|
|
* Developer's Public License Version 1.0 (the "License");
|
4 |
|
|
* you may not use this file except in compliance with the
|
5 |
|
|
* License. You may obtain a copy of the License at
|
6 |
|
|
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
|
7 |
|
|
*
|
8 |
|
|
* Software distributed under the License is distributed AS IS,
|
9 |
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
10 |
|
|
* See the License for the specific language governing rights
|
11 |
|
|
* and limitations under the License.
|
12 |
|
|
*
|
13 |
|
|
* The Original Code was created by Adriano dos Santos Fernandes
|
14 |
|
|
* for the Firebird Open Source RDBMS project.
|
15 |
|
|
*
|
16 |
|
|
* Copyright (c) 2009 Adriano dos Santos Fernandes <adrianosf@gmail.com>
|
17 |
|
|
* and all contributors signed below.
|
18 |
|
|
*
|
19 |
|
|
* All Rights Reserved.
|
20 |
|
|
* Contributor(s): ______________________________________.
|
21 |
|
|
*/
|
22 |
|
|
|
23 |
|
|
/*
|
24 |
|
|
* This example demonstrate packages creating and using FB$OUT, a package that write and read
|
25 |
|
|
* messages in a session and is suitable for debug PSQL code.
|
26 |
|
|
*/
|
27 |
|
|
|
28 |
|
|
set names utf8;
|
29 |
|
|
|
30 |
|
|
/*create database 'test.fdb';
|
31 |
|
|
|
32 |
|
|
input 'fbout-header.sql';
|
33 |
|
|
input 'fbout-body.sql';*/
|
34 |
|
|
|
35 |
|
|
set term !;
|
36 |
|
|
|
37 |
|
|
create procedure test
|
38 |
|
|
as
|
39 |
|
|
declare i integer;
|
40 |
|
|
begin
|
41 |
|
|
execute procedure fb$out.put_line ('um');
|
42 |
|
|
execute procedure fb$out.put_line ('dois');
|
43 |
|
|
execute procedure fb$out.enable;
|
44 |
|
|
execute procedure fb$out.put_line ('trĂªs');
|
45 |
|
|
execute procedure fb$out.put_line ('quatro');
|
46 |
|
|
execute procedure fb$out.disable;
|
47 |
|
|
execute procedure fb$out.put_line ('cinco');
|
48 |
|
|
execute procedure fb$out.enable;
|
49 |
|
|
execute procedure fb$out.put_line ('seis');
|
50 |
|
|
begin
|
51 |
|
|
i = 'a';
|
52 |
|
|
execute procedure fb$out.put_line ('sete');
|
53 |
|
|
when any do
|
54 |
|
|
begin
|
55 |
|
|
end
|
56 |
|
|
end
|
57 |
|
|
end!
|
58 |
|
|
|
59 |
|
|
set term ;!
|
60 |
|
|
|
61 |
|
|
grant execute on procedure test to public;
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
/*execute procedure test;
|
65 |
|
|
|
66 |
|
|
execute procedure fb$out.get_lines;
|
67 |
|
|
execute procedure fb$out.get_lines;*/
|