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

adding sqlite::endr, and ability to give functions to database_binder #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bstarynk
Copy link

We add the ability to force the end of a prepared statement with endr and the ability to give functions to them.

@zauguin
Copy link
Collaborator

zauguin commented Apr 28, 2017

@bstarynk Have you seen the ++ operator?
Your ppsi << "zero" << 0 << endr; can be written today as (ppsi << "zero" << 0)++;

@@ -99,6 +99,11 @@ int main() {

}

auto ppsc = db << "CREATE TABLE tnums(name VARCHAR(30) PRIMARY KEY ASC NOT NULL UNIQUE, num INT NOT NULL);";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statement is never executed. Either don't save the prepared statement to execute it implicitly or call execute/endr/operator++.

void endr() {
execute();
reset();
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have the operator, so I don't think we need a member function. If we keep this function, we may prefer a more descriptive name.

f(db);
return db;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use our function_traits instead of std::function here to avoid type-erasure?
What is the use-case for calling this with a lambda?

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

Successfully merging this pull request may close these issues.

2 participants