diff options
author | Ralph Amissah <ralph@amissah.com> | 2014-05-18 08:49:03 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2014-05-18 08:49:03 -0400 |
commit | 307ecb4df591aa675b71839014debf6e81d462e1 (patch) | |
tree | 647e6738bc5868f09c62e07cc03c45ab64e3c1cd /lib/sisu/v6/db_import.rb | |
parent | v6: utils, add ok code marker (diff) |
v5 v6: db, use symbols to identify sql engine
Diffstat (limited to 'lib/sisu/v6/db_import.rb')
-rw-r--r-- | lib/sisu/v6/db_import.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/sisu/v6/db_import.rb b/lib/sisu/v6/db_import.rb index e1342b1d..dd9dfe84 100644 --- a/lib/sisu/v6/db_import.rb +++ b/lib/sisu/v6/db_import.rb @@ -72,7 +72,7 @@ module SiSU_DbImport @@dl=nil @@hname=nil attr_accessor :tp - def initialize(opt,conn,file_maint,sql_type='pg') + def initialize(opt,conn,file_maint,sql_type=:pg) @opt,@conn,@file_maint,@sql_type=opt,conn,file_maint,sql_type @cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX @env=SiSU_Env::InfoEnv.new(@opt.fns) @@ -90,7 +90,7 @@ module SiSU_DbImport @col[:ocn]='' @counter={} @db=SiSU_Env::InfoDb.new - if @sql_type=='sqlite' + if @sql_type==:sqlite @driver_sqlite3=(@conn.inspect.match(/^(.{10})/)[1]==@db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]) \ ? true : false @@ -136,7 +136,7 @@ module SiSU_DbImport WHERE metadata_and_text.src_filename = '#{@md.fns}' AND metadata_and_text.language_document_char = '#{@opt.lng}' ;} # note, for .ssm: @md.fns (is set during runtime & is) != @opt.fns @md.opt.fns - file_exist=@sql_type=~/sqlite/ \ + file_exist=@sql_type==:sqlite \ ? @conn.get_first_value(select_first_match) : @conn.select_one(select_first_match) if not file_exist @@ -152,7 +152,7 @@ module SiSU_DbImport puts @conn.driver if defined? @conn.driver end begin #% sql - if @sql_type=~/sqlite/ + if @sql_type==:sqlite @conn.transaction do |conn| t_d.each do |sql| conn.execute(sql) @@ -497,7 +497,7 @@ module SiSU_DbImport @env=SiSU_Env::InfoEnv.new(@md.fns) @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html" txt=endnotes(txt).extract_any - if @sql_type=~/pg/ \ + if @sql_type==:pg \ and txt.size > (SiSU_DbColumns::ColumnSize.new.document_clean - 1) # examine pg build & remove limitation puts "\n\nTOO LARGE (TXT - see error log)\n\n" open("#{Dir.pwd}/pg_documents_error_log",'a') do |error| |