Re: Binary data in char/varchar column?
Posted in 1994
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Data Types & Schema Design, Migration, Import/Export & Data Conversion
In article <CLxDAo.2GL@cbfsb.cb.att.com> nh@cbnewsg.cb.att.com (nicholas.hounsome) writes: >From article <CLvrMu.KqM@cix.compulink.co.uk>, by phatcher@cix.compulink.co.uk ("Paul Hatcher"): >>> Article: 5985 of comp.databases.informix >>> Newsgroups: comp.databases.informix >>> Path: cix.compulink.co.uk!uknet!EU.net!uunet!shared!jimf >>> From: jimf@shared.com (Jim Franklin) >>> Subject: Binary data in char/varchar column? >>> Message-ID: <1994Feb25.224420.55188@shared.com> >>> Sender: jimf@shared.com (Jim Franklin) >>> Date: Fri, 25 Feb 94 22:44:20 GMT >>> Organization: Shared Financial Systems, Dallas, TX >>> Lines: 16 >>> >>> I have the desire/urging to populate a char or varchar column with >>> binary data. The SQL reference manual indicates that char & varchar >>> data types may contain "tabs and spaces, but no other nonprinting >>> characters". This data is not to accessed with normal SQL or any >>> other Informix tool. Does anyone have knowledge in this area. We >>> will be using ESQL/C & OnLine 5.0. >>> >>> Replies from all directions would be appreciated. >>> >>> Thanks, >>> Jim >>> -- >> >> Why don't you put it in a BYTE blob instead? > >Why not code it up as hex characters? - it takes twice the space but is >very straightforward. > >> >> Paul Hatcher >> Graduate Associates Ltd +44 81 840 3110 - Phone >> phatcher@cix.compulink.co.uk +44 81 567 1894 - Fax We have a situation here where we need to do this and can't use blobs. What we do is have a char field that is one byte larger than the structure we need to put into it. Programmatically we insert a space as the first character of the input buffer followed by the binary data. When reading we strip the space before returning the buffer to the caller. This prevent a null being the first character of a CHAR field (which Informix will choke complain about and not preserve any data in that field). One problem with this is that things like UNLOAD and DBEXPORT won't work correctly. They won't preserve the binary data. E-mail me if you have more questions. ------ Kevin Hanson CompuTrac kevin@cmptrc.lonestar.org 222 Municipal kevinh@feenix.metronet.com Richardson, TX 75080 (214) 234-4241 -- -- Kevin Hanson - CompuTrac, Inc. - Richardson, TX kevin@cmptrc.lonestar.org (214)234-4241