Handling file full of Database SQL Statements

Clovertech Forums Cloverleaf Handling file full of Database SQL Statements

  • Creator
    Topic
  • #118959
    Weston Olmstead
    Participant

      All,

      I’ve been given a less than ideal task of monitoring a directory for a .sql file that has a list of database insert statements and processing those through Cloverleaf and put into a database. Unfortunately I do no have any way to change this input format.

      My thought was to try to process this into a VRL type format, and then execute these directly into the database, however there are unfortunately newlines in the text so I cannot in split into unique “messages” correctly.

      My initial thoughts on how to do this are to write a pre-proc TCL to read in the entire file and split on my known end character (not newline) and then pass each insert is as a  new message.

      Any other advise on how to approach this within cloverleaf?

       

    Viewing 0 reply threads
    • Author
      Replies
      • #118960
        Charlie Bursell
        Participant

          Bring in as a file then split on your separator into a list.  Then like this.

          #Assumes a list named fileList

          # No need to keep message in memory, it may be large.  KILL original

          msgset $mh ”

          set dispList

            foreach rec $filelist {

            set nmh [msgcopy $mh]
            msgset $nmh $rec
            lappend dispList “CONTINUE $nmh”

            }

            return $dispList

             

             

        Viewing 0 reply threads
        • You must be logged in to reply to this topic.