comparison MonetDB-CLI-MapiPP/MonetDB/CLI/MapiPP.pm @ 1:f899cb48b4cc

Turned into independent repository. Updated version numbers to 1.00; added Fedora spec file; added top-level Makefile.
author Sjoerd Mullender <sjoerd@acm.org>
date Mon, 19 Sep 2016 15:20:16 +0200 (2016-09-19)
parents cedccb7e0143
children a0ec9e080a5b
comparison
equal deleted inserted replaced
0:cedccb7e0143 1:f899cb48b4cc
1 package MonetDB::CLI::MapiPP; 1 package MonetDB::CLI::MapiPP;
2 2
3 use Text::ParseWords(); 3 use Text::ParseWords();
4 use Encode (); 4 use Encode ();
5 use Mapi; 5 use MonetDB::CLI::Mapi;
6 use strict; 6 use strict;
7 use warnings; 7 use warnings;
8 8
9 our $VERSION = '0.04'; 9 our $VERSION = '1.00';
10 10
11 11
12 my %unescape = ( n => "\n", t => "\t", r => "\r", f => "\f"); 12 my %unescape = ( n => "\n", t => "\t", r => "\r", f => "\f");
13 13
14 sub unquote 14 sub unquote
24 24
25 sub connect 25 sub connect
26 { 26 {
27 my ($class, $host, $port, $user, $pass, $lang, $db) = @_; 27 my ($class, $host, $port, $user, $pass, $lang, $db) = @_;
28 28
29 my $h = new Mapi($host, $port, $user, $pass, $lang, $db, 0) 29 my $h = new MonetDB::CLI::Mapi($host, $port, $user, $pass, $lang, $db, 0)
30 or die "Making connection failed: $@"; 30 or die "Making connection failed: $@";
31 31
32 bless { h => $h },'MonetDB::CLI::MapiPP::Cxn'; 32 bless { h => $h },'MonetDB::CLI::MapiPP::Cxn';
33 } 33 }
34 34
179 sub fetch 179 sub fetch
180 { 180 {
181 my ($self) = @_; 181 my ($self) = @_;
182 182
183 return if ++$self->{i} >= $self->{affrows}; 183 return if ++$self->{i} >= $self->{affrows};
184 184
185 if ($self->{id}) { 185 if ($self->{id}) {
186 utf8::decode($self->{h}->{row}); 186 utf8::decode($self->{h}->{row});
187 my @cols = split(/,\t */, $self->{h}->{row}); 187 my @cols = split(/,\t */, $self->{h}->{row});
188 my $i = -1; 188 my $i = -1;
189 $cols[0] =~ s/^\[ //; 189 $cols[0] =~ s/^\[ //;
194 $self->{currow} = [@cols]; 194 $self->{currow} = [@cols];
195 $self->{h}->getReply(); 195 $self->{h}->getReply();
196 } else { 196 } else {
197 $self->{currow} = $self->{rows}[$self->{i}]; 197 $self->{currow} = $self->{rows}[$self->{i}];
198 } 198 }
199 199
200 return @{$self->{currow}}; 200 return @{$self->{currow}};
201 } 201 }
202 202
203 sub field 203 sub field
204 { 204 {