Advertisement
Guest User

Untitled

a guest
May 31st, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. # share/sql/000_info.sql: <feff>DROP TABLE IF EXISTS `info`;
  2. # CREATE TABLE `info` (
  3. # `name` varchar(50) NOT NULL default '',
  4. # `type` varchar(20) default NULL,
  5. # `opus_lib` varchar(50) NOT NULL default '',
  6. # PRIMARY KEY (`name`)
  7. # ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  8.  
  9.  
  10. The code:
  11.  
  12.  
  13. my @files = sort glob( File::Spec->catfile('share', 'sql', '*.sql') );
  14. foreach my $file (@files) {
  15. local $/;
  16. open(my $fh, '<', $file) or die "$file: $!";
  17. my $file_text = <$fh>;
  18. push @sql, $file_text;
  19. Test::More::diag("$file: $file_text");
  20. }
  21.  
  22. my $dbh = DBI->connect($mysqld->dsn(dbname => 'test'), undef, undef);
  23. $dbh->{RaiseError} = 1;
  24. $dbh->do(q{set storage_engine=INNODB});
  25. $dbh->do($_) for @sql;
  26.  
  27.  
  28. The error:
  29.  
  30.  
  31. DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ?DROP TABLE IF EXISTS `info`;
  32. CREATE TABLE `info` (
  33. `name` va' at line 1 at t/collateral/lib/mysql/Indicator/ConfigData.pm line 112.
  34. DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ?DROP TABLE IF EXISTS `info`;
  35. CREATE TABLE `info` (
  36. `name` va' at line 1 at t/collateral/lib/mysql/Indicator/ConfigData.pm line 112.
  37. Compilation failed in require at t/collateral/lib/CommonSetup.pm line 11.
  38. BEGIN failed--compilation aborted at t/200-mysql.t line 5.
  39. t/200-mysql.t ..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement