Re: Converting SQLServer to Informix
Posted in 1997
Maybe no-one knows enough about LiveWire to be able to give you an answer. >From: Sean@elvis.saecrc.org >Date: Thu, 19 Jun 1997 16:35:45 -0600 >X-Informix-List-Id: <news.39427> > >In article <866585279.1279@dejanews.com>, chris@saecrc.org wrote: >> >> We have a contact manager on SQLServer that we are putting into Informix >> 7.1 on NT with a Netscape LiveWire interface. One of our fields in >> SQLServer is a text field, which supports blob stuff. Our analysts put >> spreadsheets, news articles, etc into this field. >> >> I'm assuming that the conversion to Informix would be a byte field. But >> I'm understanding that Inserts and Updates cannot be done directly. If my >> user loads the LiveWire interface, what is the SQL statement that I would >> send to Informix to add or update that byte field? The documentation just >> tells me what I can't do, not how I should do it! >> >> Thanks for your reply.... >> >> Chris Carter >> chris@saecrc.org >> San Antonio Electronic Commerce Resource Center > >Please someone reply...she is getting desperate and we have to deal with >her! > >:-) This is all guesswork, but it is reasonably well educated guesswork. LiveWire doesn't include ESQL/C as far as I know, but if you were doing it in ESQL/C, you'd use: EXEC SQL BEGIN DECLARE SECTION; loc_t blob; long pk_value; EXEC SQL END DECLARE SECTION; [...initialize blob to point at data...] [...initialize pk_value to identify row to be updated...] EXEC SQL UPDATE SomeTable SET ByteColumn = :blob WHERE PrimaryKey = :pk_value; An INSERT statement would be similar, you'd just have to provide the values for each field in the table. The statements could be prepared with placeholders (shown as unquoted question marks in the statement string) for the blob variables. Basically, there are no blob literals in Informix's brand of SQL, so you have to locate the data in a loc_t structure somehow. There is a program updblob out there in the IIUG archives which allows you to update a blob field from a file. However, all these solutions rely on ESQL/C somewhere. The only other alternative I can immediately think of is converting the blob data into a load record, which means formatting the complete row of data into the delimited format used by Informix, with the blob data being stored as a stream of hexadecimal characters, 2 characters per byte of data, with the first character of the pair being the hex for the high-order 4 bits of the byte, and the second being the hex-digit for the low-order 4 bits of the byte. I can't remember whether the characters have to b upper-case or lower-case or whether it actually doesn't matter. This is yukky, but you can probably use the tools with the OWS that comes with LiveWire (DB-Access or SQL-Editor) to handle the load for you. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>