fbout-test.sql 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  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 <[email protected]>
  17. * and all contributors signed below.
  18. *
  19. * All Rights Reserved.
  20. * Contributor(s): ______________________________________.
  21. */
  22. /*
  23. * This example demonstrate packages creating and using FB$OUT, a package that write and read
  24. * messages in a session and is suitable for debug PSQL code.
  25. */
  26. set names utf8;
  27. create database 'test.fdb';
  28. input 'fbout-header.sql';
  29. input 'fbout-body.sql';
  30. set term !;
  31. create procedure test
  32. as
  33. declare i integer;
  34. begin
  35. execute procedure fb$out.put_line ('um');
  36. execute procedure fb$out.put_line ('dois');
  37. execute procedure fb$out.enable;
  38. execute procedure fb$out.put_line ('três');
  39. execute procedure fb$out.put_line ('quatro');
  40. execute procedure fb$out.disable;
  41. execute procedure fb$out.put_line ('cinco');
  42. execute procedure fb$out.enable;
  43. execute procedure fb$out.put_line ('seis');
  44. begin
  45. i = 'a';
  46. execute procedure fb$out.put_line ('sete');
  47. when any do
  48. begin
  49. end
  50. end
  51. end!
  52. set term ;!
  53. grant execute on procedure test to public;
  54. execute procedure test;
  55. execute procedure fb$out.get_lines;
  56. execute procedure fb$out.get_lines;