UPDATE/INSERT a single instance of m_type_name into the database.
150{
151 SchedXaction* pSx;
152 const GncGUID* guid;
153 E_DB_OPERATION op;
154 gboolean is_infant;
155 gboolean is_ok;
156
157 g_return_val_if_fail (sql_be != NULL, FALSE);
158 g_return_val_if_fail (inst != NULL, FALSE);
159 g_return_val_if_fail (GNC_IS_SX (inst), FALSE);
160
161 pSx = GNC_SX (inst);
162
163 is_infant = qof_instance_get_infant (inst);
165 {
166 op = OP_DB_DELETE;
167 }
168 else if (sql_be->pristine() || is_infant)
169 {
170 op = OP_DB_INSERT;
171 }
172 else
173 {
174 op = OP_DB_UPDATE;
175 }
176 is_ok = sql_be->
do_db_operation(op, SCHEDXACTION_TABLE, GNC_SX_ID, pSx,
177 col_table);
179 if (op == OP_DB_INSERT || op == OP_DB_UPDATE)
180 {
182 }
183 else
184 {
185 gnc_sql_recurrence_delete (sql_be, guid);
186 }
187
188 if (is_ok)
189 {
190
191 if (op == OP_DB_INSERT || op == OP_DB_UPDATE)
192 {
193 is_ok = gnc_sql_slots_save (sql_be, guid, is_infant, inst);
194 }
195 else
196 {
197 is_ok = gnc_sql_slots_delete (sql_be, guid);
198 }
199 }
200
201 return is_ok;
202}
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.
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.
GList * gnc_sx_get_schedule(const SchedXaction *sx)