فهرست منبع

Add create method in the Columns class

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54589 15284696-431f-4ddb-bdfa-cd5b030d7da7
Pietro Zambelli 12 سال پیش
والد
کامیت
62bf860f65
1فایلهای تغییر یافته به همراه9 افزوده شده و 0 حذف شده
  1. 9 0
      lib/python/pygrass/vector/table.py

+ 9 - 0
lib/python/pygrass/vector/table.py

@@ -302,6 +302,15 @@ class Columns(object):
         """
         return self.odict.items()
 
+    def create(self, cols):
+        """"""
+        cur = self.conn.cursor()
+        coldef = ',\n'.join(['%s %s' % col for col in cols])
+        cur.execute(sql.CREATE_TAB.format(tname=self.tname, coldef=coldef))
+        self.conn.commit()
+        cur.close()
+        self.update_odict()
+
     def add(self, col_name, col_type):
         """Add a new column to the table. ::