stat12t.e 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Program type: Embedded Static SQL
  3. *
  4. * Description:
  5. * This program should be run in conjunction with stat12.
  6. * It adds some sales records, in order to trigger the event
  7. * that stat12 is waiting for.
  8. * The contents of this file are subject to the Interbase Public
  9. * License Version 1.0 (the "License"); you may not use this file
  10. * except in compliance with the License. You may obtain a copy
  11. * of the License at http://www.Inprise.com/IPL.html
  12. *
  13. * Software distributed under the License is distributed on an
  14. * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
  15. * or implied. See the License for the specific language governing
  16. * rights and limitations under the License.
  17. *
  18. * The Original Code was created by Inprise Corporation
  19. * and its predecessors. Portions created by Inprise Corporation are
  20. * Copyright (C) Inprise Corporation.
  21. *
  22. * All Rights Reserved.
  23. * Contributor(s): ______________________________________.
  24. */
  25. #include "example.h"
  26. #include <stdio.h>
  27. #include <string.h>
  28. #include <stdlib.h>
  29. EXEC SQL
  30. BEGIN DECLARE SECTION;
  31. EXEC SQL
  32. SET DATABASE empdb = "employee.fdb";
  33. EXEC SQL
  34. END DECLARE SECTION;
  35. int main(int argc, char** argv)
  36. {
  37. EXEC SQL
  38. CONNECT empdb;
  39. EXEC SQL
  40. SET TRANSACTION;
  41. /* Clean-up. */
  42. EXEC SQL
  43. DELETE FROM sales WHERE po_number LIKE "VNEW%";
  44. EXEC SQL
  45. COMMIT;
  46. /* Add batch 1. */
  47. EXEC SQL
  48. SET TRANSACTION;
  49. printf("Stat12t: Adding VNEW1\n");
  50. EXEC SQL
  51. INSERT INTO sales (po_number, cust_no, order_status, total_value)
  52. VALUES ('VNEW1', 1015, 'new', 0);
  53. printf("Stat12t: Adding VNEW2\n");
  54. EXEC SQL
  55. INSERT INTO sales (po_number, cust_no, order_status, total_value)
  56. VALUES ('VNEW2', 1015, 'new', 0);
  57. printf("Stat12t: Adding VNEW3\n");
  58. EXEC SQL
  59. INSERT INTO sales (po_number, cust_no, order_status, total_value)
  60. VALUES ('VNEW3', 1015, 'new', 0);
  61. EXEC SQL
  62. COMMIT;
  63. /* Add batch 2. */
  64. EXEC SQL
  65. SET TRANSACTION;
  66. printf("Stat12t: Adding VNEW4\n");
  67. EXEC SQL
  68. INSERT INTO sales (po_number, cust_no, order_status, total_value)
  69. VALUES ('VNEW4', 1015, 'new', 0);
  70. EXEC SQL
  71. COMMIT RELEASE;
  72. exit(0);
  73. }