GnuCash de0bfde+
Loading...
Searching...
No Matches
gnc-sql-column-table-entry.cpp
1/********************************************************************
2 * gnc-sql-column-table-entry.cpp: Implement GncSqlColumnTableEntry *
3 * *
4 * Copyright 2016 John Ralls <jralls@ceridwen.us> *
5 * *
6 * This program is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU General Public License as *
8 * published by the Free Software Foundation; either version 2 of *
9 * the License, or (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License*
17 * along with this program; if not, contact: *
18 * *
19 * Free Software Foundation Voice: +1-617-542-5942 *
20 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
21 * Boston, MA 02110-1301, USA gnu@gnu.org *
22\********************************************************************/
23
24#include <config.h>
25#include <qof.h>
26#include <sstream>
27#include <iomanip>
28#include <cstdint>
29#include <gnc-datetime.hpp>
30#include "gnc-sql-backend.hpp"
31#include "gnc-sql-object-backend.hpp"
32#include "gnc-sql-column-table-entry.hpp"
33#include "gnc-sql-result.hpp"
34
35static QofLogModule log_module = G_LOG_DOMAIN;
36
37/* ================================================================= */
38static gpointer
39get_autoinc_id (void* object, const QofParam* param)
40{
41 // Just need a 0 to force a new autoinc value
42 return (gpointer)0;
43}
44
45static void
46set_autoinc_id (void* object, void* item)
47{
48 // Nowhere to put the ID
49}
50
53{
54 QofAccessFunc getter;
55
56 g_return_val_if_fail (obj_name != NULL, NULL);
57
58 if (m_flags & COL_AUTOINC)
59 {
60 getter = get_autoinc_id;
61 }
62 else if (m_qof_param_name != NULL)
63 {
64 getter = qof_class_get_parameter_getter (obj_name, m_qof_param_name);
65 }
66 else
67 {
68 getter = m_getter;
69 }
70
71 return getter;
72}
73
76{
77 QofSetterFunc setter = nullptr;
78 if (m_flags & COL_AUTOINC)
79 {
80 setter = set_autoinc_id;
81 }
82 else if (m_qof_param_name != nullptr)
83 {
84 g_assert (obj_name != NULL);
85 setter = qof_class_get_parameter_setter (obj_name, m_qof_param_name);
86 }
87 else
88 {
89 setter = m_setter;
90 }
91 return setter;
92}
93
94void
96 const void* pObject,
97 PairVec& vec) const noexcept
98{
99 auto inst = get_row_value_from_object<QofInstance*>(obj_name, pObject);
100 if (inst == nullptr) return;
101 auto guid = qof_instance_get_guid (inst);
102 if (guid != nullptr) {
103 gchar *guid_s = guid_to_string(guid);
104 vec.emplace_back (std::make_pair (std::string{m_col_name}, quote_string(guid_s)));
105 g_free(guid_s);
106 }
107}
108
109void
111{
112 GncSqlColumnInfo info{*this, BCT_STRING, GUID_ENCODING_LENGTH, FALSE};
113 vec.emplace_back(std::move(info));
114}
115
116
117/* ----------------------------------------------------------------- */
118template<> void
120 GncSqlRow& row,
121 QofIdTypeConst obj_name,
122 gpointer pObject) const noexcept
123{
124 g_return_if_fail (pObject != NULL);
125 g_return_if_fail (m_gobj_param_name != NULL || get_setter(obj_name) != NULL);
126
127 auto s = row.get_string_at_col (m_col_name);
128 if (s)
129 set_parameter(pObject, s->c_str(), get_setter(obj_name), m_gobj_param_name);
130}
131
132template<> void
134{
135 GncSqlColumnInfo info{*this, BCT_STRING, m_size, TRUE};
136 vec.emplace_back(std::move(info));
137}
138
139/* char is unusual in that we get a pointer but don't deref it to pass
140 * it to operator<<().
141 */
142template<> void
144 const gpointer pObject,
145 PairVec& vec) const noexcept
146{
147 auto s = get_row_value_from_object<char*>(obj_name, pObject);
148
149 if (s != nullptr)
150 {
151 std::ostringstream stream;
152 stream << s;
153 vec.emplace_back (std::make_pair (std::string{m_col_name},
154 quote_string(stream.str())));
155 /* g_object_get returns a copy; a getter returns the object's own string. */
156 if (m_gobj_param_name != nullptr)
157 g_free (s);
158 }
159}
160
161/* ----------------------------------------------------------------- */
162typedef gint (*IntAccessFunc) (const gpointer);
163typedef void (*IntSetterFunc) (const gpointer, gint);
164
165template<> void
167 GncSqlRow& row,
168 QofIdTypeConst obj_name,
169 gpointer pObject) const noexcept
170{
171
172 g_return_if_fail (pObject != NULL);
173 g_return_if_fail (m_gobj_param_name != NULL || get_setter(obj_name) != NULL);
174
175 auto val = row.get_int_at_col(m_col_name);
176 if (val)
177 set_parameter(pObject, *val,
178 reinterpret_cast<IntSetterFunc>(get_setter(obj_name)),
179 m_gobj_param_name);
180}
181
182template<> void
184{
185 GncSqlColumnInfo info{*this, BCT_INT, 0, FALSE};
186 vec.emplace_back(std::move(info));
187}
188
189template<> void
191 const gpointer pObject,
192 PairVec& vec) const noexcept
193{
194 add_value_to_vec<int>(obj_name, pObject, vec);
195}
196
197/* ----------------------------------------------------------------- */
198typedef gboolean (*BooleanAccessFunc) (const gpointer);
199typedef void (*BooleanSetterFunc) (const gpointer, gboolean);
200
201template<> void
203 GncSqlRow& row,
204 QofIdTypeConst obj_name,
205 gpointer pObject)
206 const noexcept
207{
208 g_return_if_fail (pObject != NULL);
209 g_return_if_fail (m_gobj_param_name != NULL || get_setter(obj_name) != NULL);
210
211 auto val = row.get_int_at_col (m_col_name);
212 if (val)
213 set_parameter(pObject, static_cast<int>(*val),
214 reinterpret_cast<BooleanSetterFunc>(get_setter(obj_name)),
215 m_gobj_param_name);
216}
217
218template<> void
220{
221 GncSqlColumnInfo info{*this, BCT_INT, 0, FALSE};
222 vec.emplace_back(std::move(info));
223}
224
225template<> void
227 const gpointer pObject,
228 PairVec& vec) const noexcept
229{
230 add_value_to_vec<int>(obj_name, pObject, vec);
231}
232
233/* ----------------------------------------------------------------- */
234typedef gint64 (*Int64AccessFunc) (const gpointer);
235typedef void (*Int64SetterFunc) (const gpointer, gint64);
236
237template<> void
239 GncSqlRow& row,
240 QofIdTypeConst obj_name,
241 gpointer pObject)
242 const noexcept
243{
244 g_return_if_fail (m_gobj_param_name != nullptr || get_setter(obj_name) != nullptr);
245
246 auto val = row.get_int_at_col (m_col_name);
247 if (val)
248 set_parameter(pObject, *val,
249 reinterpret_cast<Int64SetterFunc>(get_setter(obj_name)),
250 m_gobj_param_name);
251}
252
253template<> void
255{
256
257 GncSqlColumnInfo info{*this, BCT_INT64, 0, FALSE};
258 vec.emplace_back(std::move(info));
259}
260
261template<> gint64
262GncSqlColumnTableEntry::get_row_value_from_object<int64_t>(QofIdTypeConst obj_name,
263 const void* pObject) const
264{
265 g_return_val_if_fail(obj_name != nullptr && pObject != nullptr,
266 INT64_C(0));
267 int64_t result = INT64_C(0);
268 if (m_gobj_param_name != nullptr)
269 g_object_get(const_cast<void*>(pObject), m_gobj_param_name,
270 &result, nullptr);
271 else
272 {
273 auto getter = (Int64AccessFunc)get_getter(obj_name);
274 if (getter != nullptr)
275 result = (getter)(const_cast<void*>(pObject));
276 }
277 return result;
278}
279
280template<> void
282 const gpointer pObject,
283 PairVec& vec) const noexcept
284{
285 add_value_to_vec<int64_t>(obj_name, pObject, vec);
286}
287/* ----------------------------------------------------------------- */
288
289template<> void
291 GncSqlRow& row,
292 QofIdTypeConst obj_name,
293 gpointer pObject)
294 const noexcept
295{
296 g_return_if_fail (pObject != NULL);
297 g_return_if_fail (m_gobj_param_name != nullptr || get_setter(obj_name) != nullptr);
298 double val{0.0};
299
300 if (auto int_val{row.get_int_at_col(m_col_name)})
301 val = static_cast<decltype(val)>(*int_val);
302 else if (auto float_val{row.get_float_at_col(m_col_name)})
303 val = static_cast<decltype(val)>(*float_val);
304 else if (auto double_val{row.get_double_at_col(m_col_name)})
305 val = *double_val;
306
307 set_parameter(pObject, val, get_setter(obj_name), m_gobj_param_name);
308}
309
310template<> void
312{
313 GncSqlColumnInfo info{*this, BCT_DOUBLE, 0, FALSE};
314 vec.emplace_back(std::move(info));
315}
316
317template<> void
319 const gpointer pObject,
320 PairVec& vec) const noexcept
321{
322 add_value_to_vec<double*>(obj_name, pObject, vec);
323}
324
325/* ----------------------------------------------------------------- */
326
327template<> void
329 GncSqlRow& row,
330 QofIdTypeConst obj_name,
331 gpointer pObject)
332 const noexcept
333{
334
335 GncGUID guid;
336
337 g_return_if_fail (pObject != NULL);
338 g_return_if_fail (m_gobj_param_name != nullptr || get_setter(obj_name) != nullptr);
339
340 auto strval{row.get_string_at_col(m_col_name)};
341 if (strval && string_to_guid (strval->c_str(), &guid))
342 set_parameter(pObject, &guid, get_setter(obj_name), m_gobj_param_name);
343}
344
345template<> void
347{
348 GncSqlColumnInfo info{*this, BCT_STRING, GUID_ENCODING_LENGTH, FALSE};
349 vec.emplace_back(std::move(info));
350}
351
352template<> void
354 const gpointer pObject,
355 PairVec& vec) const noexcept
356{
357 auto s = get_row_value_from_object<GncGUID*>(obj_name, pObject);
358
359 if (s != nullptr)
360 {
361 gchar *guid_s = guid_to_string(s);
362 vec.emplace_back (std::make_pair (std::string{m_col_name}, quote_string(guid_s)));
363 g_free(guid_s);
364 if (m_gobj_param_name != nullptr)
365 g_boxed_free (GNC_TYPE_GUID, s);
366 }
367}
368/* ----------------------------------------------------------------- */
369typedef time64 (*Time64AccessFunc) (const gpointer);
370typedef void (*Time64SetterFunc) (const gpointer, time64);
371constexpr int TIME_COL_SIZE = 4 + 3 + 3 + 3 + 3 + 3;
372
373template<> void
375 GncSqlRow& row,
376 QofIdTypeConst obj_name,
377 gpointer pObject)
378 const noexcept
379{
380 time64 t{0};
381 g_return_if_fail (m_gobj_param_name != nullptr || get_setter(obj_name) != nullptr);
382 auto strval = row.get_string_at_col(m_col_name);
383 if (strval)
384 {
385 if (!strval->empty())
386 try
387 {
388 GncDateTime time(*strval);
389 t = static_cast<time64>(time);
390 }
391 catch (const std::invalid_argument& err)
392 {
393 PWARN("An invalid date %s was found in your database."
394 "It has been set to 1 January 1970.",
395 strval->c_str());
396 }
397 }
398 else
399 {
400 if (auto time64val = row.get_time64_at_col (m_col_name))
401 t = *time64val;
402 }
403
404 if (m_gobj_param_name != nullptr)
405 {
406 Time64 t64{t};
407 set_parameter(pObject, &t64, m_gobj_param_name);
408 }
409 else
410 {
411 set_parameter(pObject, t,
412 reinterpret_cast<Time64SetterFunc>(get_setter(obj_name)),
413 nullptr);
414 }
415}
416
417template<> void
419{
420
421 GncSqlColumnInfo info{*this, BCT_DATETIME, TIME_COL_SIZE, FALSE};
422 vec.emplace_back(std::move(info));
423}
424
425template<> void
427 const gpointer pObject,
428 PairVec& vec) const noexcept
429{
430 /* We still can't use get_row_value_from_object because while g_value could
431 * contentedly store a time64 in an int64, KVP wouldn't be able to tell them
432 * apart, so we have the struct Time64 hack, see engine/gnc-date.c.
433 */
434 time64 t64;
435 if (m_gobj_param_name != nullptr)
436 {
437 Time64* t;
438 g_object_get (pObject, m_gobj_param_name, &t, nullptr);
439 t64 = t->t;
440 g_boxed_free (GNC_TYPE_TIME64, t);
441 }
442 else
443 {
444 auto getter = (Time64AccessFunc)get_getter (obj_name);
445 g_return_if_fail(getter != nullptr);
446 t64 = (*getter)(pObject);
447 }
448 if (t64 > MINTIME && t64 < MAXTIME)
449 {
450 GncDateTime time(t64);
451 std::string timestr("'");
452 timestr += time.format_iso8601() + "'";
453 vec.emplace_back (std::make_pair (std::string{m_col_name}, timestr));
454 }
455 else
456 {
457 vec.emplace_back (std::make_pair (std::string{m_col_name},
458 "NULL"));
459 }
460}
461
462/* ----------------------------------------------------------------- */
463#define DATE_COL_SIZE 8
464
465template<> void
467 GncSqlRow& row,
468 QofIdTypeConst obj_name,
469 gpointer pObject) const noexcept
470{
471 g_return_if_fail (pObject != NULL);
472 g_return_if_fail (m_gobj_param_name != nullptr || get_setter(obj_name) != nullptr);
473 if (row.is_col_null(m_col_name))
474 return;
475 GDate date;
476 g_date_clear (&date, 1);
477
478 auto strval{row.get_string_at_col(m_col_name)};
479 if (strval)
480 {
481 if (strval->empty())
482 return;
483 auto year = static_cast<GDateYear>(stoi (strval->substr (0,4)));
484 auto month = static_cast<GDateMonth>(stoi (strval->substr (4,2)));
485 auto day = static_cast<GDateDay>(stoi (strval->substr (6,2)));
486
487 if (year != 0 || month != 0 || day != (GDateDay)0)
488 g_date_set_dmy(&date, day, month, year);
489 }
490 else
491 {
492 auto timeval = row.get_time64_at_col(m_col_name);
493 if (!timeval)
494 return;
495 /* time64_to_gdate applies the tz, and gdates are saved
496 * as ymd, so we don't want that.
497 */
498 auto time = *timeval;
499 auto tm = gnc_gmtime(&time);
500 g_date_set_dmy(&date, tm->tm_mday,
501 static_cast<GDateMonth>(tm->tm_mon + 1),
502 tm->tm_year + 1900);
503 free(tm);
504 }
505
506 set_parameter(pObject, &date, get_setter(obj_name), m_gobj_param_name);
507}
508
509template<> void
511{
512 GncSqlColumnInfo info{*this, BCT_DATE, DATE_COL_SIZE, FALSE};
513 vec.emplace_back(std::move(info));
514}
515
516template<> void
518 const gpointer pObject,
519 PairVec& vec) const noexcept
520{
521 GDate *date = get_row_value_from_object<GDate*>(obj_name, pObject);
522
523 if (date && g_date_valid (date))
524 {
525 std::ostringstream buf;
526 buf << std::setfill ('0') << std::setw (4) << g_date_get_year (date) <<
527 std::setw (2) << g_date_get_month (date) <<
528 std::setw (2) << static_cast<int>(g_date_get_day (date));
529 vec.emplace_back (std::make_pair (std::string{m_col_name},
530 quote_string(buf.str())));
531 }
532 if (date && m_gobj_param_name != nullptr)
533 g_boxed_free (G_TYPE_DATE, date);
534}
535
536/* ----------------------------------------------------------------- */
537typedef gnc_numeric (*NumericGetterFunc) (const gpointer);
538typedef void (*NumericSetterFunc) (gpointer, gnc_numeric);
539
540static const EntryVec numeric_col_table =
541{
542 gnc_sql_make_table_entry<CT_INT64>("num", 0, COL_NNUL, "guid"),
543 gnc_sql_make_table_entry<CT_INT64>("denom", 0, COL_NNUL, "guid")
544};
545
546template <>
547void set_parameter<gpointer, gnc_numeric>(gpointer object,
548 gnc_numeric item,
549 const char* property)
550{
551 qof_instance_increase_editlevel(object);
552 g_object_set(object, property, &item, nullptr);
553 qof_instance_decrease_editlevel(object);
554};
555
556template<> void
558 GncSqlRow& row,
559 QofIdTypeConst obj_name,
560 gpointer pObject) const noexcept
561{
562
563
564 g_return_if_fail (pObject != NULL);
565 g_return_if_fail (m_gobj_param_name != nullptr || get_setter(obj_name) != nullptr);
566
567 auto buf = g_strdup_printf ("%s_num", m_col_name);
568 auto num = row.get_int_at_col (buf);
569 g_free (buf);
570 buf = g_strdup_printf ("%s_denom", m_col_name);
571 auto denom = row.get_int_at_col (buf);
572 g_free (buf);
573
574 if (num && denom)
575 {
576 auto n = gnc_numeric_create (*num, *denom);
577 set_parameter(pObject, n,
578 reinterpret_cast<NumericSetterFunc>(get_setter(obj_name)),
579 m_gobj_param_name);
580 }
581}
582
583template<> void
585{
586
587 for (auto const& subtable_row : numeric_col_table)
588 {
589 gchar* buf = g_strdup_printf("%s_%s", m_col_name,
590 subtable_row->m_col_name);
591 GncSqlColumnInfo info(buf, BCT_INT64, 0, false, false,
592 m_flags & COL_PKEY, m_flags & COL_NNUL);
593 g_free (buf);
594 vec.emplace_back(std::move(info));
595 }
596}
597
598template<> void
600 const gpointer pObject,
601 PairVec& vec) const noexcept
602{
603/* We can't use get_row_value_from_object for the same reason as time64. */
604 NumericGetterFunc getter;
605 gnc_numeric n;
606
607 g_return_if_fail (obj_name != NULL);
608 g_return_if_fail (pObject != NULL);
609
610 if (m_gobj_param_name != nullptr)
611 {
612 gnc_numeric* s;
613 g_object_get (pObject, m_gobj_param_name, &s, NULL);
614 n = *s;
615 g_boxed_free (GNC_TYPE_NUMERIC, s);
616 }
617 else
618 {
619 getter = reinterpret_cast<NumericGetterFunc>(get_getter (obj_name));
620 if (getter != NULL)
621 {
622 n = (*getter) (pObject);
623 }
624 else
625 {
626 n = gnc_numeric_zero ();
627 }
628 }
629
630 std::ostringstream buf;
631 std::string num_col{m_col_name};
632 std::string denom_col{m_col_name};
633 num_col += "_num";
634 denom_col += "_denom";
635 buf << gnc_numeric_num (n);
636 vec.emplace_back (std::make_pair (num_col, buf.str ()));
637 buf.str ("");
638 buf << gnc_numeric_denom (n);
639 vec.emplace_back (denom_col, buf.str ());
640}
641
642static void
643_retrieve_guid_ (gpointer pObject, gpointer pValue)
644{
645 GncGUID* pGuid = (GncGUID*)pObject;
646 GncGUID* guid = (GncGUID*)pValue;
647
648 g_return_if_fail (pObject != NULL);
649 g_return_if_fail (pValue != NULL);
650
651 *pGuid = *guid;
652}
653
654// Table to retrieve just the guid
655static EntryVec guid_table
656{
657 gnc_sql_make_table_entry<CT_GUID>("guid", 0, 0, nullptr, _retrieve_guid_)
658};
659
660const GncGUID*
661gnc_sql_load_guid (const GncSqlBackend* sql_be, GncSqlRow& row)
662{
663 static GncGUID guid;
664
665 g_return_val_if_fail (sql_be != NULL, NULL);
666
667 gnc_sql_load_object (sql_be, row, NULL, &guid, guid_table);
668
669 return &guid;
670}
671
672void
673gnc_sql_load_object (const GncSqlBackend* sql_be, GncSqlRow& row,
674 QofIdTypeConst obj_name, gpointer pObject,
675 const EntryVec& table)
676{
677 g_return_if_fail (sql_be != NULL);
678 g_return_if_fail (pObject != NULL);
679
680 for (auto const& table_row : table)
681 {
682 table_row->load (sql_be, row, obj_name, pObject);
683 }
684}
685
686uint_t
687gnc_sql_append_guids_to_sql (std::stringstream& sql,
688 const InstanceVec& instances)
689{
690 char guid_buf[GUID_ENCODING_LENGTH + 1];
691
692 for (auto inst : instances)
693 {
694 (void)guid_to_string_buff (qof_instance_get_guid (inst), guid_buf);
695
696 if (inst != *(instances.begin()))
697 {
698 sql << ",";
699 }
700 sql << "'" << guid_buf << "'";
701 }
702
703 return instances.size();
704}
705
706/* This is necessary for 64-bit builds because g++ complains
707 * that reinterpret_casting a void* (64 bits) to an int (32 bits)
708 * loses precision, so we have to explicitly dispose of the precision.
709 * FIXME: We shouldn't be storing ints in ptrs in the first place.
710 */
711#ifdef __LP64__
712template <> int
713GncSqlColumnTableEntry::get_row_value_from_object<int>(QofIdTypeConst obj_name,
714 const void* pObject,
715 std::false_type) const
716{
717 g_return_val_if_fail(obj_name != nullptr && pObject != nullptr, 0);
718 int result = 0;
719 if (m_gobj_param_name != nullptr)
720 g_object_get(const_cast<void*>(pObject), m_gobj_param_name, &result,
721 nullptr);
722 else
723 {
724 QofAccessFunc getter = get_getter(obj_name);
725 if (getter != nullptr)
726 {
727 auto value = ((getter)(const_cast<void*>(pObject), nullptr));
728 result = reinterpret_cast<uint64_t>(value) &
729 UINT64_C(0x00000000FFFFFFFF);
730 }
731 }
732 return result;
733}
734#endif
GnuCash DateTime class.
Main SQL backend structure.
void add_to_query(QofIdTypeConst obj_name, void *pObject, PairVec &vec) const noexcept override
Add a pair of the table column heading and object's value's string representation to a PairVec; used ...
void add_to_table(ColVec &vec) const noexcept override
Add a GncSqlColumnInfo structure for the column type to a ColVec.
void load(const GncSqlBackend *sql_be, GncSqlRow &row, QofIdTypeConst obj_name, void *pObject) const noexcept override
Load a value into an object from the database row.
QofSetterFunc get_setter(QofIdTypeConst obj_name) const noexcept
Retrieve the setter function depending on whether it's an auto-increment field, a QofClass getter,...
void add_objectref_guid_to_query(QofIdTypeConst obj_name, const void *pObject, PairVec &vec) const noexcept
Adds a name/guid std::pair to a PairVec for creating a query.
void add_objectref_guid_to_table(ColVec &vec) const noexcept
Adds a column info structure for an object reference GncGUID to a ColVec.
QofAccessFunc get_getter(QofIdTypeConst obj_name) const noexcept
Retrieve the getter function depending on whether it's an auto-increment field, a QofClass getter,...
Row of SQL Query results.
gpointer(* QofAccessFunc)(gpointer object, const QofParam *param)
The QofAccessFunc defines an arbitrary function pointer for access functions.
Definition qofclass.h:124
void(* QofSetterFunc)(gpointer, gpointer)
The QofSetterFunc defines an function pointer for parameter setters.
Definition qofclass.h:131
QofSetterFunc qof_class_get_parameter_setter(QofIdTypeConst obj_name, const char *parameter)
Return the object's parameter setter function.
Definition qofclass.cpp:172
QofAccessFunc qof_class_get_parameter_getter(QofIdTypeConst obj_name, const char *parameter)
Return the object's parameter getter function.
Definition qofclass.cpp:156
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
Definition gnc-date.h:87
struct tm * gnc_gmtime(const time64 *secs)
fill out a time struct from a 64-bit time value
Definition gnc-date.cpp:178
const gchar * QofIdTypeConst
QofIdTypeConst declaration.
Definition qofid.h:82
gchar * guid_to_string(const GncGUID *guid)
The guid_to_string() routine returns a null-terminated string encoding of the id.
Definition guid.cpp:199
#define GUID_ENCODING_LENGTH
Number of characters needed to encode a guid as a string not including the null terminator.
Definition guid.h:84
gchar * guid_to_string_buff(const GncGUID *guid, gchar *str)
The guid_to_string_buff() routine puts a null-terminated string encoding of the id into the memory po...
Definition guid.cpp:208
const GncGUID * qof_instance_get_guid(gconstpointer inst)
Return the GncGUID of this instance.
#define PWARN(format, args...)
Log a warning.
Definition qoflog.h:250
The type used to store guids in C.
Definition guid.h:75