[MonetDB-users] rowcount in monetdb
Hello all,
Is there a way to take the number of rows affected by the last statement just like @@ROWCOUNT in SQL Server or SQL%ROWCOUNT in Oracle?
Thanks,
Vassilis
On 28-04-2011 20:23:53 +0300, Vassilis Papakonstantinou wrote:
Hello all,
Is there a way to take the number of rows affected by the last statement just like @@ROWCOUNT in SQL Server or SQL%ROWCOUNT in Oracle?
No, you can only get it if you retrieve it e.g. through JDBC or the corresponding mapi function. It is sent to the client as part of the answer, and only known at that time.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Op 28-04-11 21:57, Fabian Groffen schreef:
On 28-04-2011 20:23:53 +0300, Vassilis Papakonstantinou wrote:
Hello all,
Is there a way to take the number of rows affected by the last statement just like @@ROWCOUNT in SQL Server or SQL%ROWCOUNT in Oracle?
No, you can only get it if you retrieve it e.g. through JDBC or the corresponding mapi function. It is sent to the client as part of the answer, and only known at that time.
Can't we implement it like I did for lastid? I don't know how many products depend on it, but setting an environment variable after each query doesn't sound that difficult?
Stefan
On 29-04-2011 16:41:56 +0200, Stefan de Konink wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Op 28-04-11 21:57, Fabian Groffen schreef:
On 28-04-2011 20:23:53 +0300, Vassilis Papakonstantinou wrote:
Hello all,
Is there a way to take the number of rows affected by the last statement just like @@ROWCOUNT in SQL Server or SQL%ROWCOUNT in Oracle?
No, you can only get it if you retrieve it e.g. through JDBC or the corresponding mapi function. It is sent to the client as part of the answer, and only known at that time.
Can't we implement it like I did for lastid? I don't know how many products depend on it, but setting an environment variable after each query doesn't sound that difficult?
lastid is available only in the same way, or is there something more to it these days?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Op 29-04-11 16:47, Fabian Groffen schreef:
lastid is available only in the same way, or is there something more to it these days?
LastID was implemented as part of supporting PHPbb ODBC code.
http://bugs.monetdb.org/show_bug.cgi?id=2483
Most interesting... the top part of the patch is currently in the active codebase but the bottom part of the patch has been removed (never added?)
But anyway, now you know what I mean, I would say supporting the feature request, is under 10 lines of code.
Stefan
On 29-04-2011 16:59:38 +0200, Stefan de Konink wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Op 29-04-11 16:47, Fabian Groffen schreef:
lastid is available only in the same way, or is there something more to it these days?
LastID was implemented as part of supporting PHPbb ODBC code.
http://bugs.monetdb.org/show_bug.cgi?id=2483
Most interesting... the top part of the patch is currently in the active codebase but the bottom part of the patch has been removed (never added?)
But anyway, now you know what I mean, I would say supporting the feature request, is under 10 lines of code.
Odd. That patch doesn't look too well. last_id is returned to the client as part of the request that caused the sequence id to be generated. That is safe.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Op 29-04-11 17:06, Fabian Groffen schreef:
Odd. That patch doesn't look too well. last_id is returned to the client as part of the request that caused the sequence id to be generated. That is safe.
What about implementing it as a client side variable that is replaced before sending out a query back to the server? You could do that for the rowcount as well.
Stefan
On 29-04-2011 17:08:46 +0200, Stefan de Konink wrote:
Op 29-04-11 17:06, Fabian Groffen schreef:
Odd. That patch doesn't look too well. last_id is returned to the client as part of the request that caused the sequence id to be generated. That is safe.
What about implementing it as a client side variable that is replaced before sending out a query back to the server? You could do that for the rowcount as well.
I fail to see why one would want to make an extra query, while the information that query is supposed to retrieve is already available on the client.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Op 29-04-11 17:34, Fabian Groffen schreef:
I fail to see why one would want to make an extra query, while the information that query is supposed to retrieve is already available on the client.
So given that you execute a sql-script using mclient. How can one get the lastid or for example rowcount within an SQL statement? Variables such as mentioned in this thread and @@IDENTITY are part of other databases, what is the MonetDB alternative?
Stefan
participants (3)
-
Fabian Groffen
-
Stefan de Konink
-
Vassilis Papakonstantinou