[MonetDB-users] copy ... from stdin in perl script

Hi, I have table t1(f1 integer) I can copy to it by executing this file via mclient: $ cat /tmp/f1.sql copy into t1 from stdin; 1 2 3 But I can't copy to it by this perl script: $ cat /tmp/f1.pl #!/usr/bin/perl -w use DBI; my $dbh = DBI->connect('dbi:monetdb:database=db', 'dbadmin', "dbpwd"); $dbh->do("copy into t1 from stdin;\n1\n2\n3\n"); I got: Missing argument in sprintf at /usr/lib64/perl5/DBD/monetdb/GetInfo.pm line 25. No query result at /usr/lib64/perl5/MonetDB/CLI/MapiLib.pm line 80. Use of uninitialized value in die at /usr/lib64/perl5/MonetDB/CLI/MapiLib.pm line 180. (in cleanup) Died at /usr/lib64/perl5/MonetDB/CLI/MapiLib.pm line 180. Why can it be? -- Thanks, Eugene Prokopiev

On 16-09-2011 15:39:38 +0400, Eugene Prokopiev wrote:
But I can't copy to it by this perl script:
$ cat /tmp/f1.pl #!/usr/bin/perl -w use DBI; my $dbh = DBI->connect('dbi:monetdb:database=db', 'dbadmin', "dbpwd"); $dbh->do("copy into t1 from stdin;\n1\n2\n3\n");
I got:
Missing argument in sprintf at /usr/lib64/perl5/DBD/monetdb/GetInfo.pm line 25. No query result at /usr/lib64/perl5/MonetDB/CLI/MapiLib.pm line 80.
Hmm, I think this needs some looking into. Do Sjoerd's recent fixes help you to get further (or with much less warnings at least) for this case?

