Re: Problem mit Umlaute und DBI

Michael Neumann <[email protected]>
Newsgroups gmane.comp.lang.ruby.german
Message-ID <[email protected]>
On Fri, May 31, 2002 at 12:55:35PM +0200, Oliver Mensinger wrote:
> Hallo zusammen, und ein spezielles Hallo an Michael Neumann!
> 
> Wenn ich folgendes ausfuehre
> 
>     dbh.select_one("SELECT * FROM artikel WHERE artikelnr='ö'")
> 
> bekomme ich die Fehlermeldung
>     /usr/local/lib/ruby/site_ruby/1.6/DBD/Pg/Pg.rb:407:in `execute': ERROR:
>     Unterminated quoted string (DBI::ProgrammingError)
>     from /usr/local/lib/ruby/site_ruby/1.6/dbi/dbi.rb:952:in `execute'
>     from /usr/local/lib/ruby/site_ruby/1.6/dbi/dbi.rb:553:in `execute'
>     from /usr/local/lib/ruby/site_ruby/1.6/dbi/dbi.rb:575:in `select_one'
> 
> Ich habe mir "boundsql" aus der Klasse "Statement" ausgeben lassen (puts
> boundsql in Zeile 394 in Pg.rb), und siehe  da, das Statement heisst da nur noch
> 
>     SELECT * FROM artikel WHERE artikelnr=ö'

Führ mal bitte folgendes Script aus:


  require "dbi"

  class X
    include DBI::SQL::BasicQuote
  end

  prep_sql = DBI::SQL::PreparedStatement.new(X.new, "select * from a where x='ö'")
  sql = prep_sql.bind([])
  puts sql

Was ist die Ausgabe?
Bei mir kommt folgendes raus:
 
  select * from a where x='ö'


Und was ist das Ergebnis von folgendem (auf Kommandozeile)?

  ruby -e 'puts "\366"'

MfG,

  Michael
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.