MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / edit

Function edit

src/yvalve/utl.cpp:281–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279
280
281FB_BOOLEAN edit(CheckStatusWrapper* status, ISC_QUAD* blob_id, IAttachment* att, ITransaction* tra,
282 int type, const char* field_name)
283{
284/**************************************
285 *
286 * e d i t
287 *
288 **************************************
289 *
290 * Functional description
291 * Open a blob, dump it to a file, allow the user to edit the
292 * window, and dump the data back into a blob. If the user
293 * bails out, return FALSE, otherwise return TRUE.
294 *
295 * If the field name coming in is too big, truncate it.
296 *
297 **************************************/
298#if (defined WIN_NT)
299 TEXT buffer[9];
300#else
301 TEXT buffer[25];
302#endif
303
304 const TEXT* q = field_name;
305 if (!q)
306 q = "gds_edit";
307
308 TEXT* p;
309 for (p = buffer; *q && p < buffer + sizeof(buffer) - 1; q++)
310 {
311 if (*q == '$')
312 *p++ = '_';
313 else
314 *p++ = LOWER7(*q);
315 }
316 *p = 0;
317
318 // Moved this out of #ifndef mpexl to get mktemp/mkstemp to work for Linux
319 // This has been done in the inprise tree some days ago.
320 // Would have saved me a lot of time, if I had seen this earlier :-(
321 // FSG 15.Oct.2000
322 PathName tmpf = TempFile::create(status, buffer);
323 if (status->getState() & Firebird::IStatus::STATE_ERRORS)
324 return FB_FALSE;
325
326 FILE* file = os_utils::fopen(tmpf.c_str(), FOPEN_WRITE_TYPE_TEXT);
327 if (!file)
328 {
329 unlink(tmpf.c_str());
330 system_error::raise("fopen");
331 }
332
333 dump(status, blob_id, att, tra, file);
334
335 if (status->getState() & IStatus::STATE_ERRORS)
336 {
337 isc_print_status(status->getErrors());
338 fclose(file);

Callers 1

API_ROUTINE BLOB_editFunction · 0.85

Calls 10

createFunction · 0.85
raiseFunction · 0.85
fcloseFunction · 0.85
dumpFunction · 0.70
loadFunction · 0.70
fopenFunction · 0.50
unlinkFunction · 0.50
getStateMethod · 0.45
c_strMethod · 0.45
getErrorsMethod · 0.45

Tested by

no test coverage detected