diff options
author | Ralph Amissah <ralph@amissah.com> | 2010-04-17 21:38:33 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2010-04-17 21:44:31 -0400 |
commit | 9f5b2818972fc01ffd992b2635765c982f644e24 (patch) | |
tree | 5c4676d9000456eab58eadb4c83b1fade7d3b0d9 /lib/sisu/v2/db_remove.rb | |
parent | db_create, on processing screen output appropriate display for pgsql & sqlite... (diff) |
db_import sqlite, prevent multiple import of file with same filename(.sst)
(cgi form should work correctly, without multiple entries)
db_import, db_remove:
* wrap some sqlite actions in sqlite check;
* cosmetic code arrangement
Diffstat (limited to 'lib/sisu/v2/db_remove.rb')
-rw-r--r-- | lib/sisu/v2/db_remove.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/sisu/v2/db_remove.rb b/lib/sisu/v2/db_remove.rb index 0a51b892..e7942a15 100644 --- a/lib/sisu/v2/db_remove.rb +++ b/lib/sisu/v2/db_remove.rb @@ -59,14 +59,18 @@ =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 else |