Closed jcheron closed 5 years ago
$schema = $client->getSpaceById(Space::VSPACE_ID);
$result = $schema->select(Criteria::index(IndexIds::SPACE_NAME));
echo "==================================\n";
echo " id | name\n";
echo "==================================\n";
foreach ($result as $item) {
echo "${item[0]} | ${item[2]}\n";
echo "----------------------------------\n";
}
Thank you very much @rybakit It works perfectly!
Is there a way to exclude system tables and have only names?
About my first unsuccessful attempt:
evaluate
method as I did with box.space._space
? I'll leave you to close the issue, it's okay for me.
Hi @rybakit I am working on the integration of Tarantool in [Ubiquity], as a possible alternative DBMS, used by the ORM (see https://github.com/phpMv/ubiquity/issues/64).
It is very likely that I have a few more questions. Which method do you prefer? Whether I open issues on this project as I just did or in some other way?
Hey @jcheron
Is there a way to exclude system tables and have only names?
Yes, to get all non-system spaces you can do
$result = $schema->select(Criteria::key([512])->andGeIterator());
(ids from 1 to 511 are reserved for system spaces, everything above 511 relates to user spaces).
It is not possible to use the evaluate method as I did with box.space._space?
Yes, it's possible to do the same with Lua (but I guess it will be less performant than the first option):
By using evaluate
:
[$result] = $client->evaluate('return box.space._space:select()');
By using call
:
[$result] = $client->call('box.space._space:select');
It is very likely that I have a few more questions. Which method do you prefer? Whether I open issues on this project as I just did or in some other way?
Feel free to open client related issues on this project, but for general Tarantool use and support questions, you're better off using the official Telegram channel (where you can directly chat with Tarantool core developers) or/and ask your questions on StackOverflow.
I try to get space names from a php Client. I saw that the Client class contained a private member
$spaces
, and that it was possible to access a space by its id (getSpaceById
) or by name (getSpaceByName
), but there is no accessor to$spaces
...What is the best way to get a list of Spaces names ?
With Lua mode ?
or with SQL?
or in another way?