BLOB SUB_TYPE 0 field to readable string?

View: New views
5 Messages — Rating Filter:   Alert me  

BLOB SUB_TYPE 0 field to readable string?

by benton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

I need to read from a table with a field defined as:

BLOB SUB_TYPE 0 SEGMENT SIZE 80

When I load a DataTable with a FbDataReader, on this column I get what it looks like gibberish to me. FWIW, inspecting the same result set with IBExpert gives me a readable text on that column. So I guess some kind of conversion is in order. I don't know if that conversion should be done on the server itself  (some kind of casting on the SELECT query) or with the help of the provider on the client side.

I'm using the latest release of the Firebird.NET provider. Server version is 1.5.6 and it's a dialect 1 database.

Can someone please shed some light on the subject?

Best Regards,

-Jorge








2009/11/2 Jiri Cincura <diskuze@...>
Hi *,

I added %subj%, which is new in FB 2.5. Although the code fix is
pretty easy, there may be couple of code flows I didn't think of.
Hence it would be helpful if you grab sources, do build and test it
with different scenarios. Also I'll later this week (in a day or two)
put new build into weekly builds.

--
Jiri {x2} Cincura (CTO x2develop.com)
http://blog.cincura.net/ | http://www.ID3renamer.com

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@...
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@...
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Re: BLOB SUB_TYPE 0 field to readable string?

by Jiri Cincura :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 3, 2009 at 22:58, Jorge Alvarez <conversar@...> wrote:
> on the client side

The sub type 0 is binary. If you stored there some text, you have to
do the interpretation of it in application.

PS: Don't steal threads!

--
Jiri {x2} Cincura (CTO x2develop.com)
http://blog.cincura.net/ | http://www.ID3renamer.com

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@...
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Re: BLOB SUB_TYPE 0 field to readable string?

by benton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


2009/11/3 Jiri Cincura <diskuze@...>
On Tue, Nov 3, 2009 at 22:58, Jorge Alvarez <conversar@...> wrote:
> on the client side

The sub type 0 is binary. If you stored there some text, you have to
do the interpretation of it in application.

PS: Don't steal threads!

Sorry about that. :(  Promise not do it again. 

Back on topic, database/table is not mine, I wouldn't be doing such a strange thing as saving text on a binary field.

Do you have a hint on what should I look for to accomplish the "translation"?

Regards,

-Jorge

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@...
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Re: BLOB SUB_TYPE 0 field to readable string?

by Jiri Cincura :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 3, 2009 at 23:46, Jorge Alvarez <conversar@...> wrote:
> Do you have a hint on what should I look for to accomplish the
> "translation"?

http://msdn.microsoft.com/en-us/library/system.text.encoding.getstring.aspx

--
Jiri {x2} Cincura (CTO x2develop.com)
http://blog.cincura.net/ | http://www.ID3renamer.com

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@...
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Re: BLOB SUB_TYPE 0 field to readable string?

by benton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Jiri, I really appreciate your generous help. Upon further investigation I found out this is easier to solve on the server side. Below is the answer, I had to use a cached Google page as the original website was dead. Hope this helps someone in my particular situation.

Regards,

-Jorge

How to convert BLOB to string?
Direct conversion is not possible without using some UDF, but you can extract text using SUBSTRING function:

DECLARE VARIABLE c1 VARCHAR(32000);
SELECT SUBSTRING(blob1 FROM 1 FOR 32000) FROM t1 INTO c1;

Please note that maximum length for VARCHAR is 32767 bytes (which might be less characters in multi-byte character sets like UTF8).

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@...
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider