aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v2/db_remove.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2010-04-20 19:30:42 -0400
committerRalph Amissah <ralph@amissah.com>2010-04-20 19:30:42 -0400
commitfebad4ff0e9628f9006bf489c9b1695eabc0607e (patch)
treeab602d26c4ff81df4b5a7a7313e0a0fb261e1a5a /lib/sisu/v2/db_remove.rb
parentdebian/changelog (2.1.0-1), debian/NEWS.Debian (diff)
parentreverts unique words list column and indexes; fix for drop indexes; changelog... (diff)
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib/sisu/v2/db_remove.rb')
-rw-r--r--lib/sisu/v2/db_remove.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/sisu/v2/db_remove.rb b/lib/sisu/v2/db_remove.rb
index 0a51b892..5a7f1244 100644
--- a/lib/sisu/v2/db_remove.rb
+++ b/lib/sisu/v2/db_remove.rb
@@ -59,18 +59,22 @@
=end
module SiSU_DB_remove
class Remove
- def initialize(opt,conn,file)
- @opt,@conn,@file=opt,conn,file
+ def initialize(opt,conn,file,sql_type)
+ @opt,@conn,@file,@sql_type=opt,conn,file,sql_type
@md=SiSU_Param::Parameters.new(@opt).get
@fnb=@md.fnb
@db=SiSU_Env::Info_db.new
end
def remove
- driver_sqlite3=(@conn.inspect.match(/^(.{10})/)[1]==@db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]) ? true : false
+ driver_sqlite3=if @sql_type=='sqlite'
+ (@conn.inspect.match(/^(.{10})/)[1]==@db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]) \
+ ? true \
+ : false
+ end
del_id=if driver_sqlite3
- @conn.get_first_value(%{ SELECT tid FROM metadata_and_text WHERE filename = '#{@opt.fns}'; }).to_i
+ @conn.get_first_value(%{ SELECT tid FROM metadata_and_text WHERE src_filename = '#{@opt.fns}'; }).to_i
else
- x=@conn.select_one(%{ SELECT metadata_and_text.tid FROM metadata_and_text WHERE metadata_and_text.filename = '#{@opt.fns}'; })
+ x=@conn.select_one(%{ SELECT metadata_and_text.tid FROM metadata_and_text WHERE metadata_and_text.src_filename = '#{@opt.fns}'; })
x ? (x.join.to_i) : nil
end
if del_id