--- ibx/trunk/fbintf/client/3.0/FB30Statement.pas 2016/12/06 10:33:46 46 +++ ibx/trunk/fbintf/client/3.0/FB30Statement.pas 2017/01/09 15:31:51 47 @@ -267,7 +267,10 @@ end; implementation -uses IBUtils, FBMessages, FB30Blob, variants, FBArray, FB30Array; +uses IBUtils, FBMessages, FBBLob, FB30Blob, variants, FBArray, FB30Array; + +const + ISQL_COUNTERS = 'CurrentMemory, MaxMemory, RealTime, UserTime, Buffers, Reads, Writes, Fetches'; { TIBXSQLVAR } @@ -388,6 +391,7 @@ begin FStatement.GetTransaction as TFB30Transaction, GetRelationName,GetFieldName, GetSubType); + (FBlobMetaData as TFBBlobMetaData).SetCharSetID(GetCharSetID); Result := FBlobMetaData; end; @@ -401,6 +405,7 @@ begin else if IsNullable then FNullIndicator := 0; + Changed; end; procedure TIBXSQLVAR.SetIsNullable(Value: Boolean); @@ -647,7 +652,10 @@ begin for i := 0 to Count - 1 do with TIBXSQLVar(Column[i]) do begin - Move(FSQLData^,(FMessageBuffer + FCurMetaData.getOffset(StatusIntf,i))^,FDataLength); + if IsNull then + FillChar((FMessageBuffer + FCurMetaData.getOffset(StatusIntf,i))^,FDataLength,0) + else + Move(FSQLData^,(FMessageBuffer + FCurMetaData.getOffset(StatusIntf,i))^,FDataLength); Check4DataBaseError; if IsNullable then begin @@ -712,9 +720,8 @@ begin else IBAlloc(FSQLData, 0, FDataLength) end; - SQL_VARYING: begin + SQL_VARYING: IBAlloc(FSQLData, 0, FDataLength + 2); - end; else IBError(ibxeUnknownSQLDataType, [sqltype and (not 1)]) end; @@ -1066,31 +1073,49 @@ begin try with Firebird30ClientAPI do - case FSQLStatementType of - SQLSelect: - IBError(ibxeIsAExecuteProcedure,[]); - - SQLExecProcedure: begin - FStatementIntf.execute(StatusIntf, - (aTransaction as TFB30Transaction).TransactionIntf, - FSQLParams.MetaData, - FSQLParams.MessageBuffer, - FSQLRecord.MetaData, - FSQLRecord.MessageBuffer); - Check4DataBaseError; + if FCollectStatistics then + begin + UtilIntf.getPerfCounters(StatusIntf, + (GetAttachment as TFB30Attachment).AttachmentIntf, + ISQL_COUNTERS,@FBeforeStats); + Check4DataBaseError; + end; - Result := TResults.Create(FSQLRecord); - FSingleResults := true; - end - else - FStatementIntf.execute(StatusIntf, - (aTransaction as TFB30Transaction).TransactionIntf, - FSQLParams.MetaData, - FSQLParams.MessageBuffer, - nil, - nil); - Check4DataBaseError; + case FSQLStatementType of + SQLSelect: + IBError(ibxeIsAExecuteProcedure,[]); + + SQLExecProcedure: + begin + FStatementIntf.execute(StatusIntf, + (aTransaction as TFB30Transaction).TransactionIntf, + FSQLParams.MetaData, + FSQLParams.MessageBuffer, + FSQLRecord.MetaData, + FSQLRecord.MessageBuffer); + Check4DataBaseError; + + Result := TResults.Create(FSQLRecord); + FSingleResults := true; + end + else + FStatementIntf.execute(StatusIntf, + (aTransaction as TFB30Transaction).TransactionIntf, + FSQLParams.MetaData, + FSQLParams.MessageBuffer, + nil, + nil); + Check4DataBaseError; + end; + if FCollectStatistics then + begin + UtilIntf.getPerfCounters(StatusIntf, + (GetAttachment as TFB30Attachment).AttachmentIntf, + ISQL_COUNTERS, @FAfterStats); + Check4DataBaseError; + FStatisticsAvailable := true; + end; end; finally if aTransaction <> FTransactionIntf then @@ -1118,6 +1143,14 @@ begin with Firebird30ClientAPI do begin + if FCollectStatistics then + begin + UtilIntf.getPerfCounters(StatusIntf, + (GetAttachment as TFB30Attachment).AttachmentIntf, + ISQL_COUNTERS, @FBeforeStats); + Check4DataBaseError; + end; + FResultSet := FStatementIntf.openCursor(StatusIntf, (aTransaction as TFB30Transaction).TransactionIntf, FSQLParams.MetaData, @@ -1125,6 +1158,15 @@ begin FSQLRecord.MetaData, 0); Check4DataBaseError; + + if FCollectStatistics then + begin + UtilIntf.getPerfCounters(StatusIntf, + (GetAttachment as TFB30Attachment).AttachmentIntf, + ISQL_COUNTERS,@FAfterStats); + Check4DataBaseError; + FStatisticsAvailable := true; + end; end; Inc(FCursorSeqNo); FSingleResults := false;