Hello!

We just found an issue regarding MaxDB and LONG BYTE fields. While
trying to put some binary data into one of our tables, we ran into the
problem that MaxDB seems to add a trailing \x00 to every entry.

I included a script at the bottom ( for table creation look after
__END__ ) that demonstrates this behaviour. When I run it, I get

  Inserted: 8bytes, 31 32 33 34 61 62 63 64
  Selected: 9bytes, 31 32 33 34 61 62 63 64 00

The first line represents the inserted data, the second one the data
that got selected out of the data. The numbers at the end are the hex
representation of the given data. You see that there's a trailing \x00
too much. Anyone got an idea about this?

Our Versions:
DBD::MaxDB - 7.5.00.32
DBI        - 1.48
MaxDB      - Kernel 7.5.0 Build 030-121-100-791


Thanks & Greetings,
Robert



--- The Demonstration ---
#!/usr/bin/perl

use strict;
use DBI;
use DBD::MaxDB;

my $data = '1234abcd';

my $c = DBI->connect( 'dbi:MaxDB:PROD', 'GSM', 'SMS' );
$c->{LongReadLen} = 50_000_000;

$c->do( 'DELETE FROM T1' );
$c->do( 'INSERT INTO T1 ( ID, DTA ) VALUES ( 1, ? )', undef, $data );

my $s = $c->prepare( 'SELECT DTA FROM T1' );
$s->execute;
my $row = $s->fetchrow_hashref();

print 'Inserted: ', length( $data ), 'bytes, ', hexify( $data ), "\n";
print 'Selected: ', length( $row->{DTA} ),'bytes, ', hexify( $row-
>{DTA} ), "\n";

sub hexify {
        return join( ' ',
                map { sprintf '%02x', ord( $_ ) } split //, shift
        );
}

__END__

CREATE TABLE T1 (
        ID INT NOT NULL,
        DTA LONG BYTE
)



-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to