gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r24528 - monkey/trunk/seaspider


From: gnunet
Subject: [GNUnet-SVN] r24528 - monkey/trunk/seaspider
Date: Thu, 25 Oct 2012 05:33:14 +0200

Author: teichm
Date: 2012-10-25 05:33:14 +0200 (Thu, 25 Oct 2012)
New Revision: 24528

Modified:
   monkey/trunk/seaspider/seasp2_convert
Log:
seasp2_convert now ensures uniqueness of rows, no more duplicates

Modified: monkey/trunk/seaspider/seasp2_convert
===================================================================
--- monkey/trunk/seaspider/seasp2_convert       2012-10-25 03:01:56 UTC (rev 
24527)
+++ monkey/trunk/seaspider/seasp2_convert       2012-10-25 03:33:14 UTC (rev 
24528)
@@ -62,7 +62,8 @@
                                expr_syntax TEXT,
                                start_lineno INT,
                                end_lineno INT,
-                               is_call INT)''')
+                               is_call INT,
+                               UNIQUE (file_name, expr_syntax, start_lineno, 
end_lineno))''')
 
 
 # parses one .sea file
@@ -93,7 +94,7 @@
                        if prevtype == 'Begin-Expression':
                                if re.match(re.escape("End-Expression: " + 
rowfile + ':' + str(lineno) + ' ' + str(iscall)), line):
                                        vals = (rowfile, ' '.join(expr_list), 
lineno, scope_end[-1], iscall)
-                                       sql_cur.execute('INSERT INTO Expression 
VALUES (NULL,?,?,?,?,?)', vals)
+                                       sql_cur.execute('INSERT OR IGNORE INTO 
Expression VALUES (NULL,?,?,?,?,?)', vals)
                                        prevtype = 'End-Expression'
                                expr_list.append(line.strip())
                                continue
@@ -109,12 +110,12 @@
                        if rowtype == 'SystemGlobal':
                                globalvar = m.group(4)
                                vals = (cfilename, globalvar, 0, 32767, 0)
-                               sql_cur.execute('INSERT INTO Expression VALUES 
(NULL,?,?,?,?,?)', vals)
+                               sql_cur.execute('INSERT OR IGNORE INTO 
Expression VALUES (NULL,?,?,?,?,?)', vals)
                        elif rowtype == 'Global':
                                lineno = int(m.group(3))
                                globalvar = m.group(4)
                                vals = (rowfile, globalvar, lineno, 32767, 0)
-                               sql_cur.execute('INSERT INTO Expression VALUES 
(NULL,?,?,?,?,?)', vals)
+                               sql_cur.execute('INSERT OR IGNORE INTO 
Expression VALUES (NULL,?,?,?,?,?)', vals)
                        elif rowtype == 'Function':
                                pass
 #                              print 'nothing to do yet for entry type 
Function'
@@ -133,7 +134,7 @@
                                        except IndexError:
                                                break
                                        vals = (rowfile, para, lineno, 
scope_end[-1], 0)
-                                       sql_cur.execute('INSERT INTO Expression 
VALUES (NULL,?,?,?,?,?)', vals)
+                                       sql_cur.execute('INSERT OR IGNORE INTO 
Expression VALUES (NULL,?,?,?,?,?)', vals)
                        elif rowtype == 'Begin-Expression':
                                lineno = int(m.group(3))
                                iscall = int(m.group(4)[0])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]