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

Method SetBuffer

storage/connect/tabext.cpp:771–812  ·  view source on GitHub ↗

/ SetBuffer: prepare a column block for write operation. */ /

Source from the content-addressed store, hash-verified

769/* SetBuffer: prepare a column block for write operation. */
770/***********************************************************************/
771bool EXTCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check)
772{
773 if (!(To_Val = value)) {
774 snprintf(g->Message, sizeof(g->Message), MSG(VALUE_ERROR), Name);
775 return true;
776 } else if (Buf_Type == value->GetType()) {
777 // Values are of the (good) column type
778 if (Buf_Type == TYPE_DATE) {
779 // If any of the date values is formatted
780 // output format must be set for the receiving table
781 if (GetDomain() || ((DTVAL *)value)->IsFormatted())
782 goto newval; // This will make a new value;
783
784 } else if (Buf_Type == TYPE_DOUBLE)
785 // Float values must be written with the correct (column) precision
786 // Note: maybe this should be forced by ShowValue instead of this ?
787 value->SetPrec(GetScale());
788
789 Value = value; // Directly access the external value
790 } else {
791 // Values are not of the (good) column type
792 if (check) {
793 snprintf(g->Message, sizeof(g->Message), MSG(TYPE_VALUE_ERR), Name,
794 GetTypeName(Buf_Type), GetTypeName(value->GetType()));
795 return true;
796 } // endif check
797
798 newval:
799 if (InitValue(g)) // Allocate the matching value block
800 return true;
801
802 } // endif's Value, Buf_Type
803
804 // Because Colblk's have been made from a copy of the original TDB in
805 // case of Update, we must reset them to point to the original one.
806 if (To_Tdb->GetOrig())
807 To_Tdb = (PTDB)To_Tdb->GetOrig();
808
809 // Set the Column
810 Status = (ok) ? BUF_EMPTY : BUF_NO;
811 return false;
812} // end of SetBuffer
813

Callers

nothing calls this directly

Calls 5

GetDomainFunction · 0.85
GetTypeNameFunction · 0.85
GetScaleFunction · 0.70
GetTypeMethod · 0.45
SetPrecMethod · 0.45

Tested by

no test coverage detected