ruby mysql module frage - mehrere INSERT auf einmal

Markus Jais <[email protected]>
Newsgroups gmane.comp.lang.ruby.german
Message-ID <[email protected]>
hallo

ich bin gerade dabei ein kleines tutorial für ruby und mysql zu schreiben
(auf englisch, wird kostenlos im web verfügbar sein wenn es mal etwas zu 
sehen/lesen gibt)

dabei bin ich auf ein problem gestoßen:
ich möchte mehrere datensätze auf einmal einfügen wie folgt:

sql = "INSERT INTO words VALUES('Adler', 'eagle', 'aigle', 'aquila', 
'aquila');"
sql += "INSERT INTO words VALUES('Haus', 'house', 'maison', 'casa', 'casa')"
puts sql
m.query(sql)

when ich den string, den puts(sql) ausgibt per copy and paste in das mysql 
command line tool kopiere werden die datensätze eingefügt.

aber via ruby gibt es folgenden fehler:
./create.rb:23:in `query': You have an error in your SQL syntax near ';INSERT 
INTO words VALUES('Haus', 'house', 'maison', 'casa', 'casa')' at line 1 
(MysqlError)
        from ./create.rb:23

ich schätze mal, das hängt irgendwie mit dem ";" zusammen.
gibt es eine möglichkeit, das man mehrere INSERT auf einmal aufruft.

ich verwende 
mysql-ruby 2.4.2a, mysql-max 4.0.2 und ruby 1.6.7 auf RH 7.3

ich will nicht ruby/dbi verwenden für dieses beispiel sondern nur mysql-ruby.

irgendwelche ideen?

markus


-- 
Markus Jais
http://www.mjais.de
[email protected]
The road goes ever on and on - Bilbo Baggins
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.