I want to create complex sql query for pgsql.
Following construction produce an error :
conn = PGconn.connect(pghost,pgport,pgoptions,pgtty,dbname)
open(".ftppasswd") { |file|
file.each_line { |line|
next if /^\s*#/ =~ line
username, password, = line.chomp.split(':')
res="CREATE TABLE ", username, " (id SERIAL, a char)"
result = conn.exec ($res)
^^^^^^^line 19
}
}
[kosha@kosha ruby_test]$ ./create_table.ruby
./create_table.ruby:19:in `exec': wrong argument type nil (expected String)
(TypeError)
from ./create_table.ruby:19
from ./create_table.ruby:11:in `each_line'
from ./create_table.ruby:11
from ./create_table.ruby:10:in `open'
from ./create_table.ruby:10
[kosha@kosha rubye sample]$
--
WBR
Korshunov Ilya