Re: Problem mit Umlaute und DBI

Oliver Mensinger <[email protected]>
Newsgroups gmane.comp.lang.ruby.german
Message-ID <[email protected]>
Hallo Michael,

die Ausgabe sieht dann so aus:

p prep_sql:
#<DBI::SQL::PreparedStatement:0x40285d38
@sql="SELECT * FROM customer WHERE name='ö'",
@quoter=#<DBI::DBD::Pg::Statement:0x40285d60
@db=#<DBI::DBD::Pg::Database:0x402caa28 @autocommit=true,
@coerce=#<DBI::SQL::BasicQuote::Coerce:0x402ca424>,
@connection=#<PGconn:0x402ca474>,
@in_transaction=false, @type_map={1083=>:as_str, 27=>:as_str, 16=>:as_bool,
1562=>:as_str, 869=>:as_str, 704=>:as_str, 22=>:as_str, 0=>:as_str,
1700=>:as_str,
28=>:as_str, 17=>:as_str, 600=>:as_str, 1266=>:as_str, 650=>:as_str,
23=>:as_int,
628=>:as_str, 1184=>:as_timestamp, 700=>:as_float, 601=>:as_str, 29=>:as_str,
18=>:as_str, 24=>:as_str, 602=>:as_str, 1042=>:as_str, 30=>:as_str, 19=>:as_str,
701=>:as_float, 25=>:as_str, 718=>:as_str, 1560=>:as_str, 1186=>:as_str,
702=>:as_str,
603=>:as_str, 20=>:as_int, 1043=>:as_str, 790=>:as_str, 1082=>:as_date,
829=>:as_str,
26=>:as_str, 1033=>:as_str, 604=>:as_str, 703=>:as_str, 21=>:as_int},
@attr={"AutoCommit"=>true}, @debug_level=0>, @bindvars=[], @result=nil,
@prep_sql=#<DBI::SQL::PreparedStatement:0x40285d38 ...>>, @unbound={},
@result=["SELECT * FROM customer WHERE name=ö'"], @arg_index=0>

p bindvars:
[]

p boundsql:
"SELECT * FROM customer WHERE name=ö'"

Skript:
/usr/local/lib/ruby/site_ruby/1.6/DBD/Pg/Pg.rb:410:
in `execute': ERROR:  Unterminated quoted string (DBI::ProgrammingError)

Ich hoffe das bringt Dich weiter. Es ist ein Bug, oder?!

Oliver.


On Fri, 31 May 2002, Michael Neumann wrote:

>On Fri, May 31, 2002 at 02:59:20PM +0200, Oliver Mensinger wrote:
>> Hallo Michael,
>>
>> ruby -e 'puts "\366"' liefert ein "ö"
>>
>> Fuer das ...PreparedStatement.new... kommt bei mir auch
>>   "select * from a where x='ö'"
>> heraus.
>>
>> Hm, was ist "DBI::SQL::BasicQuote"??
>
>Nur ein Modul, welches die Method quote implementiert.
>Da aber im SQL Statement eh keine Parameter (?) enthalten sind, wird dies
>erst gar nicht verwendet (anstatt "X.new" könnte man in diesem Fall also
>auch "nil" nehmen).
>
>Könntest du mal in Pg.rb in Statement#execute vor der Zeile
>
>          boundsql = @prep_sql.bind(@bindvars)
>
>@prep_sql sowie @bindvars ausgeben (mittels "p"). Und nach der
>Zeile am besten auch "boundsql".
>
>MfG,
>
>  Michael
>_______________________________________________
>ruby-de mailing list
>[email protected]
>http://lists.bttr.org:8080/mailman/listinfo/ruby-de
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.