RowsAffected: wrong return values with TUniSQL AND TUniQuery?
Posted: Fri 21 Feb 2014 18:54
hi,
I´m having troubles counting the affected rows of a simple SQL-statement.
while in ADODB one only has to call ADODBConn.Execute(sql, iAff), and basta
this seems to be a real problem with UniDAC...
- TUniConnection: cant do it at all! (you really should implement that
)
- TUniSQL.RowsAffected: 0 (instead of 2)
- TUniQuery.RowsAffected: -1 (instead of 2)
so I tried both UniSQL and UniQuery - BOTH deliver wrong (and different) values?!?
debugging with dbMonitor-SQL-Pane shows the correct row-count!!
-----------------------------------------
UniDAC Version: 5.2.6, Delphi7
Server: MSSQL 2008RS2 (10.50.2500.0)
---------------------------
Delphi Code:
sSQL := 'UPDATE TestProject SET testZeit = GETDATE(), testMinuten = testMinuten + 1';
UniSQL := TUniQuery.Create(nil);
with UniSQL do begin
Connection := UniConn;
SQL.Text := sSQL;
end;
iAff := UniSQL.RowsAffected; result: -1, correct: 2
UniSQL.Free;
---------------------------------------------------
this is the table-definition, in case u want to reproduce
---------------------------------------------------
CREATE TABLE [TestProject](
[testID] [int] NOT NULL,
[testText] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
[testDatum] [datetime] NULL,
[testZeit] [time](0) NULL,
[testMinuten] [int] NULL,
[testAdded] [smalldatetime] NOT NULL,
CONSTRAINT [PK_TestProject] PRIMARY KEY CLUSTERED
([testID] ASC) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]
GO
ALTER TABLE [TestProject] ADD CONSTRAINT [DF_TestProject_testAdded] DEFAULT (getdate()) FOR [testAdded]
GO
I´m having troubles counting the affected rows of a simple SQL-statement.
while in ADODB one only has to call ADODBConn.Execute(sql, iAff), and basta
this seems to be a real problem with UniDAC...
- TUniConnection: cant do it at all! (you really should implement that
- TUniSQL.RowsAffected: 0 (instead of 2)
- TUniQuery.RowsAffected: -1 (instead of 2)
so I tried both UniSQL and UniQuery - BOTH deliver wrong (and different) values?!?
debugging with dbMonitor-SQL-Pane shows the correct row-count!!
-----------------------------------------
UniDAC Version: 5.2.6, Delphi7
Server: MSSQL 2008RS2 (10.50.2500.0)
---------------------------
Delphi Code:
sSQL := 'UPDATE TestProject SET testZeit = GETDATE(), testMinuten = testMinuten + 1';
UniSQL := TUniQuery.Create(nil);
with UniSQL do begin
Connection := UniConn;
SQL.Text := sSQL;
end;
iAff := UniSQL.RowsAffected; result: -1, correct: 2
UniSQL.Free;
---------------------------------------------------
this is the table-definition, in case u want to reproduce
---------------------------------------------------
CREATE TABLE [TestProject](
[testID] [int] NOT NULL,
[testText] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
[testDatum] [datetime] NULL,
[testZeit] [time](0) NULL,
[testMinuten] [int] NULL,
[testAdded] [smalldatetime] NOT NULL,
CONSTRAINT [PK_TestProject] PRIMARY KEY CLUSTERED
([testID] ASC) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]
GO
ALTER TABLE [TestProject] ADD CONSTRAINT [DF_TestProject_testAdded] DEFAULT (getdate()) FOR [testAdded]
GO