mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-11-02 09:49:06 -06:00
[-Wunused-function] - remove
This commit is contained in:
1 parent
05975aa510
commit
9c6ad222a9
30 files changed
-730
No files matched your search
@@ -183,18 +183,6 @@ GncSqlSlotsBackend::GncSqlSlotsBackend() :
|
||||
|
||||
/* ================================================================= */
|
||||
|
||||
inline static std::string::size_type
|
||||
get_final_delim(std::string& path)
|
||||
{
|
||||
auto idx = path.rfind('/');
|
||||
while (idx == path.length())
|
||||
{
|
||||
path.erase(idx);
|
||||
idx = path.rfind('/');
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
static std::string
|
||||
get_key (slot_info_t* pInfo)
|
||||
{
|
||||
@@ -790,31 +778,6 @@ load_obj_guid (const GncSqlBackend* sql_be, GncSqlRow& row)
|
||||
return &guid;
|
||||
}
|
||||
|
||||
static void
|
||||
load_slot_for_list_item (GncSqlBackend* sql_be, GncSqlRow& row,
|
||||
QofCollection* coll)
|
||||
{
|
||||
slot_info_t slot_info = { NULL, NULL, TRUE, NULL, KvpValue::Type::INVALID,
|
||||
NULL, FRAME, NULL, "" };
|
||||
const GncGUID* guid;
|
||||
QofInstance* inst;
|
||||
|
||||
g_return_if_fail (sql_be != NULL);
|
||||
g_return_if_fail (coll != NULL);
|
||||
|
||||
guid = load_obj_guid (sql_be, row);
|
||||
g_assert (guid != NULL);
|
||||
inst = qof_collection_lookup_entity (coll, guid);
|
||||
|
||||
slot_info.be = sql_be;
|
||||
slot_info.pKvpFrame = qof_instance_get_slots (inst);
|
||||
slot_info.context = NONE;
|
||||
|
||||
gnc_sql_load_object (sql_be, row, TABLE_NAME, &slot_info, col_table);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
load_slot_for_book_object (GncSqlBackend* sql_be, GncSqlRow& row,
|
||||
BookLookupFn lookup_fn)
|
||||
|
||||
@@ -723,168 +723,6 @@ GncSqlTransBackend::load_all (GncSqlBackend* sql_be)
|
||||
nullptr);
|
||||
}
|
||||
|
||||
static void
|
||||
convert_query_comparison_to_sql (QofQueryPredData* pPredData,
|
||||
gboolean isInverted, std::stringstream& sql)
|
||||
{
|
||||
if (pPredData->how == QOF_COMPARE_LT
|
||||
|| (isInverted && pPredData->how == QOF_COMPARE_GTE))
|
||||
sql << "<";
|
||||
else if (pPredData->how == QOF_COMPARE_LTE
|
||||
|| (isInverted && pPredData->how == QOF_COMPARE_GT))
|
||||
sql << "<=";
|
||||
else if (pPredData->how == QOF_COMPARE_EQUAL
|
||||
|| (isInverted && pPredData->how == QOF_COMPARE_NEQ))
|
||||
sql << "=";
|
||||
else if (pPredData->how == QOF_COMPARE_GT
|
||||
|| (isInverted && pPredData->how == QOF_COMPARE_LTE))
|
||||
sql << ">";
|
||||
else if (pPredData->how == QOF_COMPARE_GTE
|
||||
|| (isInverted && pPredData->how == QOF_COMPARE_LT))
|
||||
sql << ">=";
|
||||
else if (pPredData->how == QOF_COMPARE_NEQ
|
||||
|| (isInverted && pPredData->how == QOF_COMPARE_EQUAL))
|
||||
sql << "~=";
|
||||
else
|
||||
{
|
||||
PERR ("Unknown comparison type\n");
|
||||
sql << "??";
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
convert_query_term_to_sql (const GncSqlBackend* sql_be, const gchar* fieldName,
|
||||
QofQueryTerm* pTerm, std::stringstream& sql)
|
||||
{
|
||||
QofQueryPredData* pPredData;
|
||||
gboolean isInverted;
|
||||
|
||||
g_return_if_fail (pTerm != NULL);
|
||||
|
||||
pPredData = qof_query_term_get_pred_data (pTerm);
|
||||
isInverted = qof_query_term_is_inverted (pTerm);
|
||||
|
||||
if (g_strcmp0 (pPredData->type_name, QOF_TYPE_GUID) == 0)
|
||||
{
|
||||
query_guid_t guid_data = (query_guid_t)pPredData;
|
||||
GList* guid_entry;
|
||||
sql << "(" << fieldName;
|
||||
|
||||
switch (guid_data->options)
|
||||
{
|
||||
case QOF_GUID_MATCH_ANY:
|
||||
sql << (isInverted ? " NOT IN (" : " IN (");
|
||||
break;
|
||||
|
||||
case QOF_GUID_MATCH_NONE:
|
||||
sql << (isInverted ? " IN (" : " NOT IN (");
|
||||
break;
|
||||
|
||||
default:
|
||||
PERR ("Unexpected GncGUID match type: %d\n", guid_data->options);
|
||||
}
|
||||
|
||||
for (guid_entry = guid_data->guids; guid_entry != NULL;
|
||||
guid_entry = guid_entry->next)
|
||||
{
|
||||
gchar guid_buf[GUID_ENCODING_LENGTH + 1];
|
||||
|
||||
if (guid_entry != guid_data->guids) sql << ",";
|
||||
(void)guid_to_string_buff (static_cast<GncGUID*> (guid_entry->data),
|
||||
guid_buf);
|
||||
sql << guid_buf;
|
||||
}
|
||||
sql << "))";
|
||||
|
||||
}
|
||||
else if (g_strcmp0 (pPredData->type_name, QOF_TYPE_CHAR) == 0)
|
||||
{
|
||||
query_char_t char_data = (query_char_t)pPredData;
|
||||
int i;
|
||||
|
||||
if (isInverted) sql << "NOT(";
|
||||
if (char_data->options == QOF_CHAR_MATCH_NONE) sql << "NOT ";
|
||||
sql << "(";
|
||||
for (i = 0; char_data->char_list[i] != '\0'; i++)
|
||||
{
|
||||
if (i != 0) sql << " OR ";
|
||||
sql << fieldName << " = '" << char_data->char_list[i] << "'";
|
||||
}
|
||||
sql << ") ";
|
||||
if (isInverted) sql << ") ";
|
||||
}
|
||||
else if (g_strcmp0 (pPredData->type_name, QOF_TYPE_STRING) == 0)
|
||||
{
|
||||
query_string_t string_data = (query_string_t)pPredData;
|
||||
sqlEscape* escape = sqlEscape_new ();
|
||||
|
||||
if (isInverted || pPredData->how == QOF_COMPARE_NEQ)
|
||||
sql << "NOT(";
|
||||
sql << fieldName;
|
||||
if (string_data->is_regex ||
|
||||
string_data->options == QOF_STRING_MATCH_CASEINSENSITIVE)
|
||||
{
|
||||
PWARN ("String is_regex || option = QOF_STRING_MATCH_INSENSITIVE\n");
|
||||
}
|
||||
// sql << " ~" ;
|
||||
// } else {
|
||||
sql << " =";
|
||||
// }
|
||||
// if( string_data->options == QOF_STRING_MATCH_CASEINSENSITIVE ) {
|
||||
// sql+= "*";
|
||||
// }
|
||||
sql << "'" << sqlEscapeString (escape, string_data->matchstring) << "'";
|
||||
if (pPredData->how == QOF_COMPARE_NEQ) sql << ")";
|
||||
if (isInverted) sql << ")";
|
||||
sqlEscape_destroy (escape);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sql << "(" << fieldName;
|
||||
convert_query_comparison_to_sql (pPredData, isInverted, sql);
|
||||
|
||||
if (strcmp (pPredData->type_name, QOF_TYPE_NUMERIC) == 0)
|
||||
{
|
||||
query_numeric_t pData = (query_numeric_t)pPredData;
|
||||
sql << gnc_numeric_to_double (pData->amount);
|
||||
}
|
||||
else if (g_strcmp0 (pPredData->type_name, QOF_TYPE_DATE) == 0)
|
||||
{
|
||||
query_date_t date_data = (query_date_t)pPredData;
|
||||
|
||||
GncDateTime time(date_data->date);
|
||||
sql << time.format_iso8601();
|
||||
}
|
||||
else if (strcmp (pPredData->type_name, QOF_TYPE_INT32) == 0)
|
||||
{
|
||||
query_int32_t pData = (query_int32_t)pPredData;
|
||||
sql << pData->val;
|
||||
}
|
||||
else if (strcmp (pPredData->type_name, QOF_TYPE_INT64) == 0)
|
||||
{
|
||||
query_int64_t pData = (query_int64_t)pPredData;
|
||||
sql << pData->val;
|
||||
}
|
||||
else if (strcmp (pPredData->type_name, QOF_TYPE_DOUBLE) == 0)
|
||||
{
|
||||
query_double_t pData = (query_double_t)pPredData;
|
||||
sql << pData->val;
|
||||
}
|
||||
else if (strcmp (pPredData->type_name, QOF_TYPE_BOOLEAN) == 0)
|
||||
{
|
||||
query_boolean_t pData = (query_boolean_t)pPredData;
|
||||
sql << pData->val;
|
||||
}
|
||||
else
|
||||
{
|
||||
PERR ("Unknown query predicate type: %s\n", pPredData->type_name);
|
||||
}
|
||||
|
||||
sql << ")";
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GncSqlStatementPtr stmt;
|
||||
|
||||
Reference in new issue
Block a user