Can add files to the database and print the number of files in the
database total
This commit is contained in:
parent
db402f9659
commit
6ce24fae34
|
@ -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()
|
||||
|
||||
|
|
|
@ -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]
|
Loading…
Reference in New Issue