def sql_execute(conn, text)
cmd = Gda::Command.new(text,
Gda::Command::TYPE_SQL,
Gda::Command::OPTION_STOP_ON_ERRORS)
out = ""
if datamod = conn.execute_single_command(cmd)
datamod.each_column { |title| out += title + "\t" }
out += "\n"
datamod.each_row do |row|
row.each_value { |val| out += val.to_s + "\t" }
out += "\n"
end
else
conn.errors.each do |err|
out += "Error #{err.number.to_s}\n" \
+ "Description: #{err.description}\n" \
+ "Source: #{err.source}\n" \
+ "SQL state: #{err.sqlstate}\n"
end
end
out.strip
end