From: "Michael C. Libby" Date: 2002-11-17T12:07:12+09:00 Subject: Re: Read a file... -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Saturday 16 November 2002 20:00, Ted wrote: > It seems so simple, but eludes me. > I'd like to read a small file containing an SQL query into a String > variabl, then use the String variable in a PostgreSQL query. > I have the query working with a an assignment statement; but reading > in the SQL hasn't worked -- at least for the last 3 hours... > I'd like to do it as one read, if possible. Have you tried: query = '' File.open("filename.sql"){|f| query << f.readlines.to_s} -michael -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE91weL4ClW9KMwqnMRAtvBAJ94XSZxzqo7m2ETBHo+Be0LCsLD1wCbBtL3 SEye/qpvPsal0jJZJL6bdVU= =9jvv -----END PGP SIGNATURE-----