[Hejes-devel] [856] added sqlite commandline tool for dbekwiki
hejes-devel at nytud.hu
hejes-devel at nytud.hu
Fri Jul 19 13:53:44 CEST 2013
Revision: 856
Author: mihaltz
Date: 2013-07-19 13:53:44 +0200 (Fri, 19 Jul 2013)
Log Message:
-----------
added sqlite commandline tool for dbekwiki
Added Paths:
-----------
trunk/misc/dbekwiki/sqlite.py
Added: trunk/misc/dbekwiki/sqlite.py
===================================================================
--- trunk/misc/dbekwiki/sqlite.py (rev 0)
+++ trunk/misc/dbekwiki/sqlite.py 2013-07-19 11:53:44 UTC (rev 856)
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+# coding: utf-8
+'''
+
+Type SQL queries for DB
+
+ at author MM
+
+'''
+
+from __future__ import print_function
+
+import sys
+import os
+import glob
+import readline
+
+sys.path.append('/opt/web2py')
+from gluon import *
+
+db = DAL("sqlite://storage.sqlite", folder='../../web2py/applications/ekwiki/databases/')
+
+if glob.glob('./.sql_history'):
+ readline.read_history_file('./.sql_history')
+
+print('Type your queries, enter to exit')
+while True:
+ line = raw_input('>')
+ if not line:
+ break
+ rows = db.executesql(line)
+ print('{0} row(s)'.format(len(rows)))
+ for row in rows:
+ print(row)
+
+readline.set_history_length(200)
+readline.write_history_file('./.sql_history' )
+
Property changes on: trunk/misc/dbekwiki/sqlite.py
___________________________________________________________________
Added: svn:executable
+ *
More information about the Hejes-devel
mailing list