Re: DBI Driver.xst and DBD::cego

Tim Bunce <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <20130527151038.GC26228@adsl-172-10-1-108.dsl.sndg02.sbcglobal.net>
Hi Kurt.

On Sun, May 26, 2013 at 08:13:58PM +0200, Kurt Jaeger wrote:
> https://rt.cpan.org/Ticket/Display.html?id=84285

    error: invalid conversion from 'const char*' to 'char*'

I'm surprised the compiler treats this as an error, it's normally a warning.

-        char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? "" : "s";
+        char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? (char*)"" : (char*)"s";

> Can someone have a look at it ? Is that patch the right way to do it ?

It would be better to put the const on the declaration in this case.  I.e.:

-        char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? "" : "s";
+        const char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? "" : "s";

but that may trigger other errors/warnings in later code which will need
attending to. (Same goes for the other hunk in the patch.)

Could you give that a go?

Tim.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.