Open
Description
I'm having difficulty trying to make test_CheckCaseInConverterName and test_CheckColName both succeed simultaneously (though they both succeed with python's own sqlite3 module).
=================================== FAILURES ===================================
_________________ ColNamesTests.test_CheckCaseInConverterName __________________
self = <test_types.ColNamesTests testMethod=test_CheckCaseInConverterName>
def test_CheckCaseInConverterName(self):
> self.cur.execute("select 'other' as \"x [b1b1]\"")
src/test/test_types.py:298:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/pyrqlite/cursors.py:178: in execute
else converter(value))))
src/pyrqlite/extensions.py:180: in _decode_base64_converter
return converter(value.decode('base64'))
/usr/lib64/python2.7/encodings/base64_codec.py:42: in base64_decode
output = base64.decodestring(input)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
s = 'other'
def decodestring(s):
"""Decode a string."""
> return binascii.a2b_base64(s)
E Error: Incorrect padding
As you can see, it fails because it's trying to decode 'other' as base64. The sql which does not need base64 decoding is as follows:
create table test(x foo);
select 'other' as "x [b1b1]";
Meanwhile, test_CheckColName would fail without the base64 decoding support. The sql that triggers the need for base64 decoding is as follows:
create table test(x foo);
insert into test(x) values ('xxx');
select x as "x [bar]" from test;
Feeding the sql statements into the rqlite v3.14.0 command confirms, where 'eHh4' is the base64 encoding of 'xxx':
127.0.0.1:4001> create table test(x foo);
1 row affected (0.000543 sec)
127.0.0.1:4001> select 'other' as "x [b1b1]";
+----------+
| x [b1b1] |
+----------+
| other |
+----------+
127.0.0.1:4001> insert into test(x) values ('xxx');
1 row affected (0.000206 sec)
127.0.0.1:4001> select x as "x [bar]" from test;
+---------+
| x [bar] |
+---------+
| eHh4 |
+---------+
127.0.0.1:4001>
I see that rqlite/rqlite#265 reports the issue for rqlited, and the relevant code is visible in rqlite/rqlite#244.
Metadata
Metadata
Assignees
Labels
No labels
Activity