Thread Subroutine empfängt nur einen Wert.
(4 answers)
Opened by roooot at 2008-06-15 23:12
Hallo.
Ich habe mir eine kleine Hilfsklasse für mySQL gebaut. Leider spinnt das irgendwie: Es wird so aufgerufen Code (perl): (dl
)
1 2 3 4 5 6 7 8 require MySQL; my $mysql = new MySQL or croak "can't create MySQL Object"; my @sql_output = $mysql->get({ values => ('test1','test2'), table => 'test', where => "`type` = $id", }); was dann folgendes ausführt (Die eigentliche Abfrage usw fehlt noch) Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 sub get { my ($self,$arg_ref) = @_; my $prefix = $prefix_of{ident $self}; ### get needed parameters: my @values = $arg_ref->{'values'}; # ARRAY: value1, value2,... my $table = $arg_ref->{'table'}; # string my $where = $arg_ref->{'where'}; # sql-string, opt my $sort = $arg_ref->{'sort'}; # sql-string, opt ### check if alle values are filled in: if(!@values || !$table) { croak qq{ MySQL Error: Not all needed params (value, table) are specified! value: @values table: $table }; } ### transform values to my $sql_formed_values = join '`,`', @values; die $sql_formed_values; #testing } Leider springt meine Abfrage an, die dann folgendes ausgibt: Code: (dl
)
1 MySQL Error: Not all needed params (value, table) Danke für Hilfe/Tipps Viele Grüße :)
|