Mercurial > hg > monetdb-perl
comparison mclient.pl @ 0:cedccb7e0143
Copy of clients/perl directory without Tests from MonetDB changeset 4d2d4532228a.
author | Sjoerd Mullender <sjoerd@acm.org> |
---|---|
date | Mon, 19 Sep 2016 15:15:52 +0200 (2016-09-19) |
parents | |
children | f899cb48b4cc |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:cedccb7e0143 |
---|---|
1 #!/usr/bin/env perl | |
2 | |
3 # This Source Code Form is subject to the terms of the Mozilla Public | |
4 # License, v. 2.0. If a copy of the MPL was not distributed with this | |
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
6 # | |
7 # Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V. | |
8 | |
9 use Mapi; | |
10 | |
11 my $db = shift || ''; | |
12 my $port = shift || 50000; | |
13 | |
14 my ($monet, $line); | |
15 $monet = new Mapi('localhost', $port, 'monetdb', 'monetdb', 'sql', $db, 0); | |
16 | |
17 print "> "; | |
18 while ( !(($line=<>) =~ /\q/) ){ | |
19 my $res = 0; | |
20 $monet->doRequest($line); | |
21 while( ($res = $monet->getReply()) > 0 ) { | |
22 print $monet->{row} . "\n"; | |
23 } | |
24 if ($res < 0) { | |
25 if ($res == -1) { | |
26 print $monet->{errstr}; | |
27 } elsif ($res == -2) { | |
28 print "$monet->{count} rows affected\n"; | |
29 } | |
30 } | |
31 print "> "; | |
32 } | |
33 | |
34 $monet->disconnect(); | |
35 | |
36 1; | |
37 |