diff options
Diffstat (limited to 'lib/sisu/v2/db_remove.rb')
-rw-r--r-- | lib/sisu/v2/db_remove.rb | 14 |
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 |