Can the recently released GAE PHP runtime access the native GAE datastore?

后端 未结 4 1574
误落风尘
误落风尘 2021-01-06 15:30

Google just announced support for a PHP runtime for App Engine. I have an app developed using the Java runtime which utilizes the native App Engine datastore. It currently f

4条回答
  •  太阳男子
    2021-01-06 15:56

    reference: https://developers.google.com/datastore/docs/concepts/gql#using_literals_sample_code

    setAssertionCredentials($credentials);
    
    $postBody=json_encode(array('gqlQuery'=>array('allowLiteral'=>true, 'queryString'=>
              "SELECT * FROM Guestbook WHERE __key__=key(Guestbook, 'default_guestbook')"
              )));
    $httpRequest=new Google_HttpRequest('datastore/v1beta2/datasets/'.APP_NAME.'/runQuery', 'POST', null, $postBody);
    $head=array('content-type'=>'application/json; charset=UTF-8',
                'content-length'=>Google_Utils::getStrLen($postBody)
               );
    $httpRequest->setRequestHeaders($head);
    $httpRequest=Google_Client::$auth->sign($httpRequest);
    $result=Google_REST::execute($httpRequest);
    var_export($result);
    ?>
    

    insertion code: How to insert a record using the Admin console Datastore Viewer using GQL

提交回复
热议问题