[odb-users] ORDER BY clause in ODB query language
Markus Klemm
markus at markusklemm.net
Thu Sep 10 05:20:09 EDT 2015
I'm sorry this bug is not causes by your fix, it judt slipped my tests before.
Mit freundlichen Grüßen
Markus Klemm
Gesendet via Mobiltelefon
> Am 10.09.2015 um 10:13 schrieb Markus Klemm <markus at markusklemm.net>:
>
> Alright I checked out tag 2.4.0 (which differs from the downloadable 2.4.0 package btw) and cherrypicked your commit.
>
> It broke where I want to filter the files by the directories (1:n bidirect.) and still want a particular ordering of the files.
>
> const std::vector<decltype(directory::directory_id)> &directories
> odb::query<file> filter_by_directory_query = odb::query<file>::directory->directory_id.in_range(directories.cbegin(), directories.cend());
> odb::query<file> order_by_query("ORDER BY" + odb::query<file>::read_time + "ASC");
> odb::query<file> final_query = filter_by_directory_query + order_by_query;
>
> I'm sorry in advance because I guess I did something wrong/unelegant again.
>
> Resulting SQL Query:
> SELECT [files].[file_id], [files].[file_name], [files].[directory_id], [files].[
> fully_uploaded], [files].[partially_uploaded], [files].[read_time], [files].[upl
> oader_log] FROM [files] LEFT JOIN [directories] AS [directory_id] ON [directory_
> id].[directory_id]=[files].[directory_id] WHERE [directory_id].[directory_id] IN
> () ORDER BY [files].[read_time] ASC
>
> Other querys looked fine:
> SELECT [directories].[directory_id], [directories].[full_path], [directories].[f
> ile_type], [directories].[active], [directories].[added], [directories].[added_b
> y] FROM [directories] ORDER BY [directories].[full_path] ASC
> SELECT [file_types].[type_id], [file_types].[type_description], [file_types].[md
> db_importer_flag], [file_types].[search_string], [file_types].[odbc_connection_t
> emplate] FROM [file_types] WHERE [file_types].[type_id]=?
> SELECT [directories].[directory_id], [directories].[full_path], [directories].[f
> ile_type], [directories].[active], [directories].[added], [directories].[added_b
> y] FROM [directories] ORDER BY [directories].[added] ASC
>
> SELECT [files].[file_id], [files].[file_name], [files].[directory_id], [files].[
> fully_uploaded], [files].[partially_uploaded], [files].[read_time], [files].[upl
> oader_log] FROM [files] WHERE [files].[file_id]=?
>
> Regards
>
> Markus Klemm
>
More information about the odb-users
mailing list