Blob manipulation
Posted in 1999
Topics: SQL Development & Query Writing
This is a multi-part message in MIME format. ------=_NextPart_000_0072_01BEE263.959C22F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I'm having a few problems with manipulating Blob variables and blob type columns in Informix. I have a table having a column of type Text. My requirement is to join = up all the Text data (i.e. all the text data in that table from the = particular column) in a Text variable to form one large peice of data. Logically speaking, I have to concatenate the Text data from each row with the = Text data in the next row. Now I've found out that we can't use the = concatenation operator '||' we use for strings. I urgently need a way out of this. = Please help. Thanks, George georgem@its.soft.net ------=_NextPart_000_0072_01BEE263.959C22F0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-1" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2014.210" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>I'm having a few problems with = manipulating Blob=20 variables and blob type<BR>columns in Informix.<BR><BR>I have a table = having a=20 column of type Text. My requirement is to join up<BR>all the Text data = (i.e. all=20 the text data in that table from the particular<BR>column) in a Text = variable to=20 form one large peice of data. Logically<BR>speaking, I have to = concatenate the=20 Text data from each row with the Text<BR>data in the next row. Now I've = found=20 out that we can't use the concatenation<BR>operator '||' we use for = strings. I=20 urgently need a way out of this. Please<BR>help.<BR></FONT></DIV> <DIV><FONT face=3DArial size=3D2>Thanks,<BR>George <A=20 href=3D"mailto:georgem@its.soft.net">georgem@its.soft.net</A><BR></DIV></= FONT> <DIV><FONT face=3DArial size=3D2><BR> </DIV></FONT></BODY></HTML> ------=_NextPart_000_0072_01BEE263.959C22F0--
george wrote: > > I'm having a few problems with manipulating Blob variables and blob type > columns in Informix. > > I have a table having a column of type Text. My requirement is to join = > up > all the Text data (i.e. all the text data in that table from the = > particular > column) in a Text variable to form one large peice of data. Logically > speaking, I have to concatenate the Text data from each row with the = > Text > data in the next row. Now I've found out that we can't use the = > concatenation > operator '||' we use for strings. I urgently need a way out of this. = You do not state what front-end software you are using. If this needs to be done in an ESQL/C program look into the LOC_USER FETCH type flag. This allows you to write your own internal fetch functions for the BLOB which can append one row to the previous rows easily. This also happens to be the fastest way to FETCH BLOBs so it is a good technique to learn. There is sample code in the samples directories also look at my myschema.ec program which uses LOC_USER to fetch fragmentation and view definitions. If you are using 4GL you can write an ESQL/C module to fetch those rows using the method above and call the function from 4GL. There is also sample code for writing 4GL callable ESQL/C code. Art S. Kagel
george wrote: > I'm having a few problems with manipulating Blob variables and > blob type columns in Informix. Which version of the database are you using? The answer is quite different if you're using IUS or one of its successors. > I have a table having a column of type Text. My requirement is to > join up all the Text data (i.e. all the text data in that table > from the particular column) in a Text variable to form one large > piece of data. Logically speaking, I have to concatenate the Text > data from each row with the Text data in the next row. (1) Why? (2) There is no such thing as a next row in a relational database. > Now I've found out that we can't use the concatenation operator > '||' we use for strings. That isn't the only problem. You also have to work out how to write a N-way self-join (where N is the number of rows in the table). You'll end up writing some ESQL/C or C code. This might be in a datablade if you have IUS; otherwise, it will be in your application. You won't be writing an N-way self-join; you'll be fetching each row into a (small) blob, and then appending it to the composite result (a large blob). Because you are fetching each row in turn, you can order them as you choose. But I think you have a design problem, still. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h> PS: Please don't post/mail HTML to the news group.