Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
ee3c0027
Commit
ee3c0027
authored
12 years ago
by
Yuriy Nevinitsin
Browse files
Options
Downloads
Patches
Plain Diff
[connector][perl] fix long tuple handlers
parent
6e57c44b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
connector/perl/lib/MR/Tarantool/Box.pm
+5
-3
5 additions, 3 deletions
connector/perl/lib/MR/Tarantool/Box.pm
connector/perl/t/box.pl
+7
-3
7 additions, 3 deletions
connector/perl/t/box.pl
with
12 additions
and
6 deletions
connector/perl/lib/MR/Tarantool/Box.pm
+
5
−
3
View file @
ee3c0027
...
...
@@ -296,7 +296,8 @@ sub _make_unpack_format {
$ns
->
{
byfield_unpack_format
}
=
[
map
{
m/[\&\$]/
?
'
w/a*
'
:
"
x
$_
"
}
@f
];
$ns
->
{
field_format
}
=
[
map
{
m/[\&\$]/
?
'
a*
'
:
$_
}
@f
];
$ns
->
{
unpack_format
}
=
join
('',
@
{
$ns
->
{
byfield_unpack_format
}});
$ns
->
{
unpack_format
}
.=
'
(
'
.
join
('',
@
{
$ns
->
{
long_byfield_unpack_format
}})
.
'
)*
'
if
$ns
->
{
long_tuple
};
$ns
->
{
long_unpack_format
}
=
$ns
->
{
long_tuple
}
?
join
('',
@
{
$ns
->
{
long_byfield_unpack_format
}})
:
'';
$ns
->
{
full_unpack_format
}
=
$ns
->
{
long_tuple
}
?
$ns
->
{
unpack_format
}
.
'
(
'
.
$ns
->
{
long_unpack_format
}
.
'
)*
'
:
$ns
->
{
unpack_format
};
$ns
->
{
string_keys
}
=
{
map
{
$_
=>
1
}
grep
{
$f
[
$_
]
=~
m/[\&\$]/
}
0
..
$#f
};
$ns
->
{
utf8_fields
}
=
{
map
{
$_
=>
$_
}
grep
{
$f
[
$_
]
eq
'
$
'
}
0
..
$#f
};
}
...
...
@@ -788,6 +789,7 @@ sub _unpack_select {
my
(
@res
);
my
$appe
=
$ns
->
{
append_for_unpack
};
my
$fmt
=
$ns
->
{
unpack_format
};
my
$ffmt
=
$ns
->
{
full_unpack_format
};
for
(
my
$i
=
0
;
$i
<
$result_count
;
++
$i
)
{
confess
__LINE__
.
"
$self
->{name}: [
$debug_prefix
]: Bad response
"
if
length
$_
[
3
]
<
8
;
my
(
$len
,
$cardinality
)
=
unpack
('
LL
',
substr
(
$_
[
3
],
0
,
8
,
''));
...
...
@@ -796,7 +798,7 @@ sub _unpack_select {
my
$packed_tuple
=
substr
(
$_
[
3
],
0
,
$len
,
'');
$self
->
_debug
("
$self
->{name}: [
$debug_prefix
]: ROW[
$i
]: DATA=[
@{
[
unpack
'(
H2
)*',
$
packed_tuple
]
}
];
")
if
$self
->
{
debug
}
>=
6
;
$packed_tuple
.=
$appe
;
my
@tuple
=
eval
{
unpack
(
$fmt
,
$packed_tuple
)
};
my
@tuple
=
eval
{
unpack
(
$cardinality
>
@
{
$ns
->
{
byfield_unpack_format
}}
?
$ffmt
:
$fmt
,
$packed_tuple
)
};
confess
"
$self
->{name}: [
$debug_prefix
]: ROW[
$i
]: can't unpack tuple [
@{
[
unpack
('(
H2
)*',
$
packed_tuple
)]
}
]: $@
"
if
!
@tuple
||
$@
;
$self
->
_debug
("
$self
->{name}: [
$debug_prefix
]: ROW[
$i
]: FIELDS=[
@{
[
map
{
qq
{`$
_
'
}
}
@tuple
]}];
")
if
$self
->
{
debug
}
>=
5
;
push
@res
,
\
@tuple
;
...
...
@@ -910,7 +912,7 @@ sub _PostSelect {
for
my
$row
(
@$r
)
{
my
$h
=
{
zip
@
{
$namespace
->
{
fields
}},
@
{[
splice
(
@$row
,
0
,
0
+
@f
)]}
};
if
(
$last
)
{
$row
=
[
map
+
{
zip
@f_long
,
@
{[
splice
(
@$row
,
0
,
0
+
@f_long
)]}
},
0
..
((
@$row
-
1
)
/
@f_long
)
]
if
@f_long
;
$row
=
@f_long
&&
@$row
?
[
map
+
{
zip
@f_long
,
@
{[
splice
(
@$row
,
0
,
0
+
@f_long
)]}
},
0
..
((
@$row
-
1
)
/
@f_long
)
]
:
[]
;
$h
->
{
$last
}
=
$row
;
}
$row
=
$h
;
...
...
This diff is collapsed.
Click to expand it.
connector/perl/t/box.pl
+
7
−
3
View file @
ee3c0027
...
...
@@ -13,7 +13,7 @@ use FindBin qw($Bin);
use
lib
"
$Bin
";
use
Carp
qw/confess/
;
use
Test::
More
tests
=>
3
66
;
use
Test::
More
tests
=>
3
71
;
use
Test::
Exception
;
use
List::
MoreUtils
qw/zip/
;
...
...
@@ -37,6 +37,7 @@ our $server = (shift || $ENV{BOX}) or die;
our
%opts
=
(
debug
=>
$ENV
{
DEBUG
}
||
0
,
ipdebug
=>
$ENV
{
IPDEBUG
}
||
0
,
retry_delay
=>
0.1
,
raise
=>
1
,
);
...
...
@@ -936,6 +937,7 @@ do {
[
3
,
"
asdasdasd3
",
"
qqq
\xD0\x8E
qqq3
",
"
ww
\xD0\x8E
ww3
",
"
la
\xD0\x8E
lalala31
",
"
la
\xD0\x8E
lala31
",
"
lala31
",
"
lalalala32
",
"
lalala32
",
"
lala32
"],
[
4
,
"
asdasdasd4
",
"
qqq
\xD0\x8E
qqq4
",
"
ww
\xD0\x8E
ww4
",
"
la
\xD0\x8E
lalala41
",
"
la
\xD0\x8E
lala41
",
"
lala41
",
"
lalalala42
",
"
lalala42
",
"
lala42
",
"
lalalala43
",
"
lalala43
",
"
lala43
"],
[
5
,
"
asdasdasd5
",
"
qqq
\xD0\x8E
qqq5
",
"
ww
\xD0\x8E
ww5
",
"
la
\xD0\x8E
lalala51
",
"
la
\xD0\x8E
lala51
",
"
lala51
"],
[
6
,
"
asdasdasd6
",
"
qqq
\xD0\x8E
qqq6
",
"
ww
\xD0\x8E
ww6
"],
];
my
$check
=
[]
;
...
...
@@ -966,8 +968,10 @@ do {
is_deeply
[
$res
=
$box
->
Select
([
map
{
$_
->
[
0
]}
@$tuples
],{
want
=>
'
arrayref
'})],
[
$check
],
'
select all
';
# print $res->[0]->{f3}, "\n";
# print $check->[0]->{f3}, "\n";
ok
$res
->
[
$_
]
->
{
f3
}
eq
$check
->
[
$_
]
->
{
f3
},
"
utf8chk
"
for
0
..
$#$tuples
;
ok
$res
->
[
$_
]
->
{
LL
}
->
[
0
]
->
{
l2
}
eq
$check
->
[
$_
]
->
{
LL
}
->
[
0
]
->
{
l2
},
"
utf8chklong
"
for
0
..
$#$tuples
;
ok
$res
->
[
$_
]
->
{
f3
}
eq
$check
->
[
$_
]
->
{
f3
},
"
utf8chk
"
for
0
..
$#$tuples
;
@
{
$check
->
[
$_
]
->
{
LL
}}
and
ok
$res
->
[
$_
]
->
{
LL
}
->
[
0
]
->
{
l2
}
eq
$check
->
[
$_
]
->
{
LL
}
->
[
0
]
->
{
l2
},
"
utf8chklong
"
for
0
..
$#$tuples
;
is_deeply
[
$box
->
UpdateMulti
(
$tuples
->
[
2
]
->
[
0
],[
$flds
->
[
3
]
=>
set
=>
$tuples
->
[
2
]
->
[
3
]
],{
want_updated_tuple
=>
1
})],
[
$check
->
[
2
]],
'
update1
';
ok
$box
->
UpdateMulti
(
$tuples
->
[
2
]
->
[
0
],[
$flds
->
[
3
]
=>
set
=>
$tuples
->
[
2
]
->
[
3
]
]),
'
update2
';
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment