glom r1504 - in trunk: . glom/utility_widgets/db_adddel
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r1504 - in trunk: . glom/utility_widgets/db_adddel
- Date: Tue, 1 Apr 2008 11:57:16 +0100 (BST)
Author: murrayc
Date: Tue Apr 1 11:57:16 2008
New Revision: 1504
URL: http://svn.gnome.org/viewvc/glom?rev=1504&view=rev
Log:
2008-04-01 Murray Cumming <murrayc murrayc com>
* glom/utility_widgets/db_adddel/glom_db_treemodel.cc:
Glom.refresh_from_database(): Omit the ORDER BY clause when counting the
number of rows from our SQL query. This is much faster.
Modified:
trunk/ChangeLog
trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
Modified: trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc (original)
+++ trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc Tue Apr 1 11:57:16 2008
@@ -469,6 +469,7 @@
//TODO: Is this inefficient?
//Note that the alias is just because the SQL syntax requires it - we get an error if we don't use it.
+ //Be careful not to include ORDER BY clauses in this, because that would make it unnecessarily slow:
const Glib::ustring query_count = "SELECT COUNT (*) FROM (" + sql_query + ") AS glomarbitraryalias";
const App_Glom* app = App_Glom::get_application();
@@ -604,7 +605,8 @@
{
//This doesn't work with ITER_MODEL_ONLY: const int count = m_gda_datamodel->get_n_rows();
//because rows count is -1 until we have iterated to the last row.
- const int count = count_rows_returned_by(sql_query);
+ const Glib::ustring sql_query_without_sort = Utils::build_sql_select_with_where_clause(m_found_set.m_table_name, m_column_fields, m_found_set.m_where_clause, m_found_set.m_extra_join, type_sort_clause(), m_found_set.m_extra_group_by);
+ const int count = count_rows_returned_by(sql_query_without_sort);
if(count < 0)
{
std::cerr << "DbTreeModel::refresh_from_database(): count is < 0" << std::endl;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]