Example #1
0
    def __iter__(self):
        tokens = read_until(['BlankLine'], 
                            self._tokenizer,
                            inclusive=True)
        foo = HeaderNode(tokens)
        if foo.database:
            self._current_db = foo.database
        yield foo

        tokens = read_until(['BlankLine'], 
                            self._tokenizer, 
                            inclusive=True)
        yield SetupSessionNode(tokens)

        for chunk in self.iter_chunks():
            yield chunk
Example #2
0
 def handle_view_ddl(self, token):
     tokens = (self._queue.flush() +
               [token] + 
               read_until(['SqlComment'], self._tokenizer))
     foo = ViewDDL(tokens)
     foo.database = self._current_db
     return foo
Example #3
0
    def handle_create_db(self, token):
        tokens = (self._queue.flush() + [token] +
                  read_until(['SqlComment'], self._tokenizer))

        foo = DatabaseDDL(tokens)
        self._current_db = foo.database
        return foo
Example #4
0
 def handle_reconnect_for_views(self, token):
     tokens = (self._queue.flush() +
               [token]
              )
     if self._tokenizer.peek().symbol == 'BlankLine':
         tokens.extend(read_until(['SqlComment', 'ConditionalComment'],
                                  self._tokenizer))
     return ReconnectDBFinalizeView(tokens)
Example #5
0
 def handle_table_ddl(self, token):
     if self._tokenizer.peek().symbol == 'DropView':
         return self.handle_temp_view(token)
     foo = TableDDL(self._queue.flush() + 
                     [token] +
                     read_until(['SqlComment'], self._tokenizer))
     foo.database = self._current_db
     return foo
Example #6
0
 def handle_routines(self, token):
     tokens = (self._queue.flush() +
               read_until(['SqlComment'], self._tokenizer))
     return DatabaseRoutines(tokens)