Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

How can I retrieve a mysql text blob in Catalyst?

by miguelele (Beadle)
on Oct 26, 2011 at 18:29 UTC ( #933965=perlquestion: print w/ replies, xml ) Need Help??
miguelele has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have one XML list stored as a Blob in MySql and I need to retrieve it as the original text. My actual DBI Model/Schema gets all text columns fine, but not the blob.

Maybe I can add some native mysql commands to the query to do the conversion, but I do not know where in the model o result set I can do such thing.

In case you wonder why I have this situation: my first real Catalyst project is porting a working Flex site. Not too complicated. But in Flex I access database through a simple custom .php interface, and I get the Blob column as text without any special treatment.

I can't change the blob to text because customers are using it. Maybe in a second version.

Regards from the apprentice village, dear monks</>

Comment on How can I retrieve a mysql text blob in Catalyst?
Re: How can I retrieve a mysql text blob in Catalyst?
by Your Mother (Chancellor) on Oct 26, 2011 at 18:47 UTC

    Catalyst proper has nothing to do with the database. This sounds like a DBIx::Class problem from some of your vocabulary.

    There is nothing particularly special about text stored in blobs in MySQL, I think the only practical difference is there is no associated character set; there shouldn't be any problem getting it. It sounds like your schema -- Result(Source) class for the table -- is improperly defined or you're doing something like ->search({},{columns => [qw/ everything but the blob /]}). Without seeing code, those are just guesses: either the My::Schema::Result::TableName is incomplete or the call is excluding the column somewhere along the way. If you show some code, it would be easier to help.

    Sidenote: You could inflate the blob content to an XML object of some sort to make it easier to handle and get to the data/text. That's incredibly handy but a little expensive depending on your use case.

      I trusted your word more than mine, so I revised everything from scratch, and I found ALL my lost xml text in the source view of the web page. The first line is <?xml version="1.0" encoding="UTF-8"?> and it messed up things.

      Now I can start the "real thing": how to parse the XML more or less as I did in Flex.

      I think I will come back soon. Thank you!

Reaped: Re: How can I retrieve a mysql text blob in Catalyst?
by NodeReaper (Curate) on Oct 27, 2011 at 10:38 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://933965]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2015-07-05 09:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls