home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / xbase / interpre / pbase / wine.prg < prev   
Text File  |  1985-10-04  |  2KB  |  83 lines

  1. * WINE.PRG (10-04.a)
  2. * simple SQL commands & a wine table
  3.  
  4. SWITCH DEFAULT
  5. SWITCH TALK OFF
  6. RESET DATABASE
  7. CLEAR SCREEN
  8.  
  9. DOMENU
  10.   MENUTITLE '[ Run SQL with... ]'  
  11.   MENUOPTION 'Command echo'
  12.   MENUOPTION 'Command single-step'
  13.   MENUOPTION 'Do NOT run test'
  14.   MENUCHOICE choice
  15.   ENDMENU
  16. DOCASE
  17.   CASE choice=1
  18.     ASSIGN 'ECHO' TO _switch
  19.   CASE choice=2
  20.     ASSIGN 'STEP' to _switch
  21.   CASE choice=3
  22.     SWITCH DEFAULT
  23.     RETURN
  24.   OTHERWISE
  25.     SWITCH DEFAULT
  26.     RETURN
  27.   ENDCASE
  28. SWITCH &_switch ON
  29. CREATE DATABASE wine
  30. CREATE CURSOR 1 FOR wine
  31. USE CURSOR 1
  32. CLEAR SCREEN
  33. CREATE TABLE cellar;
  34.   (bin NUMBER,wine CHAR(15),producer CHAR(15),year NUMBER,bottles NUMBER,comments CHAR(25))
  35. INSERT INTO cellar;
  36.   (bin,wine,producer,year,bottles,comments);
  37.   VALUES(2,'Chardonnay','Buena Vista',79,1,NULL)
  38. INSERT INTO cellar;
  39.   (bin,wine,producer,year,bottles,comments);
  40.   VALUES(3,'Chardonnay','Louis Martini',81,5,NULL)
  41. INSERT INTO cellar;
  42.   (bin,wine,producer,year,bottles,comments);
  43.   VALUES(6,'Chardonnay','Chappellet',80,4,'Thanksgiving')
  44. INSERT INTO cellar;
  45.   (bin,wine,producer,year,bottles,comments);
  46.   VALUES(11,'Riesling','Jekel',80,6,NULL)
  47. INSERT INTO cellar;
  48.   (bin,wine,producer,year,bottles,comments);
  49.   VALUES(12,'Riesling','Buena Vista',77,1,'Late harvest')
  50. INSERT INTO cellar;
  51.   (bin,wine,producer,year,bottles,comments);
  52.   VALUES(16,'Riesling','Sattui',79,1,'Very dry')
  53. INSERT INTO cellar;
  54.   (bin,wine,producer,year,bottles,comments);
  55.   VALUES(43,'Cab.Sauvignon','Robt.Mondavi',77,12,NULL)
  56. INSERT INTO cellar;
  57.   (bin,wine,producer,year,bottles,comments);
  58.   VALUES(64,'Zinfandel','Mirassou',77,2,'Anniversary')
  59. PAUSE
  60. CLEAR SCREEN
  61. SELECT bin,wine,producer,year,bottles FROM cellar;
  62.   ORDER BY producer,year
  63. SHOW
  64. PAUSE
  65. CLEAR SCREEN
  66. SELECT bin,wine,producer,year,bottles FROM cellar;
  67.   WHERE wine='Chardonnay' ORDER BY year
  68. SHOW
  69. UPDATE cellar SET bottles=4 WHERE bin=3
  70. SELECT bin,wine,producer,year,bottles FROM cellar;
  71.   WHERE wine='Chardonnay' ORDER BY year
  72. SHOW
  73. PAUSE
  74. CLEAR SCREEN
  75. DELETE FROM cellar WHERE bin=2
  76. SELECT bin,wine,producer,year,bottles FROM cellar;
  77.   WHERE wine='Chardonnay' ORDER BY year
  78. SHOW
  79. PAUSE
  80. CLEAR SCREEN
  81. DROP CURSOR 1
  82. SWITCH DEFAULT
  83.