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

Method ReadColumn

storage/connect/tabmysql.cpp:1392–1435  ·  view source on GitHub ↗

/ ReadColumn: */ /

Source from the content-addressed store, hash-verified

1390/* ReadColumn: */
1391/***********************************************************************/
1392void MYSQLCOL::ReadColumn(PGLOBAL g)
1393 {
1394 char *p, *buf, tim[20];
1395 int rc;
1396 PTDBMY tdbp = (PTDBMY)To_Tdb;
1397
1398 /*********************************************************************/
1399 /* If physical fetching of the line was deferred, do it now. */
1400 /*********************************************************************/
1401 if (!tdbp->Fetched)
1402 {
1403 if ((rc = tdbp->Myc.Fetch(g, tdbp->N)) != RC_OK) {
1404 if (rc == RC_EF)
1405 snprintf(g->Message, sizeof(g->Message), MSG(INV_DEF_READ), rc);
1406
1407 throw 11;
1408 } else
1409 tdbp->Fetched = true;
1410 }
1411 if ((buf = ((PTDBMY)To_Tdb)->Myc.GetCharField(Rank))) {
1412 if (trace(2))
1413 htrc("MySQL ReadColumn: name=%s buf=%s\n", Name, buf);
1414
1415 // TODO: have a true way to differenciate temporal values
1416 if (Buf_Type == TYPE_DATE && strlen(buf) == 8)
1417 // This is a TIME value
1418 p = strcat(strcpy(tim, "1970-01-01 "), buf);
1419 else
1420 p = buf;
1421
1422 if (Value->SetValue_char(p, strlen(p))) {
1423 snprintf(g->Message, sizeof(g->Message), "Out of range value for column %s at row %d",
1424 Name, tdbp->RowNumber(g));
1425 PushWarning(g, tdbp);
1426 } // endif SetValue_char
1427
1428 } else {
1429 if (Nullable)
1430 Value->SetNull(true);
1431
1432 Value->Reset(); // Null value
1433 } // endif buf
1434
1435 } // end of ReadColumn
1436
1437/***********************************************************************/
1438/* WriteColumn: make sure the bind buffer is updated. */

Callers

nothing calls this directly

Calls 10

PushWarningFunction · 0.85
GetCharFieldMethod · 0.80
SetValue_charMethod · 0.80
SetValue_pszMethod · 0.80
htrcFunction · 0.70
FetchMethod · 0.45
RowNumberMethod · 0.45
SetNullMethod · 0.45
ResetMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected