문제

i use Quercus to run php on google app engine and and i use below code to insert value to the GAE datastore (BigTable).

<?php
import com.google.appengine.api.datastore;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.DatastoreServiceFactory;

$entity = new Entity("test"); 
$entity->setProperty('story',' --- more than 500 char ---');
$dataService = DatastoreServiceFactory::getDatastoreService();
$dataService->put($entity);
?>

but return flowing error because story value is more than 500 char.

error:
com.caucho.quercus.QuercusException: com.google.appengine.api.datastore.Entity.setProperty: story: String properties must be 500 characters or less. Instead, use com.google.appengine.api.datastore.Text, which can store strings of any length.

i don't know any thing about java. Does anyone have any idea how to use com.google.appengine.api.datastore.Text in my php code.

thanks

도움이 되었습니까?

해결책

Will this work?

<?php
import com.google.appengine.api.datastore;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Text;


$entity = new Entity("test"); 
$TextValue = new Text(' --- more than 500 char ---');
$entity->setProperty('story',$TextValue);
$dataService = DatastoreServiceFactory::getDatastoreService();
$dataService->put($entity);
?>

다른 팁

Instead of passing in a string for the second parameter of 'setProperty', create a new com.google.appengine.api.datastore.Text and pass that in.

It looks like you should know how to do that.

See the definition of 'setProperty' here: http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/Entity.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top