Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
glom
Commits
c6166846
Commit
c6166846
authored
Mar 07, 2016
by
Murray Cumming
Browse files
Use auto for DataModel, though we lose some constness.
parent
7d21035c
Changes
8
Hide whitespace changes
Inline
Side-by-side
glom/base_db.cc
View file @
c6166846
...
...
@@ -1032,7 +1032,7 @@ Gnome::Gda::Value Base_DB::get_field_value_in_database(const LayoutFieldInRecord
auto
sql_query
=
Utils
::
build_sql_select_with_key
(
field_in_record
.
m_table_name
,
list_fields
,
field_in_record
.
m_key
,
field_in_record
.
m_key_value
,
type_sort_clause
(),
1
);
Glib
::
RefPtr
<
const
Gnome
::
Gda
::
DataModel
>
data_model
=
DbUtils
::
query_execute_select
(
sql_query
);
auto
data_model
=
DbUtils
::
query_execute_select
(
sql_query
);
if
(
data_model
)
{
if
(
data_model
->
get_n_rows
())
...
...
@@ -1075,7 +1075,7 @@ Gnome::Gda::Value Base_DB::get_field_value_in_database(const std::shared_ptr<Fie
std
::
shared_ptr
<
const
Relationship
>
()
/* extra_join */
,
type_sort_clause
(),
1
/* limit */
);
Glib
::
RefPtr
<
const
Gnome
::
Gda
::
DataModel
>
data_model
=
DbUtils
::
query_execute_select
(
sql_query
);
auto
data_model
=
DbUtils
::
query_execute_select
(
sql_query
);
if
(
data_model
)
{
if
(
data_model
->
get_n_rows
())
...
...
@@ -1298,7 +1298,7 @@ bool Base_DB::get_field_value_is_unique(const Glib::ustring& table_name, const s
builder
->
add_field_id
(
field
->
get_name
(),
table_name_used
),
builder
->
add_expr
(
value
)));
Glib
::
RefPtr
<
const
Gnome
::
Gda
::
DataModel
>
data_model
=
DbUtils
::
query_execute_select
(
builder
);
auto
data_model
=
DbUtils
::
query_execute_select
(
builder
);
if
(
data_model
)
{
//std::cout << "debug: " << G_STRFUNC << ": table_name=" << table_name << ", field name=" << field->get_name() << ", value=" << value.to_string() << ", rows count=" << data_model->get_n_rows() << std::endl;
...
...
@@ -1395,7 +1395,7 @@ bool Base_DB::get_primary_key_is_in_foundset(const FoundSet& found_set, const Gn
auto
query
=
Utils
::
build_sql_select_with_where_clause
(
found_set
.
m_table_name
,
fieldsToGet
,
builder
->
export_expression
(
cond_id
));
Glib
::
RefPtr
<
const
Gnome
::
Gda
::
DataModel
>
data_model
=
DbUtils
::
query_execute_select
(
query
);
auto
data_model
=
DbUtils
::
query_execute_select
(
query
);
if
(
data_model
&&
data_model
->
get_n_rows
())
{
...
...
glom/base_db_table_data.cc
View file @
c6166846
...
...
@@ -495,7 +495,7 @@ void Base_DB_Table_Data::refresh_related_fields(const LayoutFieldInRecord& field
auto
query
=
Utils
::
build_sql_select_with_key
(
field_in_record_changed
.
m_table_name
,
fieldsToGet
,
field_in_record_changed
.
m_key
,
field_in_record_changed
.
m_key_value
);
//std::cout << "debug: " << G_STRFUNC << ": query=" << query << std::endl;
Glib
::
RefPtr
<
const
Gnome
::
Gda
::
DataModel
>
result
=
DbUtils
::
query_execute_select
(
query
);
auto
result
=
DbUtils
::
query_execute_select
(
query
);
if
(
!
result
)
{
std
::
cerr
<<
G_STRFUNC
<<
": no result.
\n
"
;
...
...
glom/frame_glom.cc
View file @
c6166846
...
...
@@ -648,7 +648,7 @@ void Frame_Glom::export_data_to_stream(std::ostream& the_stream, const FoundSet&
auto
query
=
Utils
::
build_sql_select_with_where_clause
(
found_set
.
m_table_name
,
fieldsSequence
,
found_set
.
m_where_clause
,
found_set
.
m_extra_join
,
found_set
.
m_sort_clause
);
//TODO: Lock the database (prevent changes) during export.
Glib
::
RefPtr
<
const
Gnome
::
Gda
::
DataModel
>
result
=
DbUtils
::
query_execute_select
(
query
);
auto
result
=
DbUtils
::
query_execute_select
(
query
);
guint
rows_count
=
0
;
if
(
result
)
...
...
glom/libglom/db_utils.cc
View file @
c6166846
...
...
@@ -1445,7 +1445,7 @@ Gnome::Gda::Value auto_increment_insert_first_if_necessary(const Glib::ustring&
builder
->
select_add_target
(
GLOM_STANDARD_TABLE_AUTOINCREMENTS_TABLE_NAME
);
builder_set_where_autoincrement
(
builder
,
table_name
,
field_name
);
const
Glib
::
RefPtr
<
const
Gnome
::
Gda
::
DataModel
>
datamodel
=
query_execute_select
(
builder
);
const
auto
datamodel
=
query_execute_select
(
builder
);
if
(
!
datamodel
||
(
datamodel
->
get_n_rows
()
==
0
))
{
//Start with zero:
...
...
glom/mode_data/box_data_calendar_related.cc
View file @
c6166846
...
...
@@ -212,7 +212,7 @@ bool Box_Data_Calendar_Related::fill_from_database()
auto
sql_query
=
Utils
::
build_sql_select_with_where_clause
(
m_found_set
.
m_table_name
,
m_FieldsShown
,
where_clause
,
m_found_set
.
m_extra_join
,
m_found_set
.
m_sort_clause
);
//std::cout << "DEBUG: sql_query=" << sql_query << std::endl;
Glib
::
RefPtr
<
const
Gnome
::
Gda
::
DataModel
>
datamodel
=
DbUtils
::
query_execute_select
(
sql_query
);
auto
datamodel
=
DbUtils
::
query_execute_select
(
sql_query
);
if
(
!
(
datamodel
))
return
true
;
...
...
glom/mode_data/box_data_portal.cc
View file @
c6166846
...
...
@@ -287,7 +287,7 @@ void Box_Data_Portal::get_suitable_record_to_view_details(const Gnome::Gda::Valu
//std::cout << "DEBUG: related table=" << related_table << ", whose primary_key=" << key_field->get_name() << ", with value=" << primary_key_value.to_string() << "getting value for: " << layout_item->get_layout_display_name() << std::endl;
auto
query
=
Utils
::
build_sql_select_with_key
(
related_table
,
fieldsToGet
,
key_field
,
primary_key_value
);
Glib
::
RefPtr
<
const
Gnome
::
Gda
::
DataModel
>
data_model
=
DbUtils
::
query_execute_select
(
query
);
auto
data_model
=
DbUtils
::
query_execute_select
(
query
);
bool
value_found
=
true
;
...
...
glom/mode_data/datawidget/treemodel_db.cc
View file @
c6166846
...
...
@@ -115,7 +115,7 @@ void DbTreeModelRow::fill_values_if_necessary(DbTreeModel& model, int row)
//Create default values, if necessary, of the correct types:
//Examine the columns in the returned DataModel:
const
Glib
::
RefPtr
<
const
Gnome
::
Gda
::
DataModel
>
datamodel
=
model
.
m_gda_datamodel
;
const
auto
datamodel
=
model
.
m_gda_datamodel
;
for
(
guint
col
=
0
;
col
<
model
.
m_data_model_columns_count
;
++
col
)
{
if
(
m_db_values
.
find
(
col
)
==
m_db_values
.
end
())
//If there is not already a value in the map for this column.
...
...
glom/print_layout/canvas_print_layout.cc
View file @
c6166846
...
...
@@ -906,7 +906,7 @@ void Canvas_PrintLayout::fill_with_data_portal(const Glib::RefPtr<CanvasLayoutIt
const
Glib
::
RefPtr
<
Gnome
::
Gda
::
SqlBuilder
>
sql_query
=
Utils
::
build_sql_select_with_where_clause
(
found_set
.
m_table_name
,
fields_shown
,
found_set
.
m_where_clause
,
found_set
.
m_extra_join
,
found_set
.
m_sort_clause
);
//std::cout << "DEBUG: sql_query=" << sql_query << std::endl;
const
Glib
::
RefPtr
<
const
Gnome
::
Gda
::
DataModel
>
datamodel
=
DbUtils
::
query_execute_select
(
sql_query
);
const
auto
datamodel
=
DbUtils
::
query_execute_select
(
sql_query
);
if
(
!
(
datamodel
))
return
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment