MCPcopy Create free account
hub / github.com/MariaDB/server / WriteColumn

Method WriteColumn

storage/connect/tabsys.cpp:490–544  ·  view source on GitHub ↗

/ WriteColumn: what this routine does is to access the last line */ read from the corresponding table, and rewrite the field */ corresponding to this column from the column buffer and type. */ /

Source from the content-addressed store, hash-verified

488/* corresponding to this column from the column buffer and type. */
489/***********************************************************************/
490void INICOL::WriteColumn(PGLOBAL g)
491 {
492 char *p;
493 bool rc;
494 PTDBINI tdbp = (PTDBINI)To_Tdb;
495
496 if (trace(2))
497 htrc("INI WriteColumn: col %s R%d coluse=%.4X status=%.4X\n",
498 Name, tdbp->GetTdb_No(), ColUse, Status);
499
500 /*********************************************************************/
501 /* Get the string representation of Value according to column type. */
502 /*********************************************************************/
503 if (Value != To_Val)
504 Value->SetValue_pval(To_Val, false); // Convert the updated value
505
506 // Null key are missing keys
507 if (Value->IsNull())
508 return;
509
510 p = Value->GetCharString(Valbuf);
511
512 if (strlen(p) > (unsigned)Long) {
513 snprintf(g->Message, sizeof(g->Message), MSG(VALUE_TOO_LONG), p, Name, Long);
514 throw 31;
515 } else if (Flag == 1) {
516 if (tdbp->Mode == MODE_UPDATE) {
517 snprintf(g->Message, sizeof(g->Message), MSG(NO_SEC_UPDATE));
518 throw 31;
519 } else if (*p) {
520 tdbp->Section = p;
521 } else
522 tdbp->Section = NULL;
523
524 return;
525 } else if (!tdbp->Section) {
526 snprintf(g->Message, sizeof(g->Message), MSG(SEC_NAME_FIRST));
527 throw 31;
528 } // endif's
529
530 /*********************************************************************/
531 /* Updating must be done only when not in checking pass. */
532 /*********************************************************************/
533 if (Status) {
534 rc = WritePrivateProfileString(tdbp->Section, Name, p, tdbp->Ifile);
535
536 if (!rc) {
537 snprintf(g->Message, sizeof(g->Message), "Error %d writing to %s",
538 GetLastError(), tdbp->Ifile);
539 throw 31;
540 } // endif rc
541
542 } // endif Status
543
544 } // end of WriteColumn
545
546/* ------------------------------------------------------------------- */
547

Callers

nothing calls this directly

Calls 6

GetLastErrorFunction · 0.85
SetValue_pvalMethod · 0.80
htrcFunction · 0.70
IsNullMethod · 0.45
GetCharStringMethod · 0.45

Tested by

no test coverage detected