diff options
Diffstat (limited to 'bug')
-rw-r--r-- | bug/list | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -48,3 +48,40 @@ odb: error: unable to extract profile paths See email from <axel50397@gmail.com>/23-Oct-2014. + +- Position pragmas in macros don't work + + #include <odb/core.hxx> + + #define ODB_COUNT(obj, key) \ + PRAGMA_DB(view object(obj)) \ + struct obj##_count \ + { \ + PRAGMA_DB(column("count(" + obj::key + ")")) \ + int count; \ + }; + + /* + #define ODB_COUNT(obj, key) \ + struct obj##_count \ + { \ + int count; \ + }; \ + PRAGMA_DB(view(obj##_count) object(obj)) \ + PRAGMA_DB(member(obj##_count::count) \ + column("count(" + obj::key + ")")) \ + */ + + #pragma db object + struct test + { + #pragma db id + int id; + }; + + ODB_COUNT(test, id) + + The reason it doesn't work is because we use the macro expansion + point as the location of the pragmas inside the macro. Fixing this + properly won't be simple. Perhaps simply document as a limitation + where we describe PRAGMA_DB. |