home *** CD-ROM | disk | FTP | other *** search
/ Freelog 42 / Freelog042.iso / Alu / Ancestrologie / Sources / InterBase_WI-V6.0.1-server.ZIP / examples / gpre / stat12t.e < prev    next >
Encoding:
Text File  |  2001-01-05  |  2.2 KB  |  84 lines

  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.  *
  21.  * Copyright (C) 2000 Inprise Corporation
  22.  * All Rights Reserved.
  23.  * Contributor(s): ______________________________________.
  24.  */
  25.  
  26. #include "example.h"
  27. #include <stdio.h>
  28. #include <string.h>
  29. #include <stdlib.h>
  30.  
  31. EXEC SQL    
  32.     BEGIN DECLARE SECTION;
  33. EXEC SQL
  34.     SET DATABASE empdb = "employee.gdb";
  35. EXEC SQL    
  36.     END DECLARE SECTION;
  37.  
  38. int main(ARG(int, argc), ARG(char **, argv))
  39. ARGLIST(int argc)
  40. ARGLIST(char **argv)
  41. {
  42.         EXEC SQL
  43.         CONNECT empdb;
  44.     EXEC SQL
  45.         SET TRANSACTION;
  46.  
  47.     /* Clean-up. */
  48.     EXEC SQL
  49.         DELETE FROM sales WHERE po_number LIKE "VNEW%";
  50.     EXEC SQL
  51.         COMMIT;
  52.  
  53.     /* Add batch 1. */
  54.     EXEC SQL
  55.         SET TRANSACTION;
  56.     printf("Stat12t:  Adding VNEW1\n");
  57.     EXEC SQL
  58.         INSERT INTO sales (po_number, cust_no, order_status, total_value)
  59.         VALUES ('VNEW1', 1015, 'new', 0);
  60.     printf("Stat12t:  Adding VNEW2\n");
  61.     EXEC SQL
  62.         INSERT INTO sales (po_number, cust_no, order_status, total_value)
  63.         VALUES ('VNEW2', 1015, 'new', 0);
  64.     printf("Stat12t:  Adding VNEW3\n");
  65.     EXEC SQL
  66.         INSERT INTO sales (po_number, cust_no, order_status, total_value)
  67.         VALUES ('VNEW3', 1015, 'new', 0);
  68.     EXEC SQL
  69.         COMMIT;
  70.  
  71.     /* Add batch 2. */
  72.     EXEC SQL
  73.         SET TRANSACTION;
  74.     printf("Stat12t:  Adding VNEW4\n");
  75.     EXEC SQL
  76.         INSERT INTO sales (po_number, cust_no, order_status, total_value)
  77.         VALUES ('VNEW4', 1015, 'new', 0);
  78.     EXEC SQL
  79.         COMMIT RELEASE;
  80.  
  81.         exit(0);
  82.  
  83. }
  84.