google app engine - Saving big string in php using quercus -
i'm using quercus appengine. tried saving long php string (> 1000 characters) appengine won't allow me string can hold 500 characters. tried using appengine's text datatype. lets me save, however, when retrieve data php, returns me resource() type instead of string.
let me explain code:
<?php $a = new text("this long string contains more 1000 characters"); $b = "this long string contains more 1000 characters"; $e = new entity('article'); $e->setproperty('content', $a); // works fine // $e->setproperty('content', $b); // complain strlen($b) > 500 $db = datastoreservicefactory::getdatastoreservice(); $id = keyfactory::keytostring($db->put($e)); // works ok, returns id of entity saved ?>
now all's fine , dandy, when retrieve content of $e, return me resource() type data.
<?php $q = new query('article'); $ps = $db->prepare($q); foreach($ps->asiterable() $i) { echo gettype($i->getproperty('content')); // echo object, when var_dump'd, gives me resource() not convertible php string, can't human readable value } ?>
is there workaround this? appreciated i've been pulling hair days...
ok solved converting java object string
$content = $i->getproperty('content'); if(is_object($content)) { if($content instanceof text) { $content = $content->getvalue(); } }
Comments
Post a Comment