Giter Site home page Giter Site logo

Comments (22)

matt-42 avatar matt-42 commented on May 22, 2024

from lithium.

adibro500 avatar adibro500 commented on May 22, 2024

Not working with sql commands.

con("select name, age from users;").map([] (std::string name, int age) { std::cout << name << ":" << age << std::endl; });

This example not working.

from lithium.

matt-42 avatar matt-42 commented on May 22, 2024

from lithium.

adibro500 avatar adibro500 commented on May 22, 2024

using mysql

from lithium.

adibro500 avatar adibro500 commented on May 22, 2024

Also I am getting CORS error

from lithium.

adibro500 avatar adibro500 commented on May 22, 2024

the Access-Control-Allow-Origin working only in get apis

from lithium.

matt-42 avatar matt-42 commented on May 22, 2024

Use the prepared statement api for the map method:

connection.prepare("Select id,time from items_table;").map([...])

I'll add an issue to have the map method on the non prepared mysql queries.

from lithium.

matt-42 avatar matt-42 commented on May 22, 2024

from lithium.

adibro500 avatar adibro500 commented on May 22, 2024

Getting this error:
error: 'struct li::mysql_statement<li::mysql_functions_blocking>' has no member named 'map'

from lithium.

matt-42 avatar matt-42 commented on May 22, 2024

Sorry I forgot to call the prepared statement, use this instead:
connection.prepare("Select id,time from items_table;")().map([...])

from lithium.

adibro500 avatar adibro500 commented on May 22, 2024

getting this error :

/usr/local/include/c++/9.3.0/tuple:1277:29: error: incomplete type 'std::tuple_size<main()::<lambda(li::http_request&, li::http_response&)>::<lambda(std::string&, std::string&, std::string, std::string&, std::string&)> >' used in nested name specifier 1277 | inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value; | ^~~~~~~~~~~~

Can you post the complete expression ? Like what to be passed in map function ?

from lithium.

matt-42 avatar matt-42 commented on May 22, 2024

can you share the code that generated this error ?

from lithium.

adibro500 avatar adibro500 commented on May 22, 2024

This code caused the error:

db.connect().prepare("Select id,post from post_items;")().map([&](std::string id, std::string post) {

});

what i am doing wrong ?

Please look at my most recent edit

from lithium.

matt-42 avatar matt-42 commented on May 22, 2024

Do you still have this compilation error ? I've added a test and it seems to compile and work fine on my computer. (But it fails on travis, still have to find why...):
https://github.com/matt-42/lithium/blob/master/libraries/sql/tests/mysql.cc#L53

from lithium.

adibro500 avatar adibro500 commented on May 22, 2024

which compiler and compiler version you are using ?

from lithium.

adibro500 avatar adibro500 commented on May 22, 2024

I am using gcc version 9.3.0

from lithium.

matt-42 avatar matt-42 commented on May 22, 2024

I also have gcc 9.3.0, can you share a simple c++ pease of code that would allow me to reproduce the error ?

from lithium.

adibro500 avatar adibro500 commented on May 22, 2024
db.connect().prepare("Select id,post from post_items;")().map([&](std::string id, std::string post) {

});

from lithium.

matt-42 avatar matt-42 commented on May 22, 2024

this code is right, the error must come from somewhere else. If you want me to help more please share a c++ file that I can compile myself.

from lithium.

matt-42 avatar matt-42 commented on May 22, 2024

Also note that on master the non prepared query API is finished.
You can now use:

db.connect()("Select id,post from post_items;").map([&](std::string id, std::string post) {

});

from lithium.

matt-42 avatar matt-42 commented on May 22, 2024

Did you succeed ? can we close this issue ?

from lithium.

adibro500 avatar adibro500 commented on May 22, 2024

Yes working

from lithium.

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.