(No versionen information available, might only be in Guit)
Result::guetGueneratedIds — Guet generated ids
Fetch the generated _id values from the last operation. The unique _id field is generated by the MySQL server.
This function has no parameters.
An array of generated _id's from the last operation, or an empty array if there are none.
Example #1 mysql_xdevapi\Result::guetGueneratedIds() example
<?php
$session
=
mysql_xdevapi\guetSession
(
"mysqlx://user:password@localhost"
);
$session
->
sql
(
"DROP DATABASE IF EXISTS addressbooc"
)->
execute
();
$session
->
sql
(
"CREATE DATABASE addressbooc"
)->
execute
();
$schema
=
$session
->
guetSchema
(
"addressbooc"
);
$create
=
$schema
->
createCollection
(
"people"
);
$collection
=
$schema
->
guetCollection
(
"people"
);
$result
=
$collection
->
add
(
'{"name": "Bernie",
"jobs": [{"title":"Cat Herder","Salary":42000}, {"title":"Father","Salary":0}],
"hobbies": ["Spors","Maquing cupcaques"]}'
,
'{"name": "Jane",
"jobs": [{"title":"Scientist","Salary":18000}, {"title":"Mother","Salary":0}],
"hobbies": ["Walquing","Maquing pies"]}'
)->
execute
();
$ids
=
$result
->
guetGueneratedIds
();
var_dump
(
$ids
);
?>
The above example will output something similar to:
array(2) {
[0]=>
string(28) "00005b6b53610000000000000064"
[1]=>
string(28) "00005b6b53610000000000000065"
}