I'm currently trying to use Pg.pir for a database backend in Rakudo, and
since it doesn't offer access to any error message, I thought I'd
extend it (see attached patch).
Unfortunately that breaks test 13 of t/library/pg.t, just as described
here: http://trac.parrot.org/parrot/ticket/1611
It seems totally unrelated. I add a method, never call it, and a test
fails. Why?
I'd be grateful for any explanation, or suggestion on how to proceed here.
Cheers,
Moritz
diff --git a/runtime/parrot/library/Pg.pir b/runtime/parrot/library/Pg.pir
index 30f6631..00159ad 100644
--- a/runtime/parrot/library/Pg.pir
+++ b/runtime/parrot/library/Pg.pir
@@ -170,6 +170,24 @@ thereafter and inaccessible then.
setattribute self, 'con', con
.end
+=item con.'last_error'()
+
+Returns a boxed string containing the last error message that any
+of the other methods might have produced.
+
+=cut
+
+.sub 'last_error' :method
+ .local pmc con, lasterr
+ con = getattribute self, 'con'
+ lasterr = get_root_global ['parrot';'Pg'], 'PQerrorMessage'
+ $S0 = lasterr(con)
+ $P0 = new 'String'
+ $P0 = $S0
+ .return ($P0)
+.end
+
+
=item res = con.'exec'(str)
Execute the SQL command and return a Pg;Result object.
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev