265 |
|
function StateChanged(var ChangeSeqNo: integer): boolean; virtual; abstract; |
266 |
|
property CaseSensitiveParams: boolean read FCaseSensitiveParams |
267 |
|
write FCaseSensitiveParams; {Only used when IsInputDataArea true} |
268 |
+ |
function CanChangeMetaData: boolean; virtual; abstract; |
269 |
|
property Count: integer read GetCount; |
270 |
|
property Column[index: integer]: TSQLVarData read GetColumn; |
271 |
|
property UniqueRelationName: AnsiString read FUniqueRelationName; |
287 |
|
function GetStatement: IStatement; |
288 |
|
procedure SetName(AValue: AnsiString); |
289 |
|
protected |
290 |
+ |
function GetAttachment: IAttachment; virtual; abstract; |
291 |
|
function GetSQLType: cardinal; virtual; abstract; |
292 |
|
function GetSubtype: integer; virtual; abstract; |
293 |
|
function GetAliasName: AnsiString; virtual; abstract; |
303 |
|
function GetSQLData: PByte; virtual; abstract; |
304 |
|
function GetDataLength: cardinal; virtual; abstract; {current field length} |
305 |
|
function GetSize: cardinal; virtual; abstract; {field length as given by metadata} |
306 |
+ |
function GetDefaultTextSQLType: cardinal; virtual; abstract; |
307 |
|
procedure SetIsNull(Value: Boolean); virtual; abstract; |
308 |
|
procedure SetIsNullable(Value: Boolean); virtual; abstract; |
309 |
|
procedure SetSQLData(AValue: PByte; len: cardinal); virtual; abstract; |
311 |
|
procedure SetDataLength(len: cardinal); virtual; abstract; |
312 |
|
procedure SetSQLType(aValue: cardinal); virtual; abstract; |
313 |
|
procedure SetCharSetID(aValue: cardinal); virtual; abstract; |
314 |
+ |
procedure SetMetaSize(aValue: cardinal); virtual; |
315 |
|
public |
316 |
|
constructor Create(aParent: TSQLDataArea; aIndex: integer); |
317 |
|
procedure SetString(aValue: AnsiString); |
425 |
|
procedure Clear; |
426 |
|
function GetModified: boolean; override; |
427 |
|
function GetAsPointer: Pointer; |
428 |
+ |
function GetAsString: AnsiString; override; |
429 |
|
procedure SetName(Value: AnsiString); override; |
430 |
|
procedure SetIsNull(Value: Boolean); override; |
431 |
|
procedure SetIsNullable(Value: Boolean); override; |
674 |
|
FName := AValue; |
675 |
|
end; |
676 |
|
|
677 |
+ |
procedure TSQLVarData.SetMetaSize(aValue: cardinal); |
678 |
+ |
begin |
679 |
+ |
//Ignore |
680 |
+ |
end; |
681 |
+ |
|
682 |
|
constructor TSQLVarData.Create(aParent: TSQLDataArea; aIndex: integer); |
683 |
|
begin |
684 |
|
inherited Create; |
695 |
|
a zero byte when the string is empty, neatly avoiding a nil pointer error.} |
696 |
|
|
697 |
|
FVarString := aValue; |
698 |
< |
SQLType := SQL_TEXT; |
698 |
> |
if SQLType = SQL_BLOB then |
699 |
> |
SetMetaSize(GetAttachment.GetInlineBlobLimit); |
700 |
> |
SQLType := GetDefaultTextSQLType; |
701 |
|
Scale := 0; |
702 |
|
SetSQLData(PByte(PAnsiChar(FVarString)),Length(aValue)); |
703 |
|
end; |
1156 |
|
result := AdjustScaleToCurrency(PInt64(SQLData)^, |
1157 |
|
Scale); |
1158 |
|
SQL_DOUBLE, SQL_FLOAT, SQL_D_FLOAT: |
1159 |
< |
result := Trunc(AsDouble); |
1159 |
> |
result := Round(AsDouble); |
1160 |
|
|
1161 |
|
SQL_DEC_FIXED, |
1162 |
|
SQL_DEC16, |
1194 |
|
result := AdjustScaleToInt64(PInt64(SQLData)^, |
1195 |
|
Scale); |
1196 |
|
SQL_DOUBLE, SQL_FLOAT, SQL_D_FLOAT: |
1197 |
< |
result := Trunc(AsDouble); |
1197 |
> |
result := Round(AsDouble); |
1198 |
|
else |
1199 |
|
IBError(ibxeInvalidDataConversion, [nil]); |
1200 |
|
end; |
1373 |
|
end; |
1374 |
|
end; |
1375 |
|
SQL_SHORT: |
1376 |
< |
result := Trunc(AdjustScale(Int64(PShort(SQLData)^), |
1376 |
> |
result := Round(AdjustScale(Int64(PShort(SQLData)^), |
1377 |
|
Scale)); |
1378 |
|
SQL_LONG: |
1379 |
< |
result := Trunc(AdjustScale(Int64(PLong(SQLData)^), |
1379 |
> |
result := Round(AdjustScale(Int64(PLong(SQLData)^), |
1380 |
|
Scale)); |
1381 |
|
SQL_INT64: |
1382 |
< |
result := Trunc(AdjustScale(PInt64(SQLData)^, Scale)); |
1382 |
> |
result := Round(AdjustScale(PInt64(SQLData)^, Scale)); |
1383 |
|
SQL_DOUBLE, SQL_FLOAT, SQL_D_FLOAT: |
1384 |
< |
result := Trunc(AsDouble); |
1384 |
> |
result := Round(AsDouble); |
1385 |
|
SQL_DEC_FIXED, |
1386 |
|
SQL_DEC16, |
1387 |
|
SQL_DEC34, |
2349 |
|
IBError(ibxeInvalidDataConversion,[nil]); |
2350 |
|
|
2351 |
|
SQL_BLOB: |
2352 |
+ |
if Length(Value) < GetAttachment.GetInlineBlobLimit then |
2353 |
+ |
DoSetString |
2354 |
+ |
else |
2355 |
|
begin |
2356 |
|
Changing; |
2357 |
|
b := FIBXSQLVAR.CreateBlob; |
2417 |
|
SetAsBCD(StrToBCD(Value)); |
2418 |
|
|
2419 |
|
else |
2420 |
< |
IBError(ibxeInvalidDataConversion,[nil]); |
2420 |
> |
IBError(ibxeInvalidDataConversion,[GetSQLTypeName(SQLType)]); |
2421 |
|
end; |
2422 |
|
end; |
2423 |
|
|
2468 |
|
Result := inherited GetAsPointer; |
2469 |
|
end; |
2470 |
|
|
2471 |
+ |
function TSQLParam.GetAsString: AnsiString; |
2472 |
+ |
var rs: RawByteString; |
2473 |
+ |
begin |
2474 |
+ |
Result := ''; |
2475 |
+ |
if (SQLType = SQL_VARYING) and not IsNull then |
2476 |
+ |
{SQLData points to start of string - default is to length word} |
2477 |
+ |
begin |
2478 |
+ |
CheckActive; |
2479 |
+ |
SetString(rs,PAnsiChar(SQLData),DataLength); |
2480 |
+ |
SetCodePage(rs,GetCodePage,false); |
2481 |
+ |
Result := rs; |
2482 |
+ |
end |
2483 |
+ |
else |
2484 |
+ |
Result := inherited GetAsString; |
2485 |
+ |
end; |
2486 |
+ |
|
2487 |
|
procedure TSQLParam.SetName(Value: AnsiString); |
2488 |
|
begin |
2489 |
|
CheckActive; |