Giter VIP home page Giter VIP logo

Comments (10)

rybakit avatar rybakit commented on August 30, 2024 1

I haven't tested it myself, but it looks like the lua's return statement is missing in your first example. Try this line instead:

$result = $client->evaluate('return box.sql.execute([[SELECT * FROM table1;]])'); // <- note return here

from client.

mnvx avatar mnvx commented on August 30, 2024

And it works with next way...

$client->evaluate('function testfunc()
    return box.sql.execute([[SELECT * FROM table1;]])
end');
$result = $client->call('testfunc');
var_dump($result->getData());

Result is:

array (size=1)
  0 => 
    array (size=1)
      0 => 
        array (size=2)
          0 => int 1
          1 => string 'A' (length=1)

from client.

mnvx avatar mnvx commented on August 30, 2024

Thanks! It works!

from client.

artem-webdev avatar artem-webdev commented on August 30, 2024

Thank you very much for the library!
I would not like to correct such mistakes -

`PHP Fatal error: Uncaught Error: Class 'MessagePack\Packer' not found in /home/work/php/test/vendor/tarantool/client/src/Packer/PurePacker.php:19
Stack trace:
#0 /home/work/php/test/tarantool.php(12): Tarantool\Client\Packer\PurePacker->__construct()
#1 {main}
thrown in /home/work/php/test/vendor/tarantool/client/src/Packer/PurePacker.php on line 19

Fatal error: Uncaught Error: Class 'MessagePack\Packer' not found in /home/work/php/test/vendor/tarantool/client/src/Packer/PurePacker.php:19
Stack trace:
#0 /home/work/php/test/tarantool.php(12): Tarantool\Client\Packer\PurePacker->__construct()
#1 {main}
thrown in /home/work/php/test/vendor/tarantool/client/src/Packer/PurePacker.php on line 19`

from client.

rybakit avatar rybakit commented on August 30, 2024

Hi Artem,

Looks like the rybakit/msgpack package is missing in your setup, check a note under the "Usage" section for details: https://github.com/tarantool-php/client#usage.

TLDR, try to run composer require rybakit/msgpack to solve the issue.

from client.

artem-webdev avatar artem-webdev commented on August 30, 2024

Yes, thank you very much, I did it.
I would like this dependency to be enabled by default!

from client.

rybakit avatar rybakit commented on August 30, 2024

I would like this dependency to be enabled by default!

Well, rybakit/msgpack is not necessary if you use the msgpack-php pecl extension. That is why it's not enabled by default.

from client.

artem-webdev avatar artem-webdev commented on August 30, 2024

how to get an associative array?

from client.

artem-webdev avatar artem-webdev commented on August 30, 2024

var_dump($result->getData()); returns values without columns

from client.

rybakit avatar rybakit commented on August 30, 2024

@artem-webdev Please ask that kind of questions on stackoverflow.com or at least create a dedicated issue, it will make easier to other concerned developers to find answers to these questions in the future.

from client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.