From: Yohanes Santoso Date: 2002-11-17T19:52:50+09:00 Subject: Re: Read a file... -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 "Ted" writes: > I wound up trying an explicit open with begin, rescue, end; then trying to read the file in one fell swoop (is that right?), and closing it; then issuing the SQL statement (with its own begin, rescue, end)... Well, if you can't open the file, then you can't read the file content and you don't need to close the file. If reading the SQL query from the file fails, the you can't issue SQL statement because you don't have the query. Thus, it's perfectly alright to put all those within one begin-rescue-end (bre) block: begin File.open("dfsf"){|f| query << f.readlines.to_s} sqlStatement = query dbh.execQuery(sqlStatemetn) . . . all other dbh-related activity . . . rescue Exception=>e p e end Thus, you don't need to do bre block everytime you do something. Arrange things that depend on the previous result to be in one bre block. YS. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.8 iD8DBQE913TyEOgCkEGX4MIRAi+IAKCs8tHPSOtueKOo9E9cWBeHDvcwhwCdFTXh brNLg2TEHxwTatBWz+cXcpw= =Yq7s -----END PGP SIGNATURE-----