ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to concat BLOB values in PHP ?

Post new topic  Reply to topic
 How to concat BLOB values in PHP ? « View previous topic :: View next topic » 
Author Message
Herbert
PostPosted: Thu Mar 14, 2013 8:33 am    Post subject: How to concat BLOB values in PHP ? Reply with quote

Centurion

Joined: 05 Dec 2006
Posts: 146
Location: Leersum, The Netherlands

Is the PHP concat operator (the dot) not possible with BLOB values in a PHP compute node ?

TEST1 & TEST2 both works.

TEST3 & TEST4 give the runtime exception 2328 - "A value of SQL datatype ''CHARACTER'' encountered when datatype ''BLOB'' expected. "

imho thats strange because TEST1 & TEST2 proofs that both left and right of the . are BLOB values.

Code:
class TEST1 {
   /**
     * @MessageBrokerSimpleTransform
     */
    function evaluate($out, $in) {

       $out->BLOB->BLOB = $in->BLOB->BLOB;

    }
}

class TEST2 {
   /**
     * @MessageBrokerSimpleTransform
     */
    function evaluate($out, $in) {

        $blob = new MbsBlob();

        $blob->setValue("\nNew line");
      
        $out->BLOB->BLOB = $blob;
      
    }
}

class TEST3 {
   /**
     * @MessageBrokerSimpleTransform
     */
    function evaluate($out, $in) {

         $blob = new MbsBlob();

         $blob->setValue("\nNew line");
      
         $out->BLOB->BLOB = $in->BLOB->BLOB . $blob;
      
    }
}

class TEST4 {
   /**
     * @MessageBrokerSimpleTransform
     */
    function evaluate($out, $in) {

         $blob = new MbsBlob();

         $blob->setValue("\nNew line");
      
         $out->BLOB->BLOB = $in->BLOB->BLOB;

         $out->BLOB->BLOB .= $blob;
      
    }
}
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Thu Mar 14, 2013 8:40 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I'd say that MbsBlob . MbsBlob produces a String, not another MbsBlob.

Code:
$out->BLOB->BLOB = new MbsBlob($in->BLOB->BLOB . $blob);
Back to top
View user's profile Send private message
Herbert
PostPosted: Thu Mar 14, 2013 9:28 am    Post subject: Reply with quote

Centurion

Joined: 05 Dec 2006
Posts: 146
Location: Leersum, The Netherlands

Thanks, the . is a string operator so it returns a String and not a BLOB, that makes sence.

The input of new MbsBlob() must be a String, below is working now.

Code:
class TEST5 {

    /**
     * @MessageBrokerSimpleTransform
     */
     
    function evaluate($out, $in) {
 
        $blob = new MbsBlob();
        $blob->setValue("\nNew line");

        $out->BLOB->BLOB = new MbsBlob( $in->BLOB->BLOB->getValue()->getValue() . $blob->getValue() );   

    }
   
}


The $blob->getValue() is clear I think

The $in->BLOB->BLOB->getValue()->getValue() is somewhat funny, the first getValue returns an object of type MbsBlob the second returns the string value from that object.

I don't think it's good code ...

$out->BLOB->BLOB is a MbsElement which has the setValue() Method, maybe thats a better way.
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Thu Mar 14, 2013 9:35 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I make no claims to providing any information on the right way to do things in PHP...

working things, maybe.
Back to top
View user's profile Send private message
Herbert
PostPosted: Thu Mar 14, 2013 11:50 pm    Post subject: Reply with quote

Centurion

Joined: 05 Dec 2006
Posts: 146
Location: Leersum, The Netherlands

mqjeff wrote:
I make no claims to providing any information on the right way to do things in PHP...

working things, maybe.


I understand, it was a general thought, and indeed, it's good to have working things

It was a simple request, adding a MD5 string to a existing message, below is working now.

Code:
<?php

class MD5 {

    /**
     * @MessageBrokerSimpleTransform
     */
     
    function evaluate($out, $in) {
       
        $message = $in->BLOB->BLOB->getValue()->getValue();
      
        $md5 = "\n" . "MD5: " . md5($message);

        $out->BLOB->BLOB = new MbsBlob ( $message . $md5 );   

    }
   
}

?>


First time I did use PHP with WMB, I know it exists for many years, it was fun to see if I could implement this request with PHP inside WMB.

Not sure if I will bring it to production, or that I will just do a java compute node.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to concat BLOB values in PHP ?
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.