No problems.Finally, after 3 more weeks...
Yes... hmm, but how to I make this?Can you dig deeper into the UncachedGetColumns procedure?
Moderators: gto, EgonHugeist, olehs
No problems.Finally, after 3 more weeks...
Yes... hmm, but how to I make this?Can you dig deeper into the UncachedGetColumns procedure?
Code: Select all
procedure TZInterbase6PreparedStatement.Prepare;
begin
if SQL = '' then // <----- I inserted this verification
exit;
LogPrepStmtMessage(lcPrepStmt, SQL);
StmtHandle := nil;
with FIBConnection do
begin
StatementType := ZDbcInterbase6Utils.PrepareStatement(GetPlainDriver,
GetDBHandle, GetTrHandle, GetDialect, SQL, StmtHandle);
if StatementType in [stSelect, stExecProc] then
begin
SQLData := TZResultSQLDA.Create(GetPlainDriver, GetDBHandle, GetTrHandle);
PrepareResultSqlData(GetPlainDriver, GetDBHandle, GetDialect,
SQL, StmtHandle, SQLData);
end;
end;
CheckInterbase6Error(SQL);
// LogPrepStmtMessage(lcPrepStmt, SQL);
inherited Prepare;
end;
dopidaniel,This changes doesn't have side effects in the test suite.
BUT... it would be better to set a breakpoint on the exist statement an see when this code is effectively used. An emptty statement should NEVER be prepared. So why is it done?
Code: Select all
TZGenericCachedResolver.PostUpdates
.......
utModified:
begin
SQL: = FormUpdateStatement (SQLParams, OldRowAccessor, NewRowAccessor);
If SQL =''then // <---- here
exit;
If Assigned (UpdateStatement) and (SQL <> UpdateStatement.GetSQL) then
UpdateStatement: = nil;
If not Assigned (UpdateStatement) then
UpdateStatement: = CreateResolverStatement (SQL);
Statement: = UpdateStatement;
end;
....
Code: Select all
function TZGenericCachedResolver.FormUpdateStatement(Columns: TObjectList;
OldRowAccessor, NewRowAccessor: TZRowAccessor): string;
var
I: Integer;
Current: TZResolverParameter;
TableName: string;
Temp: string;
begin
TableName := DefineTableName;
DefineUpdateColumns(Columns, OldRowAccessor, NewRowAccessor);
if Columns.Count = 0 then
begin
Result := '';
Exit;
end;
Temp := '';
for I := 0 to Columns.Count - 1 do
begin
Current := TZResolverParameter(Columns[I]);
if Temp <> '' then
Temp := Temp + ',';
Temp := Temp + IdentifierConvertor.Quote(Current.ColumnName) + '=?';
end;
Result := Format('UPDATE %s SET %s', [TableName, Temp]);
DefineWhereKeyColumns(Columns);
Result := Result + FormWhereClause(Columns, OldRowAccessor);
end;