[postmodern-devel] WITH-SAVEPOINT macro
WITH-SAVEPOINT macro is modelled after WITH-TRANSACTION. I would be glad to see it in 1.05 :) -- Ivan Boldyrev Assembly of a Japanese bicycle requires greatest peace of spirit.
WITH-SAVEPOINT macro is modelled after WITH-TRANSACTION. I would be glad to see it in 1.05 :)
Looks good. Is it intentional that the savepoint is rolled back after its body finishes, unless the body explicitly released/committed the savepoint? Also, inheriting from transaction-handle means that abort-transaction and commit-transaction are also valid on savepoints. Does this make sense, or should we just create a whole new class for savepoints? Cheers, Marijn
On 10075 day of my life Marijn Haverbeke wrote:
Looks good. Is it intentional that the savepoint is rolled back after its body finishes, unless the body explicitly released/committed the savepoint?
Sorry, this is a last-minute-introduced bug. Swap release-savepoint and rollback-savepoint in with-savepoint definition.
Also, inheriting from transaction-handle means that abort-transaction and commit-transaction are also valid on savepoints. Does this make sense, ...?
No. I subclassed transaction-handle just for code writing speed. If you think it is important, make savepoint-handle an independent class. -- Ivan Boldyrev Assembly of a Japanese bicycle requires greatest peace of spirit.
Okay, I think I fixed the code, and I added documentation. Could you see whether the current version works for you? If so, I will release it as a new version. Cheers, Marijn
On 10075 day of my life Marijn Haverbeke wrote:
Okay, I think I fixed the code, and I added documentation. Could you see whether the current version works for you? If so, I will release it as a new version.
My code seems to work fine with new version. But wait a minute. :) CL-USER> (postmodern:query (:select "\\'")) WARNING: Postgres warning: nonstandard use of \\ in a string literal Use the escape string syntax for backslashes, e.g., E'\\'. (("\\'")) SQL-IZE escapes #\' and #\\, however PosgreSQL (unlike MySQL) doesn't like \ in ordinary string, but have special E'...' syntax. Of course, warnings can be just ignored, and I can also supress this warning with setting standard_conforming_strings off, but isn't it better to output all string literals with E'...' syntax? Just add one letter :) -- Ivan Boldyrev Perl is a language where 2 x 2 is not equal to 4.
My code seems to work fine with new version.
Great, I will consider it functional then.
SQL-IZE escapes #\' and #\\, however PosgreSQL (unlike MySQL) doesn't like \ in ordinary string, but have special E'...' syntax. Of course, warnings can be just ignored, and I can also supress this warning with setting standard_conforming_strings off, but isn't it better to output all string literals with E'...' syntax? Just add one letter :)
Done. I also added a *standard-sql-strings* variable which can be used to configure S-SQL to just use standard strings. It would have been nicer if this could just be derived directly from the connection, but at the moment S-SQL does not have a concept of connections, and that is kind of convenient, so if you really want to use standard strings you'll just have to change this parameter. Cheers, Marijn
participants (2)
-
Ivan Boldyrev
-
Marijn Haverbeke