added in ticket/templates.cpp binary search for tickets and tickets parameters
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@707 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -51,9 +51,10 @@ Error TDb::GetTicket(long file_id, Ticket & ticket)
|
||||
|
||||
try
|
||||
{
|
||||
// they should be sorted by param (they are used in a binary search later)
|
||||
query.Clear();
|
||||
query << R("select file_id, param, int_value, str_value from plugins.ticket "
|
||||
"where ticket.file_id=") << file_id << R(";");
|
||||
"where ticket.file_id=") << file_id << R(" order by param asc;");
|
||||
|
||||
r = AssertQuery(query);
|
||||
AssertResult(r, PGRES_TUPLES_OK);
|
||||
@@ -105,10 +106,12 @@ Error TDb::GetTickets(const std::vector<long> & file_id_tab, std::vector<Ticket>
|
||||
|
||||
try
|
||||
{
|
||||
// ticket_tab must be sorted by file_id (they are used in a binary search later)
|
||||
// and items in a ticket should be sorted by param (they are used in a binary search later too)
|
||||
query.Clear();
|
||||
CreateIdList(file_id_tab, file_list);
|
||||
query << R("select file_id, param, int_value, str_value from plugins.ticket "
|
||||
"where ticket.file_id in ") << R(file_list) << R(" order by file_id;");
|
||||
"where ticket.file_id in ") << R(file_list) << R(" order by file_id, param;");
|
||||
|
||||
// !! moze dodac operator <<(std::vector(long)) do query?
|
||||
|
||||
@@ -135,7 +138,7 @@ Error TDb::GetTickets(const std::vector<long> & file_id_tab, std::vector<Ticket>
|
||||
last_file_id = file_id;
|
||||
}
|
||||
|
||||
par.param = AssertValueInt(r, i, cparam);
|
||||
par.param = AssertValueInt(r, i, cparam);
|
||||
par.int_value = AssertValueLong(r, i, cintvalue);
|
||||
AssertValueWide(r, i, cstrvalue, par.str_value);
|
||||
|
||||
|
Reference in New Issue
Block a user