2011/9/20 Fabian Groffen
Hmm, I think this needs some looking into. Do Sjoerd's recent fixes help you to get further (or with much less warnings at least) for this case?
New perl module from MonetDB-11.5.1.tar.bz2 is broken :( I have got following errors with the same script: Missing argument in sprintf at /usr/lib64/perl5/DBD/monetdb/GetInfo.pm line 25. Scalar value @challenge[2] better written as $challenge[2] at /usr/lib64/perl5/Mapi.pm line 28. Scalar value @challenge[5] better written as $challenge[5] at /usr/lib64/perl5/Mapi.pm line 29. Scalar value @challenge[2] better written as $challenge[2] at /usr/lib64/perl5/Mapi.pm line 42. Scalar value @challenge[2] better written as $challenge[2] at /usr/lib64/perl5/Mapi.pm line 45. Scalar value @challenge[3] better written as $challenge[3] at /usr/lib64/perl5/Mapi.pm line 49. Scalar value @challenge[0] better written as $challenge[0] at /usr/lib64/perl5/Mapi.pm line 53. Scalar value @challenge[0] better written as $challenge[0] at /usr/lib64/perl5/Mapi.pm line 56. Scalar value @challenge[0] better written as $challenge[0] at /usr/lib64/perl5/Mapi.pm line 59. Scalar value @challenge[0] better written as $challenge[0] at /usr/lib64/perl5/Mapi.pm line 62. Scalar value @challenge[0] better written as $challenge[0] at /usr/lib64/perl5/Mapi.pm line 68. Scalar value @tokens[3] better written as $tokens[3] at /usr/lib64/perl5/Mapi.pm line 121. Scalar value @tokens[4] better written as $tokens[4] at /usr/lib64/perl5/Mapi.pm line 121. Scalar value @tokens[5] better written as $tokens[5] at /usr/lib64/perl5/Mapi.pm line 121. Scalar value @chars[0] better written as $chars[0] at /usr/lib64/perl5/Mapi.pm line 243. Scalar value @chars[0] better written as $chars[0] at /usr/lib64/perl5/Mapi.pm line 252. Scalar value @chars[0] better written as $chars[0] at /usr/lib64/perl5/Mapi.pm line 254. Scalar value @chars[0] better written as $chars[0] at /usr/lib64/perl5/Mapi.pm line 256. Scalar value @chars[0] better written as $chars[0] at /usr/lib64/perl5/Mapi.pm line 264. Scalar value @chars[0] better written as $chars[0] at /usr/lib64/perl5/Mapi.pm line 268. Scalar value @chars[0] better written as $chars[0] at /usr/lib64/perl5/Mapi.pm line 270. Scalar value @chars[0] better written as $chars[0] at /usr/lib64/perl5/Mapi.pm line 296. Scalar value @chars[1] better written as $chars[1] at /usr/lib64/perl5/Mapi.pm line 297. Scalar value @chars[1] better written as $chars[1] at /usr/lib64/perl5/Mapi.pm line 297. Scalar value @chars[1] better written as $chars[1] at /usr/lib64/perl5/Mapi.pm line 298. Scalar value @chars[1] better written as $chars[1] at /usr/lib64/perl5/Mapi.pm line 324. Scalar value @chars[1] better written as $chars[1] at /usr/lib64/perl5/Mapi.pm line 332. Scalar value @chars[1] better written as $chars[1] at /usr/lib64/perl5/Mapi.pm line 334. Scalar value @chars[1] better written as $chars[1] at /usr/lib64/perl5/Mapi.pm line 341. Use of uninitialized value $prompt in pattern match (m//) at /usr/lib64/perl5/Mapi.pm line 124. Use of uninitialized value $prompt in string ne at /usr/lib64/perl5/Mapi.pm line 133. -- Thanks, Eugene Prokopiev

On 26-09-2011 20:59:45 +0400, Eugene Prokopiev wrote:
2011/9/20 Fabian Groffen
: Hmm, I think this needs some looking into. Do Sjoerd's recent fixes help you to get further (or with much less warnings at least) for this case?
New perl module from MonetDB-11.5.1.tar.bz2 is broken :( I have got following errors with the same script:
Missing argument in sprintf at /usr/lib64/perl5/DBD/monetdb/GetInfo.pm line 25. Scalar value @challenge[2] better written as $challenge[2] at /usr/lib64/perl5/Mapi.pm line 28.
This looks like old code, it reads as follows here: if ($challenge[2] == 9) { Please try 11.5.3 from http://dev.monetdb.org/downloads/testing/sources/Aug2011-SP1/

2011/9/26 Fabian Groffen
Please try 11.5.3 from http://dev.monetdb.org/downloads/testing/sources/Aug2011-SP1/
Thanks, there are no errors on executing my script but no results to. I can add rows with insert and can't add them with copy. Maybe I need to send data for copy statement in different way instead of write it after copy statement?

On 27-09-2011 08:33:42 +0400, Eugene Prokopiev wrote:
2011/9/26 Fabian Groffen
: Please try 11.5.3 from http://dev.monetdb.org/downloads/testing/sources/Aug2011-SP1/
Thanks, there are no errors on executing my script but no results to. I can add rows with insert and can't add them with copy. Maybe I need to send data for copy statement in different way instead of write it after copy statement?
I need to check that, but wouldn't be surprised when you can't use DBD to use copy into, like you can't use JDBC for that either.

2011/9/27 Fabian Groffen
Thanks, there are no errors on executing my script but no results to. I can add rows with insert and can't add them with copy. Maybe I need to send data for copy statement in different way instead of write it after copy statement?
I need to check that, but wouldn't be surprised when you can't use DBD to use copy into, like you can't use JDBC for that either.
Maybe it is possible with another MonetDB::CLI implementation? MonetDB::CLI::MapiLib was used in 11.3.7 by default, why it is impossible with it? Can I use Mapi.pm directly for this task?

On 27-09-2011 12:24:37 +0400, Eugene Prokopiev wrote:
2011/9/27 Fabian Groffen
: Thanks, there are no errors on executing my script but no results to. I can add rows with insert and can't add them with copy. Maybe I need to send data for copy statement in different way instead of write it after copy statement?
I need to check that, but wouldn't be surprised when you can't use DBD to use copy into, like you can't use JDBC for that either.
Maybe it is possible with another MonetDB::CLI implementation? MonetDB::CLI::MapiLib was used in 11.3.7 by default, why it is impossible with it?
We removed the swig-based wrapper around the C library in favour of a native Perl version.
Can I use Mapi.pm directly for this task?
How exactly were you doing this on the older releases?

2011/9/27 Fabian Groffen
Maybe it is possible with another MonetDB::CLI implementation? MonetDB::CLI::MapiLib was used in 11.3.7 by default, why it is impossible with it?
We removed the swig-based wrapper around the C library in favour of a native Perl version.
Maybe it can be more suitable in some cases?
Can I use Mapi.pm directly for this task?
How exactly were you doing this on the older releases?
I have never yet did not do it with Perl

2011/9/27 Fabian Groffen
I need to check that, but wouldn't be surprised when you can't use DBD to use copy into, like you can't use JDBC for that either.
It would be useful to add the ability to copy data in a similar way as is done in DBD::Pg - http://search.cpan.org/~turnstep/DBD-Pg-2.13.1/Pg.pm#COPY_support
participants (2)
-
Eugene Prokopiev
-
Fabian Groffen