Can add files to the database and print the number of files in the

database total
This commit is contained in:
bjschuma 2009-12-28 20:00:10 -05:00
parent db402f9659
commit 6ce24fae34
2 changed files with 14 additions and 1 deletions

View File

@ -50,4 +50,9 @@ def run(args=None):
path = expandPath( space.join(args) )
#database.open()
scan(path)
count = str(database.count("files"))
write("Library contains "+count+" files.")
database.close()

View File

@ -67,4 +67,12 @@ def insert(file):
#c = conn.cursor()
t = (file,)
conn.execute('insert into files values(?)',t)
#c.close()
#c.close()
def count(table):
global conn
if conn == None:
open()
result = conn.execute('select count(*) from '+ table)
return result.fetchone()[0]