RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TParam.GetDataSize Method

Returns the number of bytes needed to hold the parameter's value in the format used by the corresponding type of database field.

Pascal
function GetDataSize: Integer;
C++
__fastcall int GetDataSize();

Call GetDataSize to determine the number of bytes used to represent the parameter's value. GetDataSize indicates the buffer size needed before calling the GetData method. The value returned by GetDataSize depends on the Value of the parameter. For some values of DataType, this is always the same:

Value of DataSize 
ftBoolean  
2  
ftSmallint  
2  
ftWord  
2  
ftAutoInc  
4  
ftDate  
4  
ftInteger  
4  
ftTime  
4  
ftCurrency  
8  
ftDateTime  
8  
ftFloat  
8  
ftTimeStamp  
16  
ftBCD  
34  
ftString  
length of the string + 1  
ftFixedChar  
length of the string + 1  
ftVarBytes  
If the value is a Variant array, the number of elements in the array, else 0  
ftBytes  
If the value is a Variant array, the number of elements in the array, else 0  
ftBlob  
number of bytes of blob data  
ftFmtMemo  
number of bytes of blob data  
ftGraphic  
number of bytes of blob data  
ftMemo  
length of memo string + 1  
ftDBaseOle  
number of bytes of blob data  
ftParadoxOle  
number of bytes of blob data  
ftOraBlob  
number of bytes of blob data  
ftOraClob  
number of bytes of blob data  
ftTypedBinary  
number of bytes of data  
ftADT  
0  
ftArray  
0  
ftDataSet  
0  
ftReference  
0  
ftCursor  
0  
ftUnknown  
raises an EDatabaseError exception  

Note: The size returned by GetDataSize is the size required for the physical database representation of the Value. The field object that corresponds to that physical database field may store its data in another format requiring a different number of bytes.
 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!