def query(self, statement):
     self.db_view = e32db.Db_view()
     self.db_view.prepare(self.db, unicode(statement))
     no_of_rows = self.db_view.count_line()
     self.db_view.first_line()
     data = []
     for row_no in xrange(no_of_rows):
         self.db_view.get_line()
         line = []
         # Will contain col_type, col_raw, col_rawtime, format_rawtime
         misc_testdata = []
         for column_no in xrange(1, self.db_view.col_count() + 1):
             line.append(self.db_view.col(column_no))
             column_type = self.db_view.col_type(column_no)
             misc_testdata.append(column_type)
             if not self.db_view.is_col_null(column_no):
                 misc_testdata.append(self.db_view.col_length(column_no))
             if column_type != 15:
                 misc_testdata.append(repr(self.db_view.col_raw(column_no)))
             if column_type == 10:
                 misc_testdata.append(
                                  repr(self.db_view.col_rawtime(column_no)))
                 misc_testdata.append(repr(e32db.format_rawtime(
                                      self.db_view.col_rawtime(column_no))))
         data.append(tuple(line))
         self.db_view.next_line()
     del self.db_view
     return data, misc_testdata
Пример #2
0
def query(db, statement):
    DBV = e32db.Db_view()
    DBV.prepare(db, unicode(statement))
    n = DBV.count_line()
    DBV.first_line()
    data = []
    for i in xrange(n):
        DBV.get_line()
        line = []
        for j in xrange(DBV.col_count()):
            line.append(DBV.col(1 + j))
            t = DBV.col_type(1 + j)
            print "Column type: %d" % t
            if t != 15:
                print "Raw value: %s" % repr(DBV.col_raw(1 + j))
            if t == 10:
                print "Raw time: %s" % repr(DBV.col_rawtime(1 + j))
                print "Formatted: %s" % e32db.format_rawtime(
                    DBV.col_rawtime(1 + j))

        data.append(tuple(line))
        DBV.next_line()
    del DBV
    return data