Skip Menu |
 

This queue is for tickets about the DBD-CSV CPAN distribution.

Report information
The Basics
Id: 53617
Status: rejected
Priority: 0/
Queue: DBD-CSV

People
Owner: Nobody in particular
Requestors: alex.peeters [...] citap.be
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.26
Fixed in: (no value)



Subject: ERROR: 2000000000 (Mismatched single quote before, ...
Download (untitled) / with headers
text/plain 601b
Dear Sire, ERROR: 2000000000 (Mismatched single quote before: ','check_dummy.pl ' DBD::CSV - INSERT INTO events VALUES ('check_dummy.pl -r 2') -> OK - INSERT INTO events VALUES ('check_dummy.pl --environment=T --trendline=2 -r 2') -> Mismatched single quote before Why is -- not allowed to use ? What do I wronly ? When inserting the same sql statement to MySQL this works. csv.pl to show the code and when it works and when not. my %VALUES = ( # ... # 'title' => 'Condenced View test', # 'test' => 'check_dummy.pl --environment=T --trendline=2 -r 2', -- Alex Peeters
Subject: csv.pl
Download csv.pl
text/x-perl 11.8k

Message body is not shown because it is too large.

Subject: Re: [rt.cpan.org #53617] ERROR: 2000000000 (Mismatched single quote before, ...
Date: Tue, 12 Jan 2010 14:07:01 +0100
To: bug-DBD-CSV [...] rt.cpan.org
From: "H.Merijn Brand" <h.m.brand [...] xs4all.nl>
Download (untitled) / with headers
text/plain 924b
On Tue, 12 Jan 2010 07:58:50 -0500, "Alex Peeters via RT" <bug-DBD-CSV@rt.cpan.org> wrote: Show quoted text
> Dear Sire, > > ERROR: 2000000000 (Mismatched single quote before: ','check_dummy.pl ' > > DBD::CSV > - INSERT INTO events VALUES ('check_dummy.pl -r 2') -> OK > - INSERT INTO events VALUES ('check_dummy.pl --environment=T > --trendline=2 -r 2') -> Mismatched single quote before > > Why is -- not allowed to use ?
-- is comment in ANSI SQL. I bet somewhere in the parsing the rest of the line is ignored. We'll have a look Does it work with placeholders? -- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00, 11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3. http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
Download (untitled) / with headers
text/plain 672b
Next example also don't work: INSERT INTO events (catalogID,id,uKey,replicationStatus,test,title,status,startDate,startTime,endDate,endTime,duration,statusMes sage,step,timeslot,instability,persistent,downtime,filename) VALUES ('SML','0','DUMMY-T5','I','check_dummy.pl --environment=T -- trendline=2 -r 2','Condenced View test','CRITICAL','2010/01/12','12:47:38','2010/01/12','12:47:41','00:00:03','CRITICAL - Dummy plugin for testing the \'Application Monitoring\' (Test): +DUMMY-T2+|Status=2;1;2;0;3 Compilation=992ms;;;0; Trendline=2.005s;;; ; Execution=2997ms;;;0;','120','1263296820','0','0','0','<NIHIL>') DBD::CSV::db do failed: Mismatched single quote before:
Subject: csv.pl
Download csv.pl
text/x-perl 12k

Message body is not shown because it is too large.

Subject: Re: [rt.cpan.org #53617] ERROR: 2000000000 (Mismatched single quote before, ...
Date: Tue, 12 Jan 2010 14:29:35 +0100
To: bug-DBD-CSV [...] rt.cpan.org
From: "H.Merijn Brand" <h.m.brand [...] xs4all.nl>
On Tue, 12 Jan 2010 08:20:17 -0500, "Alex Peeters via RT" <bug-DBD-CSV@rt.cpan.org> wrote: Show quoted text
> Queue: DBD-CSV > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=53617 > > > Next example also don't work:
It is a bug/misfeature in SQL::Statement which DBD::CSV cannot resolve Either use placeholders: $dbh->do ("insert into foo (c_foo, foo) values (?, ?)", undef, 9, "--foo"); or file a bug against SQL::Statement. I already notified the author of SQL::Statement, so I hope he picks up soon. Anyway, there is nothing I can do about this in DBD::CSV, so I will have to close this bug as rejected later. I feel your pain, but I can't help that from over here. -- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00, 11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3. http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
Download (untitled) / with headers
text/plain 1.5k
With placeholders it works: INSERT INTO events (catalogID,id,uKey,replicationStatus,test,title,status,startDate,startTime,endDate,endTime,duration,statusMes sage,step,timeslot,instability,persistent,downtime,filename) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) 'SML' '0' 'DUMMY-T5' 'I' 'check_dummy.pl --environment=T --trendline=2 -r 2' 'Condenced View test' 'CRITICAL' '2010/01/12' '12:4 7:38' '2010/01/12' '12:47:41' '00:00:03' 'CRITICAL - Dummy plugin for testing the \'Application Monitoring\' (Test): +DUMMY-T2+| Status=2;1;2;0;3 Compilation=992ms;;;0; Trendline=2.005s;;;; Execution=2997ms;;;0;' '120' '1263296820' '0' '0' '0' '<NIHIL>' sub CSV_insert_into_table { my ($rv, $dbh, $tableName, $columnSequence, $tableValues, $columnNameAutoincrement, $debug) = @_; if ( defined $dbh and $rv ) { my ($column, $placeholders, @values); foreach my $columnName ( @{$columnSequence} ) { $column .= $columnName .','; $placeholders .= '?,'; push ( @values, ( ( $columnName eq $columnNameAutoincrement ) ? $dbh->quote('0') : $dbh->quote($tableValues->{$columnName}) ) ); } if ( defined $column and defined $placeholders) { chop $column; chop $placeholders; my $sql = "INSERT INTO $tableName ($column) VALUES ($placeholders)"; print "$sql\n\n@values\n\n" if ($debug); my $sth = $dbh->prepare($sql) or $rv = error_Trap_DBI("Cannot sth->prepare: $sql", $debug); $sth->execute(@values) or $rv = error_Trap_DBI("Cannot sth->execute: @values", $debug); } } return $rv; }
Subject: csv.pl
Download csv.pl
text/x-perl 12.1k

Message body is not shown because it is too large.

Download (untitled) / with headers
text/plain 478b
I have now only one problem: "'SML'" should be "SML" ? "'SML'","'0'","'DUMMY-T5'","'I'","'check_dummy.pl --environment=T --trendline=2 -r 2'","'Condenced View test'","'CRITICAL'","'20 10/01/12'","'12:47:38'","'2010/01/12'","'12:47:41'","'00:00:03'","'CRITICAL - Dummy plugin for testing the \'Application Monitor ing\' (Test): +DUMMY-T2+|Status=2;1;2;0;3 Compilation=992ms;;;0; Trendline=2.005s;;;; Execution=2997ms;;;0;'","'120'","'12632968 20'","'0'","'0'","'0'","'<NIHIL>'"
Thanks for helping me out. You may close it :)
Subject: Re: [rt.cpan.org #53617] ERROR: 2000000000 (Mismatched single quote before, ...
Date: Tue, 12 Jan 2010 14:50:38 +0100
To: bug-DBD-CSV [...] rt.cpan.org
From: "H.Merijn Brand" <h.m.brand [...] xs4all.nl>
On Tue, 12 Jan 2010 08:32:58 -0500, "Alex Peeters via RT" <bug-DBD-CSV@rt.cpan.org> wrote: Show quoted text
> Queue: DBD-CSV > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=53617 > > > I have now only one problem: > "'SML'" should be "SML" ?
With placeholders, you should not use the ->quote () method at all. That is the beauty of placeholders! (change line 142) Show quoted text
> "'SML'","'0'","'DUMMY-T5'","'I'","'check_dummy.pl --environment=T > --trendline=2 -r 2'","'Condenced View test'","'CRITICAL'","'20 > 10/01/12'","'12:47:38'","'2010/01/12'","'12:47:41'","'00:00:03'","'CRITICAL > - Dummy plugin for testing the \'Application Monitor > ing\' (Test): +DUMMY-T2+|Status=2;1;2;0;3 Compilation=992ms;;;0; > Trendline=2.005s;;;; Execution=2997ms;;;0;'","'120'","'12632968 > 20'","'0'","'0'","'0'","'<NIHIL>'"
several comments. 1. Always use Text::CSV->new ({ binary => 1 }); 2. Always use $csv->getline ($fh) instead of $csv->parse () where possible. It is safer and quicker that'll make you code look more like --8<--- if (-e "$path$tableFilename$extention" ) { @{$columnSequence} = (); use Text::CSV; my $csv = Text::CSV->new ({ binary => 1 }); if (open my $rvOpen, "<", "$path$tableFilename$extention") { if (my $row = $csv->getline ($rvOpen) { @{$columnSequence} = @$row; } else { CSV_error_message (*EMAILREPORT, $csv->error_diag () .'\nFailed to parse line: '. $csv->error_input, $debug); } close $rvOpen; } else { CSV_error_message (*EMAILREPORT, "Cannot open $path$tableFilename$extention to print debug information", $debug); } } -->8--- Much cleaner, right? -- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00, 11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3. http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
Download (untitled) / with headers
text/plain 108b
Rejected in this queue, as it is not a DBD::CSV bug. Possible fixes will be addressed in SQL::Statement 2.x


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.