Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAssim Deodia <assim.deodia@gmail.com>2008-06-14 16:30:20 (GMT)
committer Assim Deodia <assim.deodia@gmail.com>2008-06-14 16:30:20 (GMT)
commit2385830803ca8b6eaf9a2666f26c0f5586167c46 (patch)
tree5024c756d739b7fae5e97eb904939e04c56ad9a8
parent070b7aebaf3870e42d709d394b17201c47291ccb (diff)
bug fix: dictionary.py
-rw-r--r--dictionary.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/dictionary.py b/dictionary.py
index b6887c8..b962714 100644
--- a/dictionary.py
+++ b/dictionary.py
@@ -12,6 +12,7 @@ global __src__
global __fld__
global __debug
global __numword
+global __DBName
global __DBTableName
__root__ = "dictionary"
@@ -24,6 +25,7 @@ __src__ = "source"
__fld__ = "fld"
__debug = True
__numword = -1
+__DBName = "/tmp/las"
__DBTableName = "dictionary" #Currently not used
#strings which are tag in XML
@@ -71,18 +73,17 @@ class dictionary:
tempDict["pos"] = child.text
t = ( tempDict["word"],tempDict["def"],tempDict["phnm"],tempDict["src"],tempDict["pos"] )
self.c.execute( "insert into dict values (?, ? , ?, ?, ?)", t )
- self.c.execute("select * from dict")
- for row in self.c:
- print row
+ self.conn.commit()
+ self.c.close()
+ self.conn.close()
def MakeDB(self):
import sqlite3
import random
- salt = str(random.uniform(1, 9))[2:7]
- conn = sqlite3.connect("/tmp/las" + salt)
- self.c = conn.cursor()
- self.c.execute('''create table dict (word text, def text, phnm text, src text, pos text)''')
-
+ self.conn = sqlite3.connect("las.db")
+ self.c = self.conn.cursor()
+ self.c.execute('''DROP TABLE IF EXISTS dict''')
+ self.c.execute('''CREATE table IF NOT EXISTS dict (word text, def text, phnm text, src text, pos text)''')
if __name__ == "__main__":
k = dictionary("dict/k.xml")