0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-15 20:31:16 +08:00

Merge branch 'release/0.45'

This commit is contained in:
rbock 2017-01-28 12:24:44 +01:00
commit 4d22202fe5
4 changed files with 16 additions and 6 deletions

View File

@ -47,7 +47,7 @@ namespace sqlpp
size_t len{};
target._bind_text_result(index, &text, &len);
this->_value = {text, len};
this->_is_null = (len == 0);
this->_is_null = (text == nullptr);
}
template <typename Target>
@ -57,7 +57,7 @@ namespace sqlpp
size_t len{};
target._post_bind_text_result(index, &text, &len);
this->_value = {text, len};
this->_is_null = (len == 0);
this->_is_null = (text == nullptr);
}
};

View File

@ -44,7 +44,7 @@ namespace sqlpp
template <typename T>
struct _member_t
{
T in;
T not_in;
};
};
};

View File

@ -233,6 +233,7 @@ else:
if warnOnParse:
print(parseError + '. Continuing [-no-warn-on-parse]')
nsList = namespace.split('::')
# PROCESS DDL
tableCreations = ddl.parseFile(pathToDdl)
@ -246,8 +247,9 @@ print('#include <' + INCLUDE + '/table.h>', file=header)
print('#include <' + INCLUDE + '/data_types.h>', file=header)
print('#include <' + INCLUDE + '/char_sequence.h>', file=header)
print('', file=header)
print('namespace ' + namespace, file=header)
print('{', file=header)
for ns in nsList:
print('namespace ' + ns, file=header)
print('{', file=header)
DataTypeError = False
for create in tableCreations:
sqlTableName = create.tableName
@ -322,7 +324,8 @@ for create in tableCreations:
print(' };', file=header)
print(' };', file=header)
print('}', file=header)
for ns in nsList:
print('} // namespace ' + ns, file=header)
print('#endif', file=header)
if (DataTypeError):
print("Error: unsupported datatypes." )

View File

@ -44,5 +44,12 @@ int As(int, char* [])
compare(__LINE__, (count(foo.omega) - bar.alpha).as(cheese), "(COUNT(tab_foo.omega)-tab_bar.alpha) AS cheese");
compare(__LINE__, (count(foo.omega) - uint32_t(17)).as(cheese), "(COUNT(tab_foo.omega)-17) AS cheese");
// Auto alias
compare(__LINE__, select(max(bar.alpha)), "SELECT MAX(tab_bar.alpha) AS max_");
compare(__LINE__, select(max(bar.alpha).as(cheese)), "SELECT MAX(tab_bar.alpha) AS cheese");
compare(__LINE__, select(max(bar.alpha)).from(bar).unconditionally().as(cheese),
"(SELECT MAX(tab_bar.alpha) AS max_ FROM tab_bar) AS cheese");
compare(__LINE__, select(max(bar.alpha)).from(bar).unconditionally().as(cheese).max, "cheese.max_");
return 0;
}