chiark / gitweb /
adding cgiFiles to repo
[familyTree.git] / familyTree / testsql.py
diff --git a/familyTree/testsql.py b/familyTree/testsql.py
new file mode 100755 (executable)
index 0000000..dbf8ebd
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+
+import askQuestion as aQ
+import sys     
+import re
+import string
+def add_quotes(s):
+        return '\"'+s+'\"'
+
+def make_insert(table,fields):
+        s = 'INSERT INTO ' + table + ' VALUES('
+        for f in fields:
+                s = s + add_quotes(f) + ','
+        s = s[:-1]
+        s = s+');'
+        return s
+
+
+
+conn = aQ.connect()
+
+s = 'CREATE TABLE test\n(\nStyle text,\nShort text);'
+a = aQ.run_query(s,())
+
+for i in range(0,10):
+       s = make_insert('test',[str(i),'a'])
+       a = aQ.run_query(s,())
+       conn.commit()
+aQ.close(conn)