aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v5/db_import.rb28
-rw-r--r--lib/sisu/v6/db_import.rb28
2 files changed, 10 insertions, 46 deletions
diff --git a/lib/sisu/v5/db_import.rb b/lib/sisu/v5/db_import.rb
index 5819d5c2..3e9d19ec 100644
--- a/lib/sisu/v5/db_import.rb
+++ b/lib/sisu/v5/db_import.rb
@@ -102,7 +102,7 @@ module SiSU_DbImport
@col[:lid] ||=0
@col[:lid]=@driver_sqlite3 \
? @conn.execute( sql ).join.to_i
- : @conn.execute( sql ) { |x| x.fetch_all.flatten[0] }
+ : @conn.exec( sql ).getvalue(0,0).to_i
rescue
puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on
end
@@ -111,7 +111,7 @@ module SiSU_DbImport
begin
@id_n=@driver_sqlite3 \
? @conn.execute( sql ).join.to_i
- : @id_n=@conn.exec( sql ).getvalue(0,0).to_i
+ : @conn.exec( sql ).getvalue(0,0).to_i
@id_n ||=0
rescue
puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on
@@ -181,22 +181,6 @@ module SiSU_DbImport
end
@conn.exec("COMMIT")
end
- rescue DBI::DatabaseError => e
- STDERR.puts "Error code: #{e.err}"
- STDERR.puts "Error message: #{e.errstr}"
- STDERR.puts "Error SQLSTATE: #{e.state}"
- SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- sqlfn="#{@env.processing_path.sql}/#{@md.fnb}.sql"
- sql=File.new(sqlfn,'w')
- t_d.each {|i| sql.puts i}
- p sqlfn
- if @opt.act[:maintenance][:set]==:on
- puts sql
- p @conn.methods.sort
- puts "#{__FILE__}:#{__LINE__}"
- end
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
@@ -270,11 +254,9 @@ module SiSU_DbImport
sql='SELECT MAX(tid) FROM metadata_and_text;'
begin
@@id_t ||=0
- id_t=if @driver_sqlite3
- @conn.execute( sql ).join.to_i # { |x| id_t=x.join.to_i }
- else
- @conn.execute( sql ) { |x| x.fetch_all.flatten[0] }
- end
+ id_t=@driver_sqlite3 \
+ ? @conn.execute( sql ).join.to_i # { |x| id_t=x.join.to_i }
+ : @conn.exec( sql ).getvalue(0,0).to_i
@@id_t=id_t if id_t
rescue
puts "#{__FILE__} #{__LINE__}" if @opt.act[:maintenance][:set]==:on
diff --git a/lib/sisu/v6/db_import.rb b/lib/sisu/v6/db_import.rb
index 4b3fdbc5..f3e8b96c 100644
--- a/lib/sisu/v6/db_import.rb
+++ b/lib/sisu/v6/db_import.rb
@@ -102,7 +102,7 @@ module SiSU_DbImport
@col[:lid] ||=0
@col[:lid]=@driver_sqlite3 \
? @conn.execute( sql ).join.to_i
- : @conn.execute( sql ) { |x| x.fetch_all.flatten[0] }
+ : @conn.exec( sql ).getvalue(0,0).to_i
rescue
puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on
end
@@ -111,7 +111,7 @@ module SiSU_DbImport
begin
@id_n=@driver_sqlite3 \
? @conn.execute( sql ).join.to_i
- : @id_n=@conn.exec( sql ).getvalue(0,0).to_i
+ : @conn.exec( sql ).getvalue(0,0).to_i
@id_n ||=0
rescue
puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on
@@ -181,22 +181,6 @@ module SiSU_DbImport
end
@conn.exec("COMMIT")
end
- rescue DBI::DatabaseError => e
- STDERR.puts "Error code: #{e.err}"
- STDERR.puts "Error message: #{e.errstr}"
- STDERR.puts "Error SQLSTATE: #{e.state}"
- SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
- __LINE__.to_s + ':' + __FILE__
- end
- sqlfn="#{@env.processing_path.sql}/#{@md.fnb}.sql"
- sql=File.new(sqlfn,'w')
- t_d.each {|i| sql.puts i}
- p sqlfn
- if @opt.act[:maintenance][:set]==:on
- puts sql
- p @conn.methods.sort
- puts "#{__FILE__}:#{__LINE__}"
- end
rescue
SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
@@ -270,11 +254,9 @@ module SiSU_DbImport
sql='SELECT MAX(tid) FROM metadata_and_text;'
begin
@@id_t ||=0
- id_t=if @driver_sqlite3
- @conn.execute( sql ).join.to_i # { |x| id_t=x.join.to_i }
- else
- @conn.execute( sql ) { |x| x.fetch_all.flatten[0] }
- end
+ id_t=@driver_sqlite3 \
+ ? @conn.execute( sql ).join.to_i # { |x| id_t=x.join.to_i }
+ : @conn.exec( sql ).getvalue(0,0).to_i
@@id_t=id_t if id_t
rescue
puts "#{__FILE__} #{__LINE__}" if @opt.act[:maintenance][:set]==:on