示例#1
0
 def get_columns(self, relation):
     sql = """SELECT c.name, t.name, c.colid FROM sysobjects AS o JOIN syscolumns AS c ON o.id = c.id JOIN systypes AS t ON c.usertype = t.usertype WHERE o.name = '%s'""" % relation.name
     result = self.query(sql)
     results = []
     for r in result:
         co = ColumnObject(r[0].strip(), self, relation)
         co.type = r[1].strip()
         co.num = r[2]
         results.append(co)
     return results
示例#2
0
文件: sybase.py 项目: pepl/db-tools
 def get_columns(self, relation):
     sql = """SELECT c.name, t.name, c.colid FROM sysobjects AS o JOIN syscolumns AS c ON o.id = c.id JOIN systypes AS t ON c.usertype = t.usertype WHERE o.name = '%s'""" % relation.name
     result = self.query(sql)
     results = []
     for r in result:
         co = ColumnObject(r[0].strip(), self, relation)
         co.type = r[1].strip()
         co.num = r[2]
         results.append(co)
     return results
示例#3
0
 def get_columns(self, relation):
     sql = """SELECT column_name, udt_name, ordinal_position FROM information_schema.columns WHERE table_catalog = %(dbname)s AND table_schema = %(sname)s AND table_name = %(rname)s"""
     dbname = relation.parent.parent.name
     sname = relation.parent.name
     rname = relation.name
     result = self.query(sql, locals())
     results = []
     for r in result:
         co = ColumnObject(r[0], self, relation)
         co.type = r[1]
         co.num = r[2]
         results.append(co)
     return results
示例#4
0
 def get_columns(self, relation):
     sql = """SELECT column_name, udt_name, ordinal_position FROM information_schema.columns WHERE table_catalog = %(dbname)s AND table_schema = %(sname)s AND table_name = %(rname)s"""
     dbname = relation.parent.parent.name
     sname = relation.parent.name
     rname = relation.name
     result = self.query(sql, locals())
     results = []
     for r in result:
         co = ColumnObject(r[0], self, relation)
         co.type = r[1]
         co.num = r[2]
         results.append(co)
     return results