SQLDICT

From Pickwiki
Revision as of 14:37, 4 February 2004 by Wol (talk) (Initial Creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
* SQLDICT - SQLises a dictionary
************************************************************************

      PROGRAM SQLDICT

************************************************************************

      PROMPT ""

      PRINT "Please enter file name to process: ":
      INPUT FILENAME

      EXECUTE "SELECT DICT ":FILENAME:" BY TYPE BY FIELD.NO BY @ID WITH TYPE EQ 'D' 'I'"
      READLIST KEYS THEN CONVERT @IM:@FM TO @VM:@VM IN KEYS
      IF KEYS EQ "" THEN STOP "No dictionary entries successfully selected!"

      OPEN "DICT", FILENAME TO DICTFILE ELSE STOP "Unable to open the dictionary!"
      DTYPES = ""
      ITYPES = ""
      NOSQL = ""
      LINE1 = "PH - Autogenerated by SQLDICT"
      ID.LISTED = 0

      LOOP
         REMOVE KEY FROM KEYS SETTING MER
         READ DICTENTRY FROM DICTFILE, KEY ELSE STOP "Unable to read ":KEY:" from dictionary!"

         BEGIN CASE
            CASE TRIM(DICTENTRY<8>) EQ ""
               NOSQL<-1> = KEY
            CASE TRIM(DICTENTRY<8>) EQ "NO SQL"
               * DONT PUT THIS ANYWHERE !!!
            CASE DICTENTRY[1,1] EQ "D"
               IF DICTENTRY<2> EQ 0 AND ID.LISTED THEN
                  NOSQL<-1> = KEY
               END ELSE
                  IF DICTENTRY<2> EQ 0 THEN ID.LISTED = 1
                  DTYPES<-1> = KEY
               END
            CASE DICTENTRY[1,1] EQ "I"
               ITYPES<-1> = KEY
            CASE 1
               STOP "Illegal type for ":KEY
         END CASE
      WHILE MER REPEAT

      WRITE LINE1:@FM:CONVERT(@FM, " ", NOSQL) TO DICTFILE, "@NO-SQL"
      WRITE LINE1:@FM:CONVERT(@FM, " ", DTYPES) TO DICTFILE, "@D-TYPES"
      WRITE LINE1:@FM:CONVERT(@FM, " ", ITYPES) TO DICTFILE, "@I-TYPES"
      WRITE LINE1:@FM:"@D-TYPES @I-TYPES" TO DICTFILE, "@SELECT"

      RETURN
   END