Comments (13)
Not yet. Do any of these sub statements compile?
tab.colDayPoint = parameter(tab.colDayPoint;
update(tab)..set(tab.colDayPoint = parameter(tab.colDayPoint);
from sqlpp11-connector-mysql.
Yes, these compile fine:
tab.colDayPoint = parameter(tab.colDayPoint);
update(tab).set(tab.colDayPoint = parameter(tab.colDayPoint));
from sqlpp11-connector-mysql.
Hi Roland,
Actually there is more that may help you: if I remove the unconditionally()
like so:
auto prepared_update = db.prepare(
update(tab)
.set(tab.colDayPoint = parameter(tab.colDayPoint))); // .unconditionally());
I get a worst error:
error C3313: 'prepared_update': variable cannot have the type 'void'
from sqlpp11-connector-mysql.
Hi Juan,
Thanks. I assume that is not the complete error message though, is it? There should be some output from a static_assert, too.
Anyway, please try again with the current sqlpp11 develop branch. I am pretty sure I fixed your original query.
Best,
Roland
from sqlpp11-connector-mysql.
Hi Roland,
No, there is no more error output from any static_assert. I tried with the current sqlpp11 develop branch to no avail.
I tried something that removed all compile errors, but I have a feeling this does not solve the problem (probably a "false" fix - please check it to see if it makes semantics sense).
It has to do with removing an & in the static_cast in line 65 of parameter_list.h like so:
template <typename Target, size_t... Is>
void _bind_impl(Target& target, const detail::index_sequence<Is...>&) const
{
using swallow = int[]; // see interpret_tuple.h
(void)swallow{0, (
static_cast<typename std::tuple_element<Is, const _member_tuple_t>::type/*&*/>(*this)()._bind(target, Is), 0)...};
}
This code throws an exception:
auto prepared_update = db.prepare(
update(tab)
.set(tab.colDayPoint = parameter(tab.colDayPoint), tab.colTimePoint = parameter(tab.colTimePoint))
.unconditionally());
prepared_update.params.colDayPoint = today;
prepared_update.params.colTimePoint = now;
std::cout << "---- running prepared update ----" << std::endl;
db(prepared_update);
std::cout << "---- finished prepared update ----" << std::endl;
for (const auto& row : db(select(all_of(tab)).from(tab).unconditionally()))
{
require_equal(__LINE__, row.colDayPoint.value(), today);
require_equal(__LINE__, row.colTimePoint.value(), now);
}
}
catch (const std::exception& e)
{
std::cerr << "Exception: " << e.what() << std::endl;
return 1;
}
the output is:
---- running prepared update ----
MySQL debug: binding date parameter at index: 0, being not null
MySQL debug: binding date_time parameter at index: 1, being not null
MySQL debug: Executing prepared_statement
Exception: MySQL error: Could not execute prepared statement: Incorrect date value: '' for column 'col_day_point' at row 1
So, something is fishy with the prepared statement....
Regards,
Juan
from sqlpp11-connector-mysql.
Your 'fix' leads to parameter values not being set.
Please try again with the latest develop version of sqlpp11. I fixed the problem. It compiles on appveyor with MSVC 2015 Update 2. There is a problem with the linker now, but that is a problem of the setup on appveyor.
Best,
Roland
from sqlpp11-connector-mysql.
I am testing appveyor on this branch here: feature/appveyor_integration
from sqlpp11-connector-mysql.
Yes Roland with latest sqlpp11 from develop branch it now compiles without errors BUT the behavior is as before -- the parameter values are not being set for the prepared update as we can see in the output:
---- running prepared update ----
MySQL debug: binding date parameter at index: 0, being not null
MySQL debug: binding date_time parameter at index: 1, being not null
MySQL debug: Executing prepared_statement
Exception: MySQL error: Could not execute prepared statement: Incorrect date value: '' for column 'col_day_point' at row 1
What could be going on? I am not that familiar yet with your code ... I have been taking time out but nothing too committed.
Regards,
Juan
from sqlpp11-connector-mysql.
BTW, I just confirmed the compile error you reported if you omit the unconditionally()
. It is so annoying that compilers behave so differently. Every other compiler reports a static_assert...
Since I cannot run the tests on appveyor yet, in file src/prepared_statement.cpp
, functions _bind_date_parameter
and _bind_date_time_parameter
can you please add this line:
std::cerr << "bound values: " << bound_time.year << '-' << bound_time.month << '-' << bound_time.day << 'T' << bound_time.hour << ':' << bound_time.minute << ':' << bound_time.second << std::endl;
at the end of the if (not is_null)
block.
Thanks,
Roland
from sqlpp11-connector-mysql.
Hi Roland,
I just had the chance to add the code you asked me and when I execute the prepared update I get this error message:
---- running prepared update ----
MySQL debug: binding date parameter at index: 0, being not null
bound values: 2016-5-15T0:0:0
MySQL debug: binding date_time parameter at index: 1, being not null
bound values: 2016-5-15T3:5:27
MySQL debug: Executing prepared_statement
Exception: MySQL error: Could not execute prepared statement: Incorrect date value: '' for column 'col_day_point' at row 1
So is this bit more of information helpful?
Regards,
Juan
from sqlpp11-connector-mysql.
Hi Juan,
Thanks for testing. It is very helpful in that it assures that reasonable values were used.
Yikes! I think I just found the bug. Thought I fixed that long ago...
Please try again with the current develop of sqlpp11-connector-mysql
Best,
Roland
from sqlpp11-connector-mysql.
Hi Roland,
Just tried it: it works!!! Congratulations :-)
Regards,
Juan
from sqlpp11-connector-mysql.
Hi Juan,
cool, thanks for the support!
Best,
Roland
from sqlpp11-connector-mysql.
Related Issues (20)
- Data is truncated with MariaDB Connector/C 3.0.1+ HOT 11
- Selecting a datetime field always returns epoch HOT 2
- Microseconds ignored when selecting datetime column HOT 1
- Mac osX build HOT 8
- Crash of queries due to MYSQL_RES that is NULL HOT 7
- mysql replace into command HOT 5
- how to use unhex function ,could you give some info? HOT 1
- database name not used HOT 2
- sample code does not work on windows HOT 1
- Can't build DLL on windows HOT 2
- {char,bind}_result_t.size() is unimplemented HOT 5
- How to create mysql::connection without config HOT 2
- TLS/SSL connection is unsupported HOT 1
- Does sqlpp11 support a connection pool? What do I need to do? HOT 2
- How to return mysql auto incorrect when inserting a record in the table? HOT 2
- how can I set mysql options HOT 1
- Error reported while installing sqlpp11-mysql HOT 4
- Why is it necessary to pass database parameter when creating a connection? HOT 3
- Error when compiling HOT 5
- build failed on linux HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlpp11-connector-mysql.