mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-12-01 21:19:16 -06:00
Remove no-longer-necessary GncSqlBackend parameter.
Where it was required only to pass down to the CT_TIMESPEC specialization of template<GncSqlObjectType Type>GncSqlColumnTableEntryImpl::add_to_query().
This commit is contained in:
parent
10b006fdc1
commit
c470d006ee
@ -395,19 +395,18 @@ GncSqlColumnTableEntryImpl<CT_ACCOUNTREF>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_ACCOUNTREF>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_ACCOUNTREF>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_table(sql_be, vec);
|
||||
add_objectref_guid_to_table(vec);
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_ACCOUNTREF>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_ACCOUNTREF>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec)
|
||||
const noexcept
|
||||
{
|
||||
add_objectref_guid_to_query(sql_be, obj_name, pObject, vec);
|
||||
add_objectref_guid_to_query(obj_name, pObject, vec);
|
||||
}
|
||||
|
||||
/* ========================== END OF FILE ===================== */
|
||||
|
@ -109,10 +109,8 @@ GncSqlColumnTableEntryImpl<CT_ADDRESS>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_ADDRESS>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_ADDRESS>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
g_return_if_fail (sql_be != NULL);
|
||||
for (auto const& subtable_row : col_table)
|
||||
{
|
||||
auto buf = std::string{m_col_name} + "_" + subtable_row->m_col_name;
|
||||
@ -126,8 +124,7 @@ GncSqlColumnTableEntryImpl<CT_ADDRESS>::add_to_table(const GncSqlBackend* sql_be
|
||||
* it to operator<<().
|
||||
*/
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_ADDRESS>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_ADDRESS>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
|
@ -579,7 +579,7 @@ gnc_sql_append_guids_to_sql (std::stringstream& sql, const InstanceVec& instance
|
||||
}
|
||||
/* ================================================================= */
|
||||
static PairVec
|
||||
get_object_values (GncSqlBackend* sql_be, QofIdTypeConst obj_name,
|
||||
get_object_values (QofIdTypeConst obj_name,
|
||||
gpointer pObject, const EntryVec& table)
|
||||
{
|
||||
PairVec vec;
|
||||
@ -588,7 +588,7 @@ get_object_values (GncSqlBackend* sql_be, QofIdTypeConst obj_name,
|
||||
{
|
||||
if (!(table_row->is_autoincr()))
|
||||
{
|
||||
table_row->add_to_query (sql_be, obj_name, pObject, vec);
|
||||
table_row->add_to_query (obj_name, pObject, vec);
|
||||
}
|
||||
}
|
||||
return vec;
|
||||
@ -610,7 +610,7 @@ gnc_sql_object_is_it_in_db (GncSqlBackend* sql_be, const gchar* table_name,
|
||||
g_assert (stmt != NULL);
|
||||
|
||||
/* WHERE */
|
||||
PairVec values{get_object_values(sql_be, obj_name, pObject, table)};
|
||||
PairVec values{get_object_values(obj_name, pObject, table)};
|
||||
stmt->add_where_cond(obj_name, values);
|
||||
auto result = sql_be->execute_select_statement (stmt);
|
||||
if (result != NULL)
|
||||
@ -672,7 +672,7 @@ build_insert_statement (GncSqlBackend* sql_be,
|
||||
g_return_val_if_fail (table_name != NULL, NULL);
|
||||
g_return_val_if_fail (obj_name != NULL, NULL);
|
||||
g_return_val_if_fail (pObject != NULL, NULL);
|
||||
PairVec values{get_object_values(sql_be, obj_name, pObject, table)};
|
||||
PairVec values{get_object_values(obj_name, pObject, table)};
|
||||
|
||||
sql << "INSERT INTO " << table_name <<"(";
|
||||
for (auto const& col_value : values)
|
||||
@ -710,7 +710,7 @@ build_update_statement (GncSqlBackend* sql_be,
|
||||
g_return_val_if_fail (pObject != NULL, NULL);
|
||||
|
||||
|
||||
PairVec values{get_object_values (sql_be, obj_name, pObject, table)};
|
||||
PairVec values{get_object_values (obj_name, pObject, table)};
|
||||
|
||||
// Create the SQL statement
|
||||
sql << "UPDATE " << table_name << " SET ";
|
||||
@ -750,7 +750,7 @@ build_delete_statement (GncSqlBackend* sql_be,
|
||||
|
||||
/* WHERE */
|
||||
PairVec values;
|
||||
table[0]->add_to_query (sql_be, obj_name, pObject, values);
|
||||
table[0]->add_to_query (obj_name, pObject, values);
|
||||
PairVec col_values{values[0]};
|
||||
stmt->add_where_cond (obj_name, col_values);
|
||||
|
||||
|
@ -337,19 +337,17 @@ GncSqlColumnTableEntryImpl<CT_BILLTERMREF>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_BILLTERMREF>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_BILLTERMREF>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_table(sql_be, vec);
|
||||
add_objectref_guid_to_table(vec);
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_BILLTERMREF>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_BILLTERMREF>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_query(sql_be, obj_name, pObject, vec);
|
||||
add_objectref_guid_to_query(obj_name, pObject, vec);
|
||||
}
|
||||
|
||||
/* ========================== END OF FILE ===================== */
|
||||
|
@ -472,19 +472,17 @@ GncSqlColumnTableEntryImpl<CT_BUDGETREF>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_BUDGETREF>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_BUDGETREF>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_table(sql_be, vec);
|
||||
add_objectref_guid_to_table(vec);
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_BUDGETREF>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_BUDGETREF>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_query(sql_be, obj_name, pObject, vec);
|
||||
add_objectref_guid_to_query(obj_name, pObject, vec);
|
||||
}
|
||||
|
||||
/* ========================== END OF FILE ===================== */
|
||||
|
@ -271,19 +271,17 @@ GncSqlColumnTableEntryImpl<CT_COMMODITYREF>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_COMMODITYREF>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_COMMODITYREF>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_table(sql_be, vec);
|
||||
add_objectref_guid_to_table(vec);
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_COMMODITYREF>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_COMMODITYREF>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_query(sql_be, obj_name, pObject, vec);
|
||||
add_objectref_guid_to_query(obj_name, pObject, vec);
|
||||
}
|
||||
|
||||
/* ========================== END OF FILE ===================== */
|
||||
|
@ -290,19 +290,17 @@ GncSqlColumnTableEntryImpl<CT_INVOICEREF>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_INVOICEREF>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_INVOICEREF>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_table(sql_be, vec);
|
||||
add_objectref_guid_to_table(vec);
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_INVOICEREF>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_INVOICEREF>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_query(sql_be, obj_name, pObject, vec);
|
||||
add_objectref_guid_to_query(obj_name, pObject, vec);
|
||||
}
|
||||
|
||||
/* ========================== END OF FILE ===================== */
|
||||
|
@ -208,19 +208,17 @@ GncSqlColumnTableEntryImpl<CT_LOTREF>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_LOTREF>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_LOTREF>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_table(sql_be, vec);
|
||||
add_objectref_guid_to_table(vec);
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_LOTREF>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_LOTREF>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_query(sql_be, obj_name, pObject, vec);
|
||||
add_objectref_guid_to_query(obj_name, pObject, vec);
|
||||
}
|
||||
|
||||
/* ========================== END OF FILE ===================== */
|
||||
|
@ -179,19 +179,17 @@ GncSqlColumnTableEntryImpl<CT_ORDERREF>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_ORDERREF>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_ORDERREF>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_table(sql_be, vec);
|
||||
add_objectref_guid_to_table(vec);
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_ORDERREF>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_ORDERREF>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_query(sql_be, obj_name, pObject, vec);
|
||||
add_objectref_guid_to_query(obj_name, pObject, vec);
|
||||
}
|
||||
|
||||
/* ========================== END OF FILE ===================== */
|
||||
|
@ -155,11 +155,8 @@ GncSqlColumnTableEntryImpl<CT_OWNERREF>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_OWNERREF>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_OWNERREF>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
g_return_if_fail (sql_be != NULL);
|
||||
|
||||
auto buf = g_strdup_printf ("%s_type", m_col_name);
|
||||
GncSqlColumnInfo info(buf, BCT_INT, 0, false, false,
|
||||
m_flags & COL_PKEY, m_flags & COL_NNUL);
|
||||
@ -172,12 +169,10 @@ GncSqlColumnTableEntryImpl<CT_OWNERREF>::add_to_table(const GncSqlBackend* sql_b
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_OWNERREF>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_OWNERREF>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
g_return_if_fail (sql_be != NULL);
|
||||
g_return_if_fail (obj_name != NULL);
|
||||
g_return_if_fail (pObject != NULL);
|
||||
|
||||
|
@ -148,7 +148,7 @@ GncSqlBackend::create_table(const std::string& table_name,
|
||||
|
||||
for (auto const& table_row : col_table)
|
||||
{
|
||||
table_row->add_to_table (this, info_vec);
|
||||
table_row->add_to_table (info_vec);
|
||||
}
|
||||
return m_conn->create_table (table_name, info_vec);
|
||||
|
||||
@ -179,7 +179,7 @@ GncSqlBackend::add_columns_to_table(const std::string& table_name,
|
||||
|
||||
for (auto const& table_row : col_table)
|
||||
{
|
||||
table_row->add_to_table (this, info_vec);
|
||||
table_row->add_to_table (info_vec);
|
||||
}
|
||||
return m_conn->add_columns_to_table(table_name, info_vec);
|
||||
}
|
||||
|
@ -95,8 +95,7 @@ GncSqlColumnTableEntry::get_setter(QofIdTypeConst obj_name) const noexcept
|
||||
}
|
||||
|
||||
void
|
||||
GncSqlColumnTableEntry::add_objectref_guid_to_query (const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntry::add_objectref_guid_to_query (QofIdTypeConst obj_name,
|
||||
const void* pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
@ -109,11 +108,8 @@ GncSqlColumnTableEntry::add_objectref_guid_to_query (const GncSqlBackend* sql_be
|
||||
}
|
||||
|
||||
void
|
||||
GncSqlColumnTableEntry::add_objectref_guid_to_table (const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntry::add_objectref_guid_to_table (ColVec& vec) const noexcept
|
||||
{
|
||||
g_return_if_fail (sql_be != NULL);
|
||||
|
||||
GncSqlColumnInfo info{*this, BCT_STRING, GUID_ENCODING_LENGTH, FALSE};
|
||||
vec.emplace_back(std::move(info));
|
||||
}
|
||||
@ -138,11 +134,8 @@ GncSqlColumnTableEntryImpl<CT_STRING>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_STRING>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_STRING>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
g_return_if_fail (sql_be != NULL);
|
||||
|
||||
GncSqlColumnInfo info{*this, BCT_STRING, m_size, TRUE};
|
||||
vec.emplace_back(std::move(info));
|
||||
}
|
||||
@ -151,8 +144,7 @@ GncSqlColumnTableEntryImpl<CT_STRING>::add_to_table(const GncSqlBackend* sql_be,
|
||||
* it to operator<<().
|
||||
*/
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_STRING>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_STRING>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
@ -187,22 +179,18 @@ GncSqlColumnTableEntryImpl<CT_INT>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_INT>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_INT>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
g_return_if_fail (sql_be != NULL);
|
||||
|
||||
GncSqlColumnInfo info{*this, BCT_INT, 0, FALSE};
|
||||
vec.emplace_back(std::move(info));
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_INT>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_INT>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
add_value_to_vec<int>(sql_be, obj_name, pObject, vec);
|
||||
add_value_to_vec<int>(obj_name, pObject, vec);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
@ -226,22 +214,18 @@ GncSqlColumnTableEntryImpl<CT_BOOLEAN>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_BOOLEAN>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_BOOLEAN>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
g_return_if_fail (sql_be != NULL);
|
||||
|
||||
GncSqlColumnInfo info{*this, BCT_INT, 0, FALSE};
|
||||
vec.emplace_back(std::move(info));
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_BOOLEAN>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_BOOLEAN>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
add_value_to_vec<int>(sql_be, obj_name, pObject, vec);
|
||||
add_value_to_vec<int>(obj_name, pObject, vec);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
@ -264,22 +248,19 @@ GncSqlColumnTableEntryImpl<CT_INT64>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_INT64>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_INT64>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
g_return_if_fail (sql_be != NULL);
|
||||
|
||||
GncSqlColumnInfo info{*this, BCT_INT64, 0, FALSE};
|
||||
vec.emplace_back(std::move(info));
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_INT64>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_INT64>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
add_value_to_vec<int64_t>(sql_be, obj_name, pObject, vec);
|
||||
add_value_to_vec<int64_t>(obj_name, pObject, vec);
|
||||
}
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
@ -319,22 +300,18 @@ GncSqlColumnTableEntryImpl<CT_DOUBLE>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_DOUBLE>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_DOUBLE>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
g_return_if_fail (sql_be != NULL);
|
||||
|
||||
GncSqlColumnInfo info{*this, BCT_DOUBLE, 0, FALSE};
|
||||
vec.emplace_back(std::move(info));
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_DOUBLE>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_DOUBLE>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
add_value_to_vec<double*>(sql_be, obj_name, pObject, vec);
|
||||
add_value_to_vec<double*>(obj_name, pObject, vec);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
@ -367,20 +344,16 @@ GncSqlColumnTableEntryImpl<CT_GUID>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_GUID>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_GUID>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
g_return_if_fail (sql_be != NULL);
|
||||
|
||||
GncSqlColumnInfo info{*this, BCT_STRING, GUID_ENCODING_LENGTH, FALSE};
|
||||
vec.emplace_back(std::move(info));
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_GUID>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_GUID>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
auto s = get_row_value_from_object<GncGUID*>(obj_name, pObject);
|
||||
|
||||
@ -436,18 +409,14 @@ GncSqlColumnTableEntryImpl<CT_TIMESPEC>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_TIMESPEC>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_TIMESPEC>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
g_return_if_fail (sql_be != nullptr);
|
||||
|
||||
GncSqlColumnInfo info{*this, BCT_DATETIME, TIMESPEC_COL_SIZE, FALSE};
|
||||
vec.emplace_back(std::move(info));
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_TIMESPEC>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_TIMESPEC>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
@ -457,7 +426,6 @@ GncSqlColumnTableEntryImpl<CT_TIMESPEC>::add_to_query(const GncSqlBackend* sql_b
|
||||
* Timespec* and the getter returns a Timespec. Will be fixed by the
|
||||
* replacement of timespecs with time64s.
|
||||
*/
|
||||
g_return_if_fail (sql_be != NULL);
|
||||
g_return_if_fail (obj_name != NULL);
|
||||
g_return_if_fail (pObject != NULL);
|
||||
|
||||
@ -537,8 +505,8 @@ GncSqlColumnTableEntryImpl<CT_GDATE>::add_to_table(ColVec& vec) const noexcept
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_GDATE>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
GDate *date = get_row_value_from_object<GDate*>(obj_name, pObject);
|
||||
|
||||
@ -593,10 +561,8 @@ GncSqlColumnTableEntryImpl<CT_NUMERIC>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_NUMERIC>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_NUMERIC>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
g_return_if_fail (sql_be != NULL);
|
||||
|
||||
for (auto const& subtable_row : numeric_col_table)
|
||||
{
|
||||
@ -609,8 +575,7 @@ GncSqlColumnTableEntryImpl<CT_NUMERIC>::add_to_table(const GncSqlBackend* sql_be
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_NUMERIC>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_NUMERIC>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
@ -618,7 +583,6 @@ GncSqlColumnTableEntryImpl<CT_NUMERIC>::add_to_query(const GncSqlBackend* sql_be
|
||||
NumericGetterFunc getter;
|
||||
gnc_numeric n;
|
||||
|
||||
g_return_if_fail (sql_be != NULL);
|
||||
g_return_if_fail (obj_name != NULL);
|
||||
g_return_if_fail (pObject != NULL);
|
||||
|
||||
|
@ -124,13 +124,13 @@ public:
|
||||
* Add a GncSqlColumnInfo structure for the column type to a
|
||||
* ColVec.
|
||||
*/
|
||||
virtual void add_to_table(const GncSqlBackend* sql_be, ColVec& vec) const noexcept = 0;
|
||||
virtual void add_to_table(ColVec& vec) const noexcept = 0;
|
||||
/**
|
||||
* Add a pair of the table column heading and object's value's string
|
||||
* representation to a PairVec; used for constructing WHERE clauses and
|
||||
* UPDATE statements.
|
||||
*/
|
||||
virtual void add_to_query(const GncSqlBackend* sql_be, QofIdTypeConst obj_name,
|
||||
virtual void add_to_query(QofIdTypeConst obj_name,
|
||||
void* pObject, PairVec& vec) const noexcept = 0;
|
||||
/**
|
||||
* Retrieve the getter function depending on whether it's an auto-increment
|
||||
@ -180,7 +180,7 @@ protected:
|
||||
template <typename T> T
|
||||
get_row_value_from_object(QofIdTypeConst obj_name, const void* pObject) const;
|
||||
template <typename T> void
|
||||
add_value_to_vec(const GncSqlBackend* sql_be, QofIdTypeConst obj_name,
|
||||
add_value_to_vec(QofIdTypeConst obj_name,
|
||||
const void* pObject, PairVec& vec) const;
|
||||
/**
|
||||
* Adds a name/guid std::pair to a PairVec for creating a query.
|
||||
@ -190,8 +190,7 @@ protected:
|
||||
* @param pObject Object
|
||||
* @param pList List
|
||||
*/
|
||||
void add_objectref_guid_to_query (const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
void add_objectref_guid_to_query (QofIdTypeConst obj_name,
|
||||
const void* pObject,
|
||||
PairVec& vec) const noexcept;
|
||||
/**
|
||||
@ -200,8 +199,7 @@ protected:
|
||||
* @param sql_be SQL backend struct
|
||||
* @param pList List
|
||||
*/
|
||||
void add_objectref_guid_to_table (const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept;
|
||||
void add_objectref_guid_to_table (ColVec& vec) const noexcept;
|
||||
private:
|
||||
const char* m_col_name; /**< Column name */
|
||||
const GncSqlObjectType m_col_type; /**< Column type */
|
||||
@ -217,12 +215,10 @@ private:
|
||||
template <typename T> T get_row_value_from_object(QofIdTypeConst obj_name,
|
||||
const void* pObject,
|
||||
std::false_type) const;
|
||||
template <typename T> void add_value_to_vec(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
template <typename T> void add_value_to_vec(QofIdTypeConst obj_name,
|
||||
const void* pObject,
|
||||
PairVec& vec, std::true_type) const;
|
||||
template <typename T> void add_value_to_vec(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
template <typename T> void add_value_to_vec(QofIdTypeConst obj_name,
|
||||
const void* pObject,
|
||||
PairVec& vec, std::false_type) const;
|
||||
|
||||
@ -242,9 +238,9 @@ public:
|
||||
{}
|
||||
void load(const GncSqlBackend* sql_be, GncSqlRow& row, QofIdTypeConst obj_name,
|
||||
void* pObject) const noexcept override;
|
||||
void add_to_table(const GncSqlBackend* sql_be, ColVec& vec) const noexcept override;
|
||||
void add_to_query(const GncSqlBackend* sql_be, QofIdTypeConst obj_name,
|
||||
void* pObject, PairVec& vec) const noexcept override;
|
||||
void add_to_table(ColVec& vec) const noexcept override;
|
||||
void add_to_query(QofIdTypeConst obj_name, void* pObject, PairVec& vec)
|
||||
const noexcept override;
|
||||
};
|
||||
|
||||
using GncSqlColumnTableEntryPtr = std::shared_ptr<GncSqlColumnTableEntry>;
|
||||
@ -338,17 +334,15 @@ GncSqlColumnTableEntry::get_row_value_from_object(QofIdTypeConst obj_name,
|
||||
}
|
||||
|
||||
template <typename T> void
|
||||
GncSqlColumnTableEntry::add_value_to_vec(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntry::add_value_to_vec(QofIdTypeConst obj_name,
|
||||
const void* pObject,
|
||||
PairVec& vec) const
|
||||
{
|
||||
add_value_to_vec<T>(sql_be, obj_name, pObject, vec, std::is_pointer<T>());
|
||||
add_value_to_vec<T>(obj_name, pObject, vec, std::is_pointer<T>());
|
||||
}
|
||||
|
||||
template <typename T> void
|
||||
GncSqlColumnTableEntry::add_value_to_vec(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntry::add_value_to_vec(QofIdTypeConst obj_name,
|
||||
const void* pObject,
|
||||
PairVec& vec, std::true_type) const
|
||||
{
|
||||
@ -364,8 +358,7 @@ GncSqlColumnTableEntry::add_value_to_vec(const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template <typename T> void
|
||||
GncSqlColumnTableEntry::add_value_to_vec(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntry::add_value_to_vec(QofIdTypeConst obj_name,
|
||||
const void* pObject,
|
||||
PairVec& vec, std::false_type) const
|
||||
{
|
||||
|
@ -494,19 +494,17 @@ GncSqlColumnTableEntryImpl<CT_TAXTABLEREF>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_TAXTABLEREF>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_TAXTABLEREF>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_table(sql_be, vec);
|
||||
add_objectref_guid_to_table(vec);
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_TAXTABLEREF>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_TAXTABLEREF>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_query(sql_be, obj_name, pObject, vec);
|
||||
add_objectref_guid_to_query(obj_name, pObject, vec);
|
||||
}
|
||||
|
||||
/* ========================== END OF FILE ===================== */
|
||||
|
@ -1385,19 +1385,17 @@ GncSqlColumnTableEntryImpl<CT_TXREF>::load (const GncSqlBackend* sql_be,
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_TXREF>::add_to_table(const GncSqlBackend* sql_be,
|
||||
ColVec& vec) const noexcept
|
||||
GncSqlColumnTableEntryImpl<CT_TXREF>::add_to_table(ColVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_table(sql_be, vec);
|
||||
add_objectref_guid_to_table(vec);
|
||||
}
|
||||
|
||||
template<> void
|
||||
GncSqlColumnTableEntryImpl<CT_TXREF>::add_to_query(const GncSqlBackend* sql_be,
|
||||
QofIdTypeConst obj_name,
|
||||
GncSqlColumnTableEntryImpl<CT_TXREF>::add_to_query(QofIdTypeConst obj_name,
|
||||
const gpointer pObject,
|
||||
PairVec& vec) const noexcept
|
||||
{
|
||||
add_objectref_guid_to_query(sql_be, obj_name, pObject, vec);
|
||||
add_objectref_guid_to_query(obj_name, pObject, vec);
|
||||
}
|
||||
|
||||
/* ========================== END OF FILE ===================== */
|
||||
|
@ -570,7 +570,7 @@ test_add_gvalue_guid_to_slist (Fixture *fixture, gconstpointer pData)
|
||||
// Not Used
|
||||
/* gnc_sql_add_objectref_guid_to_vec
|
||||
void
|
||||
gnc_sql_add_objectref_guid_to_vec (const GncSqlBackend* sql_be, QofIdTypeConst obj_name,// 1
|
||||
gnc_sql_add_objectref_guid_to_vec (QofIdTypeConst obj_name,// 1
|
||||
*/
|
||||
/* static void
|
||||
test_gnc_sql_add_objectref_guid_to_vec (Fixture *fixture, gconstpointer pData)
|
||||
@ -579,38 +579,12 @@ test_gnc_sql_add_objectref_guid_to_vec (Fixture *fixture, gconstpointer pData)
|
||||
// Not Used
|
||||
/* gnc_sql_add_objectref_guid_col_info_to_list
|
||||
void
|
||||
gnc_sql_add_objectref_guid_col_info_to_list (const GncSqlBackend* sql_be,// 1
|
||||
gnc_sql_add_objectref_guid_col_info_to_list (,// 1
|
||||
*/
|
||||
/* static void
|
||||
test_gnc_sql_add_objectref_guid_col_info_to_list (Fixture *fixture, gconstpointer pData)
|
||||
{
|
||||
}*/
|
||||
/* GncDbiBackend::time64_to_string
|
||||
std::string
|
||||
GncDbiBackend::time64_to_string (time64 t)// C: 1 */
|
||||
|
||||
#define numtests 6
|
||||
static void
|
||||
test_time64_to_string ()
|
||||
{
|
||||
GncSqlBackend sql_be {nullptr, nullptr, "%4d-%02d-%02d %02d:%02d:%02d"};
|
||||
const char* dates[numtests] = {"1995-03-11 19:17:26",
|
||||
"2001-04-20 11:44:07",
|
||||
"1964-02-29 09:15:23",
|
||||
"1959-04-02 00:00:00",
|
||||
"2043-11-22 05:32:45",
|
||||
"2153-12-18 01:15:30"
|
||||
};
|
||||
|
||||
for (auto date : dates)
|
||||
{
|
||||
|
||||
Timespec ts = gnc_iso8601_to_timespec_gmt (date);
|
||||
auto datestr = sql_be.time64_to_string (ts.tv_sec);
|
||||
g_assert_cmpstr (date, == , datestr.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
/* load_timespec
|
||||
static void
|
||||
load_timespec (const GncSqlBackend* sql_be, GncSqlRow& row,// 2
|
||||
@ -929,8 +903,6 @@ test_suite_gnc_backend_sql (void)
|
||||
// GNC_TEST_ADD (suitename, "add value guid to vec", Fixture, nullptr, test_add_value_guid_to_vec, teardown);
|
||||
// GNC_TEST_ADD (suitename, "gnc sql add gvalue objectref guid to slist", Fixture, nullptr, test_gnc_sql_add_objectref_guid_to_vec, teardown);
|
||||
// GNC_TEST_ADD (suitename, "gnc sql add objectref guid col info to list", Fixture, nullptr, test_gnc_sql_add_objectref_guid_col_info_to_list, teardown);
|
||||
GNC_TEST_ADD_FUNC (suitename, "GncDbiBackend time64 to string",
|
||||
test_time64_to_string);
|
||||
// GNC_TEST_ADD (suitename, "load timespec", Fixture, nullptr, test_load_timespec, teardown);
|
||||
// GNC_TEST_ADD (suitename, "add timespec col info to list", Fixture, nullptr, test_add_timespec_col_info_to_list, teardown);
|
||||
// GNC_TEST_ADD (suitename, "add value timespec to vec", Fixture, nullptr, test_add_value_timespec_to_vec, teardown);
|
||||
|
Loading…
Reference in New Issue
Block a user