GithubHelp home page GithubHelp logo

Better type for getColumn about sqlitecpp HOT 7 OPEN

srombauts avatar srombauts commented on August 22, 2024
Better type for getColumn

from sqlitecpp.

Comments (7)

SRombauts avatar SRombauts commented on August 22, 2024

Hi,
Why not, but presently I am using it as in the example, with only implicit type cast operator, like that:
std::string value = query.getColumn(1);
Cheers!

from sqlitecpp.

 avatar commented on August 22, 2024

Hi SRombauts,
code in style std::string value = query.getColumn(1); did works,
and int id = 0; id = query.getColumn(1); works too,
while code below doesn't:
std::string value = ""; value = query.getColumn(1);
Compiler(clang)'s issue is Use of overloaded operator '=' is ambiguous (with operand types 'std::string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') and 'SQLite::Column')
I am trying to solve it, and I found something help in link: http://www.cplusplus.com/forum/general/28152/

from sqlitecpp.

 avatar commented on August 22, 2024

And you add method inline operator const std::string() const to fix an error required by GCC. I have no idea how to solve it now.

from sqlitecpp.

worktycho avatar worktycho commented on August 22, 2024

Also with gcc and libstdc++ the following code fails as ambigous:
int64_t id = query.getColumn(1);
Because libstdc++ uses longs for fixed width types, whereas sqlite uses long longs.

from sqlitecpp.

SRombauts avatar SRombauts commented on August 22, 2024

Thanks for reporting, I'll look into this.

During this time, you could use the explicit forms like this:

std::string value;
value = query.getColumn(1).getText()

and

int64_t id = query.getColumn(0).getInt64();

Let me now if this suits you.
Or perhaps could you propose a new API?

from sqlitecpp.

SRombauts avatar SRombauts commented on August 22, 2024

I have reproduced your issues and will try to work on this in the following days, but I have not much spare times for this.

from sqlitecpp.

SRombauts avatar SRombauts commented on August 22, 2024

PB with 64bits long fixed for upcoming release 1.0.0

from sqlitecpp.

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.