Hi,
I have a script which parsing some xml files(works great :))
···
-----
File.open(file).each do |line|
if line =~ /<prf:CcppAccept>/..line =~ /<\/prf:CcppAccept>/
if line =~ /<rdf:li>(image|audio|video).*<\/rdf:li>/
line.gsub(
'<rdf:li>image/bmp', "INSERT INTO table
VALUES(\'#{dev_name}\',\'bmpinpage\',\'true\')").gsub(
'<rdf:li>audio/mp3', "INSERT INTO table
VALUES(\'#{dev_name}\',\'downloadable.audio.MP3\')").gsub(
'<rdf:li>video/mp4',"INSERT INTO table
VALUES(\'#{dev_name}\',\'downloadable.video.MP4\')").gsub(
"<\/rdf:li>", ";").each do |ss|
print ss
end
end
end
end
----
but now I wanted to put this regexped lines into postgres queries
def query1
conn =
PGconn.new({:host=>'localhost',:user=>'postgres',:dbname=>'data'})
res = conn.exec('#{ss}')
res.each do |row|
row.each do |column|
print column
end
puts
end
but its not working, please can anybody tell how to push this lines into
this postgres querries ??
Regards
beny18241
--
Posted via http://www.ruby-forum.com/.