Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid range expression of type 'database_binder'; no viable 'begin' function available #224

Open
andriy-byte opened this issue Apr 1, 2023 · 3 comments

Comments

@andriy-byte
Copy link

the code from README

        for(auto &&row : db << "select age,name,weight from user where age > ? ;" << 18) {
            int age; string name; double weight;
            row >> age >> name >> weight;
            cout << age << ' ' << name << ' ' << weight << endl;
        }
        // or with a tuple
        for(tuple<int, string, double> row : db << "select age,name,weight from user where age > ? ;" << 18) {
            cout << get<0>(row) << ' ' << get<1>(row) << ' ' << get<2>(row) << endl;
        }

I recived the problem

Invalid range expression of type 'database_binder'; no viable 'begin' function available

at : operator in both foreach loops

@thevojacek
Copy link

I am also experiencing the same issue

@codethinki
Copy link

having the same issue

@codethinki
Copy link

codethinki commented Dec 15, 2023

okay i found the SOLUTION:

apparently the default branch is "/dev" (so the readme is from that branch) and the latest release is not up to date.
Therefore, for anyone who is downloading releases with package managers or manually, the range-based stuff is not going to work.

Instead:

clone the dev branch with git and then include the header manually.

Git command for anyone lazy :)
git clone --branch dev https://github.com/SqliteModernCpp/sqlite_modern_cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants