0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 21:04:15 +08:00
Commit Graph

919 Commits

Author SHA1 Message Date
rbock
64c4ba029f Adjusted usage of wrong_t.
I think there was a risk of wrong_t based static_asserts firing, if the
template parameters are used. Anyway, this is shorter.
2014-07-31 09:08:00 +02:00
rbock
88d28d6830 Moved value types out of detail namespace 2014-07-31 08:40:13 +02:00
rbock
c88a1097c2 Added some hints 2014-07-31 08:19:00 +02:00
rbock
ff9a6ff8f0 Added missing result_field.h 2014-07-30 23:10:45 +02:00
rbock
f60f1504b8 Extracted result_field_t from value types.
This is a preparation for adding serializer specializations for them
2014-07-30 22:37:07 +02:00
rbock
7c45e8b83f Removed _name_t from and added alias operators to result field.
A result field really is just a value, if you insist on using it as a
select column, give it a name via an alias.
2014-07-30 22:03:11 +02:00
rbock
828106acbd Moved shared result field code into separate file 2014-07-30 17:56:33 +02:00
rbock
c818e110b6 A few minor fixes and cleanup 2014-07-29 09:14:51 +02:00
rbock
b1f1de8a08 Allowing result fields to be used as arguments for queries 2014-07-29 08:57:55 +02:00
rbock
4be53d9933 Fixed a error in type set intersect calculation and in tracking outer tables 2014-07-28 21:36:53 +02:00
rbock
159b4c7152 Fixed error in determining can_be_null for joins 2014-07-28 21:14:20 +02:00
rbock
42179cbc87 Cleaned up traits a bit more 2014-07-28 07:41:59 +02:00
rbock
dd33b8096e Streamlined type traits a bit 2014-07-28 06:54:54 +02:00
rbock
643aab222e Aligned structure of connector traits with other traits 2014-07-28 06:13:30 +02:00
rbock
6d851f17ff Added testability and tests for can_be_null and null_is_trivial in result entries 2014-07-27 19:40:31 +02:00
rbock
12f723d021 Fixed type error in join 2014-07-26 18:06:37 +02:00
rbock
c3d758c776 Renamed _result_entry_t to _result_field_t 2014-07-25 15:33:26 +02:00
rbock
4bf0db5611 Renamed field to field_spec 2014-07-25 15:20:19 +02:00
rbock
e5f055ac19 Using column's can_be_null and connector's enforce_validity 2014-07-25 01:01:42 +02:00
rbock
e21fdb4829 Transport null_is_trivial_value and can_be_null to result fields 2014-07-24 23:02:08 +02:00
rbock
6f056ced8a Transport can_be_null into subselect used as a result column 2014-07-24 17:36:56 +02:00
rbock
556023f921 Added a few reminders which expressions can be null as well 2014-07-24 09:47:30 +02:00
rbock
37a550a489 Use potential outer table dependencies in pseudo tables
The dependency indicates whether a column of a pseudo table can be null.
2014-07-24 09:29:50 +02:00
rbock
b73133d47a Follow outer tables through the statement.
This is important to determine which result column of a select can be
NULL.
2014-07-24 08:57:35 +02:00
rbock
d1e8a0153e Transport can_be_null into select pseudo table 2014-07-23 22:57:11 +02:00
rbock
9c15b45ac4 Made can_be_null a recursive trait 2014-07-23 18:26:13 +02:00
rbock
80f09dc003 Use _traits in column specs 2014-07-23 18:06:33 +02:00
rbock
88062625bf Make sure that tvin is used in the allowed places only 2014-07-22 08:51:17 +02:00
rbock
0f29e255d1 Unified tvin/trivial_value_is_null usage for =,==,!= and ! 2014-07-21 09:53:17 +02:00
rbock
3506182ccf Fixed tvin-handling in assignment 2014-07-21 07:41:34 +02:00
rbock
d8ae9dc778 Fixed type trait code 2014-07-21 07:40:07 +02:00
rbock
69fdaedc0d Adjusted type_traits to compile with clang-3.1, too
The new version is cleaner anyway, since it can be used with any type
now.
2014-07-21 05:33:45 +02:00
rbock
8ed0042b67 Added blob (currently synonym of text) 2014-07-14 18:17:53 +02:00
rbock
abb97b623b Removed remainder of char_result_row interface from fields 2014-06-29 12:52:21 +02:00
rbock
2f20f7ef82 Renamed bind and (in)validate to indicate their usage (vendor only) 2014-06-29 11:35:51 +02:00
rbock
0f9c1dbfb2 Added check to prevent multicolumns in sub selects 2014-06-28 21:05:37 +02:00
rbock
778b0d8816 Added -Wall, took care of a bunch of compiler warnings 2014-06-28 14:41:35 +02:00
rbock
c2d00b14ec Removed char_result_row from result_row 2014-06-27 18:40:57 +02:00
rbock
620f9bef29 Fixed dynamic rows for bind_results 2014-06-27 18:11:12 +02:00
rbock
ff4d93049c removed char_result_row 2014-06-27 17:41:43 +02:00
rbock
bc99c2b240 Added missing file 2014-06-26 22:06:54 +02:00
rbock
1f20d244c7 Added improved check for potential name duplicates in from() 2014-06-26 18:56:07 +02:00
rbock
2266787e94 Fixed another few warnings 2014-06-26 14:35:49 +02:00
rbock
e03366202d Fixed a bunch of warnings 2014-06-26 08:39:08 +02:00
rbock
1267aa252f Added _check_consistency call to all statement parts
For instance, enforce where() to be called
2014-06-24 21:53:25 +02:00
rbock
0b27373314 Adjusted code to work with g++-4.8 as well 2014-06-22 23:37:43 +02:00
rbock
d90b42f52b Added a minimalistic test for including sqlpp11.h 2014-06-22 16:09:19 +02:00
rbock
35f9dab171 Added missing file 2014-06-22 12:01:17 +02:00
rbock
06d1783d81 Cleaned a bit of messy _run() code. 2014-06-20 18:20:24 +02:00
rbock
1d82cf7f09 Fixed a bunch of bugs that came up when integrating with mySQL again.
Thanks Matthijs!
2014-06-20 16:53:52 +02:00
rbock
56e34dbf5e Shortened template for pseudo_column 2014-06-18 18:20:59 +02:00
rbock
5f927572cf Took care of a few warnings 2014-06-14 20:25:11 +02:00
rbock
4ce8f2419b All tests compile again for clang-3.2 2014-06-14 17:57:12 +02:00
rbock
3d26f9a686 Re-animated prepared statements 2014-06-14 17:44:22 +02:00
rbock
ef6c7e0c0d Removed a few obsolete "typename" 2014-06-14 07:49:43 +02:00
rbock
269f2e7e17 Fixed indentations 2014-06-14 07:45:10 +02:00
rbock
09d220541e removed namespace vendor 2014-06-14 07:43:27 +02:00
rbock
060d59125c Moved files from sqlpp11/vendor to sqlpp11 2014-06-13 18:51:51 +02:00
rbock
4d1b60d93a Cleanup
Moved check_consistency call to statement
2014-06-13 09:33:08 +02:00
rbock
f8e0e90477 Fixed serializability of statements 2014-06-09 14:06:04 +02:00
rbock
79aa358624 Added into member for insert.
Update and remove will get table lists with more than one table
2014-06-05 08:32:22 +02:00
rbock
067740d24e InterpretTest compiles again 2014-06-04 18:35:25 +02:00
rbock
d36037472f Migrated update to generic statement 2014-06-04 09:26:10 +02:00
rbock
c866f31ea5 Turned remove into a generic statement 2014-06-03 09:12:27 +02:00
rbock
8d16b6ab2d Migrated insert to generic statement 2014-06-02 23:57:21 +02:00
rbock
7e32a0a3ea Cleaned up minor as() method mess plus some oversights 2014-06-02 07:48:05 +02:00
rbock
3fb6c6c246 SelectTest compiles again 2014-06-02 06:40:22 +02:00
rbock
b00fe51fed Adjusted remaining select parts 2014-05-30 13:43:59 +02:00
rbock
98bb9a7db7 Added policies into members
What a fight...
2014-05-30 12:48:51 +02:00
rbock
408e96af4a Using _member_t to have variadic named members in statements 2014-05-30 10:40:46 +02:00
rbock
76fc2fb397 Moved select-specific stuff into select_column_list
This is a major step towards a generic statements and generic statement
policies.
2014-05-27 18:15:37 +02:00
rbock
a5457e93f7 Started to move statement-specific methods into the result provider classes
First method is: select_t::as()
2014-05-27 11:20:03 +02:00
rbock
d11f529bd8 Minor cleanup. 2014-05-26 07:42:59 +02:00
rbock
c13d514e95 Adjusted update to be variadic 2014-05-23 21:42:27 +02:00
rbock
2a215905fd Migrated remove to being variadic 2014-05-23 20:36:13 +02:00
rbock
22e1e7c531 Migrated insert to be truly variadic 2014-05-22 22:53:08 +02:00
rbock
c4a02d931c SelectTypeTests compile again! 2014-05-20 21:22:55 +02:00
rbock
c81a7d33ae Cleanup 2014-05-20 08:50:55 +02:00
rbock
6d91cf2163 select is now really a variadic template
It is getting ready for customization to reflect vendor specific
statement parts, e.g. order by in update and delete for mysql.
2014-05-19 23:24:41 +02:00
rbock
15e8ca742c A step towards turning select into a really variadic template 2014-05-19 22:54:47 +02:00
rbock
569f0ff2eb Wrote down remaining steps for next release 2014-05-19 08:01:14 +02:00
rbock
bfd13c6743 Determining column_list in a more generic way.
By finding the last parameter which is a return value.
2014-05-19 07:51:24 +02:00
rbock
e39444b0f7 Added tags missing and return_value
missing indicates that a statement part has yet to be added (e.g.
columns in a select).

return_value indicates that a statement part can be used as a return
value.
2014-05-19 06:42:45 +02:00
rbock
f314c6d070 Added recursive_traits to select 2014-05-16 20:06:20 +02:00
rbock
6972758931 Added extra_tables to recursive_traits 2014-05-16 09:33:48 +02:00
rbock
5f4a88c7ce Function tests compile again 2014-05-16 09:18:08 +02:00
rbock
1d905e1db5 Ok, the first few lines of test code compile again. 2014-05-15 23:47:16 +02:00
rbock
d062c1a0d8 Started to rewrite traits and recursive traits
traits are shorter and easier to identify by using tags in a variadic
template

recursive traits can be automatically derived, which makes it much
easier to add new traits to be handed through the expression tree.
2014-05-15 08:00:03 +02:00
rbock
57239d10ed Rewrote result_row implementation to be non-recursive
Cool. This is so much easier to understand now!
2014-05-07 23:56:12 +02:00
rbock
bcdcf7fa64 Added column_index_sequence
This is not necessarily sequential because there might be multi_columns.
2014-05-07 23:54:37 +02:00
rbock
d831f98c9a Made parameter_list's bind non-recursive 2014-05-07 18:51:18 +02:00
rbock
b9133cf3a1 Used index_sequence to get rid of recursion in interpret_tuple.
Wonderful stuff, shaped after code samples from cppreference and
stackoverflow.
2014-05-06 22:41:19 +02:00
rbock
f57ba13955 Added link to boost mailing list
This where I presented the idea for all_t. According to Louis Dionne,
the fastest implementation around :-)
2014-05-06 22:38:30 +02:00
rbock
2124005bd8 Added index_sequence (until it can be used with C++14) 2014-05-06 22:20:24 +02:00
rbock
4c3e73f819 Minor cleanup 2014-05-01 17:41:51 +02:00
rbock
331353022a Rewrote all_t to use bool arguments instead of predicate and classes 2014-05-01 17:34:47 +02:00
rbock
2452f224d4 Rewrote any_t to take bools instead of predicate and classes 2014-05-01 17:12:41 +02:00
rbock
c033feb60f Replaced all_t/any_t by MUCH more performant versions 2014-05-01 14:08:48 +02:00
rbock
adc3545ca1 Fix in insert's add_set error handling 2014-04-24 14:09:33 +02:00
rbock
eef974478c Fixed a few missing types 2014-04-22 22:39:25 +02:00
rbock
f47ef75c24 Added a few checks to insert, update and remove 2014-04-22 22:21:44 +02:00
rbock
d342973ef4 Added check to prevent add_column to use a column name known in the static part 2014-04-22 21:41:53 +02:00
rbock
8f16ded277 Allow columns() method to use all_of_t as well 2014-04-22 21:30:31 +02:00
rbock
0ffd93108b Added a table consistency checks to several dynamic methods 2014-04-22 20:46:32 +02:00
rbock
1f3e611fdf Added table checks to add_column and added add_column_ntc 2014-04-21 11:49:26 +02:00
rbock
815c061979 Added extra_tables to select.
With this method you can indicate additional tables that might be added
via add_from(). These tables are considered in the add_column, add
where, etc methods.
2014-04-21 10:59:29 +02:00
rbock
f4ec88c83d Improved checks for selects being usable as value or table 2014-04-18 19:59:35 +02:00
rbock
bbae5e89e9 Improved decision whether a select is a value or not 2014-04-12 08:22:46 +02:00
rbock
cffc85879a Calculate the tables required by a sub-select 2014-04-11 21:12:39 +02:00
rbock
207310effe Added parameter lists to group_by and order_by 2014-04-11 18:23:20 +02:00
rbock
68f929e041 Removed a bunch of superfluous functions.
Dispatching made some emplace_back instances obsolete.
2014-04-11 08:58:28 +02:00
rbock
abb80e3a91 Migrated insert to inheritance model 2014-04-10 22:44:38 +02:00
rbock
7e78c0d878 Migrated update to inheritance model 2014-04-10 21:20:37 +02:00
rbock
d2b59c0f59 Some cleanup 2014-04-10 20:20:59 +02:00
rbock
7f94002bec Migrated remove to use inherited methods 2014-04-10 18:59:05 +02:00
rbock
bc5ffc1492 Added several call dispatches to reduce compiler spew in case of errors 2014-04-10 16:09:54 +02:00
rbock
ad5584e52d Cleaned up a bit... 2014-04-09 20:54:28 +02:00
rbock
db0bbd6e3f Moved select_colum_list methods to the respective classes 2014-04-09 08:50:34 +02:00
rbock
18d244dd9f Moved from-methods to from-classes 2014-04-09 07:25:24 +02:00
rbock
5e0c1cff48 Moved flag-methods to select_flag classes 2014-04-08 22:45:19 +02:00
rbock
7af13937bf Moved group_by-methods to group_by classes 2014-04-08 22:26:45 +02:00
rbock
a541d8e187 Moved having-methods to having-classes 2014-04-08 22:18:28 +02:00
rbock
eb9eab369a Moved order_by-methods to order_by classes 2014-04-08 22:02:24 +02:00
rbock
f2fc4f73f6 Move offset methods into offset classes 2014-04-08 21:49:37 +02:00
rbock
4727de831f Moved limit-methods to limit classes 2014-04-08 21:33:38 +02:00
rbock
c595353286 Moved where-methods to where-classes. 2014-04-08 20:59:45 +02:00
rbock
6737bf901d Added a bunch of table tests to select
And some hints regarding additional tests and how to turn them of for
subselects
2014-04-07 22:02:08 +02:00
rbock
dba5c992ed Added _table_set to select_column_list.h 2014-03-28 18:10:58 +01:00
rbock
3f1460cd2e Streamlined basic value types 2014-03-28 18:09:21 +01:00
rbock
bef4d0874b Updates copyright year 2014-03-27 16:43:36 +01:00
rbock
c0595aa6f2 Fixed compile-error for parameter
(need to do the same for other value types, too)
2014-03-27 09:25:35 +01:00
rbock
1a347048df Migrated remove and update to using arg_selector 2014-03-27 08:37:05 +01:00
rbock
1a39d31b3e Using arg_selector for select 2014-03-26 21:11:40 +01:00
rbock
6c4520a632 Using detail::arg_select to reduce number of constructors 2014-03-26 21:03:29 +01:00
rbock
1ffa6e25ba Added an argument selector
It returns the "correct" argument out of two.
2014-03-26 21:02:22 +01:00
rbock
1c95406ced Improved error messages for incorrect parameters. 2014-03-26 21:01:16 +01:00
rbock
a38a9d6f65 Made a bunch of compile errors easier to read
Fixed a few bugs in the process, too.
Probably also created a few, need better checks for resulting
statements.
2014-03-23 20:54:44 +01:00
rbock
555aba3f14 Rewrote type-set operations to look more like free functions 2014-03-19 18:59:39 +01:00
rbock
82dc280b1b Added executed select tests 2014-03-18 08:28:17 +01:00
rbock
1824f9cde0 Changed NULL handling in results.
If the column or the connector indicates that NULL corresponds to a
trivial value, then the trivial value is returned. Otherwise, an
assert fails or an exception is thrown, depending on the preferences of
the connector.
2014-03-13 08:52:22 +01:00
rbock
78d2d9e67a Renamed tvin_wrap to maybe_tvin
Easier to read
2014-03-11 18:46:53 +01:00
rbock
6cffdb6428 Added is_trivial_value_is_null interpretation to assignment 2014-03-07 08:53:32 +01:00
rbock
67f1b09acb Added prepare_select to MockDb. 2014-02-21 09:43:23 +01:00
rbock
8c8b95d14e Added template parameter Db to result_entry 2014-02-21 07:24:07 +01:00
rbock
b7935b61d5 Added some (no-op) statement executions 2014-02-21 06:02:49 +01:00
rbock
3bbe343a77 Added a better MockDb that can execute statements
Currently all executions are no-ops, but it will be rather simple to
yield select results too (to be configured at runtime).
2014-02-20 09:24:06 +01:00
rbock
abf4bb8e9a Added serializer to interpreter
The serializer has partial specializations for all templates. It is a
good basis if the connector/database requires strings close to the
standard.

The interpreter is unspecialized (and uses a static assert to say so).
It is a good basis if the connector/database requires a different
interpretation, e.g. re-writing the expression tree.

The interpretable_t implements three methods for interpretation:
serializing with the sqlpp::serializer_context, serializing with the
database's serialization context and interpretation with the database's
interpretation context.
2014-02-18 17:45:08 +01:00
rbock
26f322b86a Expressed equal_to, not_equal_to, logical_not as binary/unary expressions 2014-02-16 19:32:43 +01:00
rbock
1d5ee2068d Fixed a bunch of bugs found while adjusting the mysql connector 2014-02-16 13:16:09 +01:00
rbock
8b37626b89 Added uniqueness constraint to type_set, plus minor cleanup 2014-02-16 12:43:09 +01:00
rbock
61a4797d0b Simplified syntax for multi_columns a lot
Instead of

multi_column(alias, columns...)

it is now

multi_column(columns...).as(alias)

Also, you can now write:

all_of(table).as(alias)
2014-02-13 10:07:51 +01:00
rbock
9e8979c6f0 Fixed a bunch of small errors and shorted compile error messages 2014-02-13 08:44:09 +01:00
rbock
fb092583cc Made wrong_t<...> a true std::false_type again.
I am sure this would shoot me in the foot some day otherwise
2014-02-11 10:17:02 +01:00
rbock
7c928ae6d0 Added table sets to several more expressions 2014-02-10 19:55:48 +01:00
rbock
54687c5e69 Added a bunch of static asserts to prevent misuse of insert and update
There are quite a few more to be inserted
2014-02-10 17:56:16 +01:00
rbock
e4c7b5235f Added several checks for correct types in insert columns/values 2014-02-10 09:46:31 +01:00
rbock
82bcd63efd Removed the dreaded crtp_wrapper and the policy_wrapper 2014-02-09 23:45:17 +01:00
rbock
22c43358f2 All statements back to composite design
The point is that even though the CRTP code looked nice, it was too hard
to comprehend.
2014-02-09 23:30:30 +01:00
rbock
cc76820870 Migrated insert and remove back to composite design 2014-02-09 18:14:52 +01:00
rbock
ae2f1948ac Added checks to prevent non-matching columns from being inserted 2014-02-09 15:06:42 +01:00
rbock
61ed1d9f37 Corrected inconsistency in select value_type 2014-02-08 23:48:35 +01:00
rbock
88fc0959b5 Added value type back to select 2014-02-08 22:50:26 +01:00
rbock
3c6e7cb89a Fixed a bunch of smaller migration errors 2014-02-08 22:24:05 +01:00
rbock
68750aac80 Refactored insert to use policies
Much cleaner now.
2014-02-08 21:06:23 +01:00
rbock
5b67061fca Fixed multi_column to handle all_of again 2014-02-08 17:12:40 +01:00
rbock
b82a0295cf Fixed all_of use in select 2014-02-08 16:29:21 +01:00
rbock
f7aa56b7dc Fixed possible dangling references problem 2014-02-08 00:43:20 +01:00
rbock
3a875e794b More reasonable dynamic limit and offset 2014-02-08 00:35:59 +01:00
rbock
c5ef725106 Removed the dreaded make_expression_tuple and make_flag_tuple 2014-02-07 23:51:21 +01:00
rbock
0a744455ec basic select methods work again
I've let go of the select(flags, columns) monster methods, these are now
separated
2014-02-07 23:43:26 +01:00
rbock
62b828ef8f Migrated select components to support policy based select 2014-02-07 22:52:02 +01:00
rbock
9c4832df0f Switched remove to policy based design.
A lot of sweating to figure out how to do it, but now it looks MUCH
cleaner and it is probably a lot easier to extend :-)
2014-02-07 21:25:23 +01:00
rbock
417d317a65 Added a bunch of operator interpretations 2014-02-05 10:12:07 +01:00
rbock
7afd34c349 Added a few types/templates to help with expression tree evaluation 2014-02-04 07:32:37 +01:00
rbock
e1f619eecb Replaced a bunch of make_set_if::size asserts with and_t/or_t 2014-02-02 18:45:21 +01:00
rbock
14c382db59 Added and_t and or_t templates 2014-02-02 18:43:07 +01:00
rbock
d288c65897 Minor code cleanup (set -> type_set) 2014-02-02 14:58:08 +01:00
rbock
28fc5900f2 Added missing overload for prepared statement parameters 2014-02-01 14:28:23 +01:00
rbock
9c75c7b873 Removed a whole lot of unnecessary(?) perfect forwarding.
The code is much easier to read, the optimizer should take care of
pretty much everything, AND it copiles even faster without the code
being riddled with std::forward and std::decay
2014-01-30 08:43:55 +01:00
rbock
9bcae0867f Moved "wrong" template to namespace vendor 2014-01-29 14:28:07 +01:00
rbock
b90eb7192a Renamed run and prepare methods to _run and _prepare
_methods are to be used by vendors
2014-01-29 13:11:11 +01:00
rbock
375dec25f8 Minor code cleanup 2014-01-28 18:03:14 +01:00
rbock
687fe13055 Added constness to char_result_row characters 2014-01-28 06:56:30 +01:00
rbock
25c1cfb399 Cleanup some minor bind issues 2014-01-28 06:50:21 +01:00
rbock
d85fdcd62b Removed unnecessary header 2014-01-27 18:50:22 +01:00
rbock
05ca005e1b Fixed bug in text results
text results never had a reasonable length
2014-01-27 13:40:52 +01:00
rbock
a9cfe534ef Fixed serialization of multi-row inserts 2014-01-27 12:48:24 +01:00
rbock
dda4fc2586 Small fix in result row 2014-01-27 12:12:38 +01:00
rbock
471dffebc0 Updated joins and updated columns to work with sqlite3
The new behaviour is closer to the standard, I think
2014-01-27 11:47:22 +01:00
rbock
d4d8429947 Added missing include directive 2014-01-26 22:58:38 +01:00
rbock
4869758e35 Renamed query -> statement 2014-01-26 22:39:44 +01:00
rbock
dfcd372611 tvin works with const char*, too 2014-01-26 15:44:44 +01:00
rbock
b0e7395f47 Using assignments in add_values now
This makes mistakes much less likely
2014-01-26 15:09:30 +01:00
rbock
5ef5259988 Added columns and add_values to insert for multi row inserts
Need to change add_values method to use assignments, though.
2014-01-26 13:24:42 +01:00
rbock
f802300685 Added sqlpp::null and sql::default_value for insert and update 2014-01-25 22:38:16 +01:00
rbock
f443564d62 Minor code cleanup 2014-01-24 00:31:53 +01:00
rbock
019a920739 Added a .where(bool) to choose all or no row 2014-01-22 22:53:23 +01:00
rbock
6e55f8f6cd Fixed a few bugs found during mysql tests 2014-01-22 18:35:08 +01:00
rbock
abce8592e6 Added DISTINCT flag to avg and sum 2014-01-22 09:31:36 +01:00
rbock
34f6c7a2eb Added optional DISTINCT flag to count 2014-01-21 23:42:27 +01:00
rbock
a22b07aa03 Added more tests (and fixes) for dynamic columns and flags 2014-01-21 09:50:58 +01:00
rbock
075e63c486 Added test for (empty) dynamic select flag list 2014-01-20 23:17:07 +01:00
rbock
ee7cda0a5d Started to change the way dynamic columns and flags are specified 2014-01-20 21:26:16 +01:00
rbock
7992a82615 Some notes 2014-01-20 10:48:28 +01:00
rbock
31127812a0 Added some template aliases to ease specialization and added a few more operator overloads 2014-01-19 18:11:05 +01:00
rbock
63ac89accb Fixed some "const" bugs and a parameter_tuple bug 2014-01-18 22:40:13 +01:00
rbock
24b44fae65 Re-animated all tests 2014-01-18 20:58:51 +01:00
rbock
87302fa27f Make g++-4.8 compile again 2014-01-18 16:10:46 +01:00
rbock
312e735d6d Moved a bunch of things into namespace vendor
This namespace is for things the developer will not get in touch with
(normally) but the vendor might need to use for specialization of the
interpreter.

This separation is not fully completed yet, some changes will have to
follow...
2014-01-18 15:50:16 +01:00
rbock
93129be748 Added missing interpreter specializations, especially for serializable 2014-01-17 09:56:35 +01:00
rbock
9826ef79e4 Added interpreters to is_null, multi_column, alias and select pseudo table 2014-01-16 22:31:43 +01:00
rbock
1c4d041b89 Cleaned up some outdated serialize functions 2014-01-15 23:05:24 +01:00
rbock
afcc62fc75 Added interpreters for a bunch of functions and table aliases 2014-01-15 19:42:14 +01:00
rbock
277ce51fb5 Added missing file 2014-01-15 17:44:59 +01:00
rbock
54d45e97ae Added interpret support for remove() 2014-01-15 08:24:42 +01:00
rbock
54fa55e6a5 interpret works for in() 2014-01-15 07:38:53 +01:00
rbock
602f33726f interpreter added for update() 2014-01-15 07:22:54 +01:00
rbock
9335a62087 Replaced implicit trivial_value_is_null tag for columns with explicit tvin method
This isn't database vendor specific, but library vendor specific, as I
used this implicit behaviour quite a lot, but it is utterly confusing
when mixed with prepared statements. Explicit is better here.
2014-01-14 22:54:07 +01:00
rbock
fa18ce5476 interpret works for insert now
Also added explicit .default_values() method
2014-01-13 23:05:48 +01:00
rbock
eb9f92543e Interpret works for parameters now
Also, paramters inherit the operators they need
2014-01-13 21:00:20 +01:00
rbock
c03ef1b0b1 interpret handles order_by(), limit() and offset() 2014-01-13 06:24:27 +01:00
rbock
f21860e5c5 Cleaned up a hack in like() 2014-01-12 16:26:47 +01:00
rbock
7fc5c34190 interpret works for group_by(), having() und .like() 2014-01-12 16:19:09 +01:00
rbock
d56d1422cd interpret works for where() 2014-01-12 16:01:38 +01:00
rbock
1d3ea8516f interpreter for from() 2014-01-12 15:45:50 +01:00
rbock
d957e8c0ae Added interpreter to select, select_flag_list, select_expression_list 2014-01-12 12:22:15 +01:00
rbock
f8b5d750fa Removed superfluous template parameter from interpreter
The Db parameter would actually have prevented different Context
overloads (or made more difficult than necessary).
2014-01-12 10:13:15 +01:00
rbock
47ae6a2e76 Continued to implement standard serializing interpreters
Everything that is interpreted also has to move out of detail namespace,
because it might have to be specialized for a database connector
2014-01-11 21:51:57 +01:00
rbock
bef7cea6a6 Started to switch from member serialize -> non-member interpret
This will allow database connectors to specialize the interpretation of
the expression tree and interpret queries in vendor specific ways where
required.
2014-01-11 00:11:47 +01:00
rbock
a68d6fb828 Prepared insert/update/delete now work with the mysql connector 2014-01-09 22:33:23 +01:00
rbock
121f56549b Added prepared statement support to insert, update and remove (untested yet) 2014-01-08 22:14:16 +01:00
rbock
3f519d6fce Started to add prepared statement support for insert, update and remove 2014-01-08 21:31:29 +01:00
Roland Bock
a122924d37 Accepting parameters in other parts of select now
(formerly only where and having clauses)
2014-01-08 08:02:17 +01:00
Roland Bock
e601747fca Assert that parameters are not used in dynamic elements of a query.
This will need to change in the future
2014-01-07 07:29:55 +01:00
Roland Bock
b8907df4ef Implemented parameter index determination 2014-01-05 19:25:52 +01:00
Roland Bock
51e0db883f Added static assert to prevent automatic rivial->null conversion to happen in where/having 2014-01-05 13:29:08 +01:00
Roland Bock
409fa3baac Test with boolean and text parameters in prepared query compiles and runs
with mysql
2014-01-04 19:32:18 +01:00
Roland Bock
c140e13510 Small fix for dynamic results and a hint for positional parameters 2014-01-04 18:26:11 +01:00
Roland Bock
bbf18e4f7a Changed data type for boolean to signed char (seems to be more common for binary bindings) 2014-01-04 18:21:48 +01:00
Roland Bock
5b77bf3fea Added missing validate methods 2014-01-04 10:20:58 +01:00
Roland Bock
099250945c Successfully running the first prepared select statement including result evaluation 2014-01-03 14:27:06 +01:00
Roland Bock
6e5ee56577 prepared to detemplatify connector results 2014-01-02 20:20:58 +01:00
Roland Bock
9ca174054d Can bind results. 2014-01-02 19:05:27 +01:00
Roland Bock
1360b1d9db Turned value_type::parameter_t into a non-template 2014-01-02 13:11:19 +01:00
Roland Bock
9d0746b15c Can now bind integral parameters and execute prepared queries 2013-12-29 20:31:59 +01:00
Roland Bock
b031bda5fc Can now prepare a select (tested with mysql) 2013-12-28 22:52:54 +01:00
Roland Bock
b4baf38fab Parameters of prepared statements can be null now 2013-12-26 19:05:05 +01:00
Roland Bock
3ef3faa0f4 Fixed bug in dynamic result row. 2013-12-18 08:19:50 +01:00
Roland Bock
a915bd9e50 Refactored of result and result row (clearer structure depending on connectors) 2013-12-17 22:12:13 +01:00
Roland Bock
2b43d3bc15 Added default constructor to result field types 2013-12-15 18:52:05 +01:00
Roland Bock
9597c3712c Moved result construction more towards connector.
This will make it easier to handle different formats
2013-12-15 13:02:41 +01:00
Roland Bock
51786a9f1d Added a prepared_select_t type and a prepare method for select
This is not done yet, but it indicates the way to go...
2013-11-28 11:12:44 +01:00
Roland Bock
221e20918b select now collects parameters from Where and Having 2013-11-26 23:45:31 +01:00
Roland Bock
8f99a03359 Can extract parameters from expression 2013-11-22 09:42:28 +01:00
Roland Bock
1aa67c6604 Added parameter and parameter_list
parameters are to be used as placeholders in the query.
parameter lists are to be used to assign values to these parameters and
forward them to the database.
2013-11-19 19:21:58 +01:00
Roland Bock
6f780a9542 Allow non-zero start values for dynamic limit and offset 2013-11-18 07:32:09 +01:00
Roland Bock
8d12d23d67 Added verbatim table 2013-11-16 23:19:37 +01:00
Roland Bock
5304e77f4a Streamlined usage of dynamic and non-dynamic method versions
from, where, having, group_py, order_by, using.

Prepared on() as well
2013-11-16 18:36:05 +01:00
Roland Bock
4b4048bd11 Unified interface for where and dynamic_where.
Compatible with previous interface.
Both where and dynamic where can now take a variable amount of
arguments. where() requires at least one argument.
2013-11-16 09:37:38 +01:00
Roland Bock
81309ce58f Minor cleanup 2013-11-15 10:09:42 +01:00
Roland Bock
e7c6f88d23 Remove clang warning for in() and is_null() 2013-11-15 10:01:45 +01:00
Roland Bock
6db64212b6 Prevent template constructor to overload default copy constructors 2013-11-15 10:00:48 +01:00
Roland Bock
3c5682f3ae Use serializable_list in update and insert 2013-11-15 09:59:44 +01:00
Roland Bock
16e3851847 Prevent template constructor to overload default copy cosntructors 2013-11-15 09:57:30 +01:00
Roland Bock
d3e438606c Added serializable_list (which is a noop for non-dynamic cases) 2013-11-15 09:56:46 +01:00
Roland Bock
9d09127e71 Fixed stupid bug in insert.
Basically nothing would have ever been inserted other than default
lines.
2013-11-10 15:29:20 +01:00
Roland Bock
81c77a58f4 Even moe function tests and a few corrections 2013-11-08 09:09:52 +01:00
Roland Bock
813549690e More function tests and a few corrections for names and return types 2013-11-07 15:06:13 +01:00
Roland Bock
9d94f6770b Added function tests and fixed a few return types 2013-11-07 13:36:54 +01:00
Roland Bock
0a57af0b3d Added tests for integral and floating point 2013-11-07 12:23:49 +01:00
Roland Bock
aae910671e Replaced numeric by integral and floating_point 2013-11-07 11:31:42 +01:00
Roland Bock
d3963e04b6 Added more checks for database traits 2013-11-01 15:25:52 +01:00
Roland Bock
e63a798a82 Started to use flags to indicate database traits
e.g. support for any or outer join, or how string concatenation is
implemented
2013-11-01 12:23:50 +01:00
Roland Bock
a17a8ecfa6 Reduced resource requirements for non-dynamic selects 2013-10-31 09:43:10 +01:00
Roland Bock
7050491bf0 Added support for dynamic columns 2013-10-29 19:32:52 +01:00
Roland Bock
902583a33b Added support for dynamic columns to select_expression_list
Dynamic columns are not yet supported in results, though.
2013-10-09 10:36:38 +02:00
Roland Bock
3718f4a57c Added default constructor for result type 2013-10-05 20:14:05 +02:00
Roland Bock
29165b2ce3 Removed obsolete flag in join types 2013-10-05 20:13:42 +02:00
Roland Bock
cff18e917b Reworked join syntax 2013-10-05 17:35:40 +02:00
Roland Bock
c59c8d9ba9 Reduced likelihood of mistakes in CRTP for tables.
Renaming serialize -> serialize_impl helped tracking down an error in
the connection implementation examples
2013-10-03 22:25:23 +02:00
Roland Bock
4d8e448152 Disabled select(tab). Use select(all_of(tab)) instead. 2013-10-03 21:36:50 +02:00
Roland Bock
96c6e5d435 Dynamic methods of select, insert and co return *this now.
Not sure if chaining makes much sense, but it is possible now
2013-10-03 20:53:55 +02:00
Roland Bock
bd337954fa Deleted unused struct 2013-10-02 19:45:58 +02:00
Roland Bock
1a8ea5a3b3 Re-wrote in()/not_in() to use a specific template and removed the generic nary member function template
The specific version is easier to understand and could be adjusted more
easily if some database should not support it...
2013-10-02 10:55:36 +02:00
Roland Bock
7fde9dafb2 Cleaned up a bunch of unused expression templates 2013-10-02 07:40:26 +02:00
Roland Bock
a2d23006f0 Fixed ambiguous assignment operator 2013-10-02 07:32:28 +02:00
Roland Bock
2e7d5478f6 Added dynamic functions to insert, remove and update 2013-09-30 07:46:50 +02:00
Roland Bock
d0d5fd2969 Replaced tag_yes and tag_no by std::true_type and std::false_type 2013-09-29 09:02:51 +02:00
Roland Bock
581353dc53 Streamlined some typenames 2013-09-29 08:51:29 +02:00
Roland Bock
3d777d982a Added missing file offset.h 2013-09-27 10:59:09 +02:00
Roland Bock
75447a2959 Fixed compile bug in gcc-4.8 2013-09-27 10:58:41 +02:00
Roland Bock
5604d5d663 Added dynamic limit and offset 2013-09-26 18:54:52 +02:00
Roland Bock
716996db51 Added dynamic versions of group_by, having and order_by 2013-09-22 21:29:53 +02:00
Roland Bock
472833016f Added dynamic versions of from and where to select 2013-09-22 20:42:19 +02:00
Roland Bock
5576df1775 Cleaned up select_pseudo_table and started to prepare for dynamic select parts 2013-09-22 12:16:28 +02:00
Roland Bock
950859af5f Rewrote macro generated function code to handwritten code
This increases the number of Bytes, but it also increases readability,
and reduces complexity.
It also allows to specialize functions for database engines.
2013-09-19 17:07:14 +02:00
Roland Bock
0db405c28c Rewrote like() member function, added more type control to concat() 2013-09-19 09:04:07 +02:00
Roland Bock
1ab504f908 Fixed compile time checks for concat 2013-09-19 08:15:19 +02:00
Roland Bock
683731517a Introduced result::front, pop_front and empty() to make it more STL-container-like 2013-09-19 08:08:59 +02:00
Roland Bock
8189dc6a00 Fixed bug in type set 2013-09-19 08:04:01 +02:00
Roland Bock
705c16e5a3 Rewrote concat function, preparing for concat and operator||, depending on the connector 2013-09-18 15:52:41 +02:00
Roland Bock
c042d99643 Introduced unary function templates which use one pair of braces less
This is required for sqlite which cannot parse

SELECT EXISTS((SELECT 1))
2013-09-18 15:19:47 +02:00
Roland Bock
d55cfce746 Simplified check for duplicate names in select expression list 2013-09-17 07:45:54 +02:00
Roland Bock
161da75723 Stripped a lot of superfluouos type information from result rows.
Moved member template into name class to utilize the fact the class
aliases are really just aliases.
This makes the code leaner in many cases and less complex for the compiler
(I guess). It also has the benefit, that the field name is available as
string in the result_rows. This might be useful for debugging one day.
2013-09-13 09:18:15 +02:00
Roland Bock
2defeff18e Introduced field template to make result_row_t less specific.
It is sufficient to have name and type. There is no need for the result
"to know" what exact expression was used to define the column.

Surprisingly, template alias creates new templates (in contrast to
non-template using, which really just creates an alias of a type).

template<typename T> struct A{};

struct X
{
  template<typename T>
    using U = A<T>;
};

struct Y
{
  template<typename T>
    using U = A<T>;
  template<>
    using U<int> = X;
};

template<template<typename> class X>
struct Z{};

static_assert(std::is_same<X::U<int>, Y::U<int>>::value, "class aliases are really just aliases");
static_assert(not std::is_same<Z<X::U>, Z<Y::U>>::value, "template aliases are new templates");

int main()
{
}
2013-09-13 07:24:41 +02:00
Roland Bock
9c1e75cd89 Adjusted insert and update to work with sqlite
Introduced first connector trait to change query generation.
2013-09-09 22:45:34 +02:00
Roland Bock
a629988abe Minor code cleanup 2013-09-05 23:57:37 +02:00
Roland Bock
92312445f8 Added convenience include file 2013-09-05 23:56:33 +02:00
Roland Bock
e928b72ede Removed result::size()
The number of rows is unknown in many cases. This might depend on the
configuration.
2013-08-22 08:11:43 +02:00
Roland Bock
09226497a4 Restructured expression types and braces to handle ANY and SOME 2013-08-21 23:25:38 +02:00
Roland Bock
cf1dae396a Fixed handling of IS NULL and IS NOT NULL expressions 2013-08-21 19:32:11 +02:00
Roland Bock
c41a181ca9 Improved early type checking in stand-alone functions 2013-08-21 19:30:56 +02:00
Roland Bock
f244f1110a Added like method for text types 2013-08-21 19:30:13 +02:00
Roland Bock
80e573568e Fixed result to not consume rows with operator* and operator-> 2013-08-17 11:26:58 +02:00
Roland Bock
b7c13e3974 Expand tab -> all_of(tab) in multi_column 2013-08-17 11:25:05 +02:00
Roland Bock
8914e3d18f Fixed decltype to work with g++ 2013-08-17 11:23:54 +02:00
Roland Bock
4ea28cac4b Added support for g++-4.8 2013-08-15 11:54:20 +02:00
Roland Bock
e4bcc27463 is_null() throws for invalid rows
result_row objects can be constructed with raw result rows representing
the end of the result set. Field values must not be accessed for such
rows. Thus, is_null() now throws an exception when called for a field of
an invalid row.
2013-08-15 09:32:24 +02:00
Roland Bock
e6f086bbfa Cleaned up directory structure. 2013-08-14 06:34:11 +02:00