Created
July 25, 2016 17:58
-
-
Save tristansokol/3fe98b6d5a8635b148f55ec123e480ed to your computer and use it in GitHub Desktop.
Datastore php cursor example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//my cursor is set as a url variable ($_GET['albumoffset']) | |
$albumStore = new \GDS\Store('Tracks'); | |
$obj_store->query("SELECT * FROM Albums"); | |
$obj_store->setCursor(rawurldecode($_GET['albumoffset'])); | |
$entity = $obj_store->fetchPage(1); | |
//do stuff with my new entity | |
//meta refresh the page with the new cursor. | |
echo '<meta http-equiv="refresh" content="0; url=http://'.$_SERVER['HTTP_HOST'].'/dev/migrate?albumoffset='.rawurlencode($obj_store->getCursor()).'">'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I could come this far only... but don't know where and how to pass the Cursor variable to FetchPage.
$obj_schema = new GDS\Schema('channels');
$obj_gateway_ns = new GDS\Gateway\ProtoBuf(null, 'bkdatastore');
$obj_store_ns = new \GDS\Store($obj_schema, $obj_gateway_ns);
$arr_result = $obj_store_ns->query($str_gql)->fetchPage(5);