lib/framework/rho/rhoutils.rb in rhodes-3.1.1 vs lib/framework/rho/rhoutils.rb in rhodes-3.2.0.beta.1
- old
+ new
@@ -53,11 +53,12 @@
first_row=true
prefix = dir_prefix.nil? ? "" : dir_prefix
cur_src = nil
hashItem = {}
cur_objid = nil
- File.open(File.join(Rho::RhoFSConnector.get_base_app_path(),'app',prefix,'fixtures',filename+'.txt')).each do |line|
+ f = File.open(File.join(Rho::RhoFSConnector.get_base_app_path(),'app',prefix,'fixtures',filename+'.txt'))
+ f.each do |line|
if first_row
columns = line.chomp.split('|'); first_row = false; next;
end
parts = line.chomp.split('|')
@@ -108,12 +109,13 @@
if ( cur_src && cur_src.schema() )
hashItem[ row['attrib'] ] = row['value'] if row['value']
else
db.insert_into_table(filename,row)
end
- end
-
+ end
+ f.close
+
if cur_src && hashItem && hashItem.length() > 0
if !mapDeleted[cur_src.name()]
db.delete_all_from_table(cur_src.name())
mapDeleted[cur_src.name()] = 1
@@ -138,11 +140,12 @@
row_index=0
prefix = dir_prefix.nil? ? "" : dir_prefix
query = ""
- File.open(File.join(Rho::RhoFSConnector.get_base_app_path(),'app',prefix,'fixtures',filename+'.txt')).each do |line|
+ f = File.open(File.join(Rho::RhoFSConnector.get_base_app_path(),'app',prefix,'fixtures',filename+'.txt'))
+ f.each do |line|
if row_index == 0
columns = line.chomp.split('|')
quests = ""
columns.each do |col|
quests += ',' if quests.length() > 0
@@ -167,11 +170,12 @@
db.start_transaction
puts "commit : #{row_index}"
end
row_index += 1
- end
-
+ end
+ f.close
+
db.commit
puts "commit : #{row_index}"
columns = []
end
end
\ No newline at end of file