UPDATE/INSERT a single instance of m_type_name into the database.
135{
136 GncVendor* v;
138 E_DB_OPERATION op;
139 gboolean is_infant;
140 gboolean is_ok = TRUE;
141
142 g_return_val_if_fail (inst != NULL, FALSE);
143 g_return_val_if_fail (GNC_IS_VENDOR (inst), FALSE);
144 g_return_val_if_fail (sql_be != NULL, FALSE);
145
146 v = GNC_VENDOR (inst);
147
148 is_infant = qof_instance_get_infant (inst);
150 {
151 op = OP_DB_DELETE;
152 }
153 else if (sql_be->pristine() || is_infant)
154 {
155 op = OP_DB_INSERT;
156 }
157 else
158 {
159 op = OP_DB_UPDATE;
160 }
161 if (op != OP_DB_DELETE)
162 {
163
165 }
166 if (is_ok)
167 {
169 col_table);
170 }
171
172 if (is_ok)
173 {
174
177 {
178 is_ok = gnc_sql_slots_save (sql_be, guid, is_infant, inst);
179 }
180 else
181 {
182 is_ok = gnc_sql_slots_delete (sql_be, guid);
183 }
184 }
185
186 return is_ok;
187}
bool do_db_operation(E_DB_OPERATION op, const char *table_name, QofIdTypeConst obj_name, gpointer pObject, const EntryVec &table) const noexcept
Performs an operation on the database.
bool save_commodity(gnc_commodity *comm) noexcept
Ensure that a commodity referenced in another object is in fact saved in the database.
const GncGUID * qof_instance_get_guid(gconstpointer inst)
Return the GncGUID of this instance.
gboolean qof_instance_get_destroying(gconstpointer ptr)
Retrieve the flag that indicates whether or not this object is about to be destroyed.
The type used to store guids in C.