Skip to content

Commit 985626c

Browse files
committed
fixed char padding - spaces instead of nulls
1 parent 11d9abb commit 985626c

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

dwhwrapper/dwh

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# dwhput : upload from csv without third-party conversion tools
2626
# dwhtable : scan csv file to determine appropriate CREATE TABLE statement
2727
#
28-
version = "dwh wrapper script - v1.0a"
28+
version = "dwh wrapper script - v1.01a"
2929

3030
import sys
3131
import os

dwhwrapper/tdcli.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -496,11 +496,11 @@ def pack(self,rph,r):
496496
if len(r) > self.fd['Len']:
497497
raise ValueError("Column '{0}' contains a string longer than {1} characters".format(d['Name'],d['Len']))
498498

499-
rph.add_data(self,r)
499+
rph.add_data(self,r.ljust(self.fd['Len']))
500500

501501
def unpack(self,row_data,offset):
502502

503-
row_item = row_data[offset : offset + self.data_length].rstrip('\0')
503+
row_item = row_data[offset : offset + self.data_length]
504504
return row_item,self.data_length
505505

506506
class type_decimal(td_type):

dwhwrapper/tests/test_tdcli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def test_varchar(self):
207207
def gen_char(self):
208208

209209
length = random.randint(0,64000)
210-
string = ISO8859(length-random.randint(0,length))
210+
string = ISO8859(length-random.randint(0,length)).ljust(length)
211211

212212
ddf = self.dummy_ddf('CHAR',length)
213213

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def run(self):
159159

160160
s = setup(
161161
name = "dwhwrapper",
162-
version = "1.0a",
162+
version = "1.01a",
163163
author = "Felix Barbalet",
164164
author_email = "[email protected]",
165165
description = description,

0 commit comments

Comments
 (0)