DBI Driver.xst and DBD::cego

Hi!

I try to maintain the FreeBSD port databases/p5-DBD-cego, and it
has a problem if I compile it with clang.

http://www.freebsd.org/cgi/query-pr.cgi?pr=178755

I investigated and I think it is caused by issues in DBI, more
exactly, issues in Driver.xst ? I made a first try on a fix in March,
and a second one today:

https://rt.cpan.org/Ticket/Display.html?id=84285

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

-- 
pi@opsec.eu            +49 171 3101372                         7 years to go !
0
dbi
5/26/2013 6:13:58 PM
perl.dbi.users 11064 articles. 1 followers. Follow

3 Replies
260 Views

Similar Articles

[PageSpeed] 44

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.
0
Tim
5/27/2013 3:10:38 PM
Hi!

Tim wrote:
> 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";

clang++ is more strict 8-}

> > 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?

Have you seen my second attempt ? It's going along the clang line
and seems much cleaner.

-- 
pi@opsec.eu            +49 171 3101372                         7 years to go !
0
dbi
5/27/2013 3:16:43 PM
--001a1133d324a9345604ddb72fbd
Content-Type: text/plain; charset=ISO-8859-1

Since the only place 'plural' is used is the statement immediately after
the assignment, it is much simpler and perfectly safe to use

const char *plural = ...

than to futz around with the myp array as in the second patch (or to cast
away constness as in the first patch).



On Mon, May 27, 2013 at 8:16 AM, Kurt Jaeger <dbi-users@opsec.eu> wrote:

> Hi!
>
> Tim wrote:
> > 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";
>
> clang++ is more strict 8-}
>
> > > 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?
>
> Have you seen my second attempt ? It's going along the clang line
> and seems much cleaner.
>
> --
> pi@opsec.eu            +49 171 3101372                         7 years to
> go !
>



-- 
Jonathan Leffler <jonathan.leffler@gmail.com>  #include <disclaimer.h>
Guardian of DBD::Informix - v2013.0521 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."

--001a1133d324a9345604ddb72fbd
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div>Since the only place &#39;plural&#39; is used is=
 the statement immediately after the assignment, it is much simpler and per=
fectly safe to use<br><br></div>const char *plural =3D ...<br><br></div>tha=
n to futz around with the myp array as in the second patch (or to cast away=
 constness as in the first patch).<br>

<br></div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On =
Mon, May 27, 2013 at 8:16 AM, Kurt Jaeger <span dir=3D"ltr">&lt;<a href=3D"=
mailto:dbi-users@opsec.eu" target=3D"_blank">dbi-users@opsec.eu</a>&gt;</sp=
an> wrote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">Hi!<br>
<div class=3D"im"><br>
Tim wrote:<br>
&gt; On Sun, May 26, 2013 at 08:13:58PM +0200, Kurt Jaeger wrote:<br>
&gt; &gt; <a href=3D"https://rt.cpan.org/Ticket/Display.html?id=3D84285" ta=
rget=3D"_blank">https://rt.cpan.org/Ticket/Display.html?id=3D84285</a><br>
&gt;<br>
&gt; =A0 =A0 error: invalid conversion from &#39;const char*&#39; to &#39;c=
har*&#39;<br>
&gt;<br>
&gt; I&#39;m surprised the compiler treats this as an error, it&#39;s norma=
lly a warning.<br>
<br>
&gt; - =A0 =A0 =A0 =A0char *plural =3D (DBIc_ACTIVE_KIDS(imp_dbh)=3D=3D1) ?=
 &quot;&quot; : &quot;s&quot;;<br>
&gt; + =A0 =A0 =A0 =A0char *plural =3D (DBIc_ACTIVE_KIDS(imp_dbh)=3D=3D1) ?=
 (char*)&quot;&quot; : (char*)&quot;s&quot;;<br>
<br>
</div>clang++ is more strict 8-}<br>
<div class=3D"im"><br>
&gt; &gt; Can someone have a look at it ? Is that patch the right way to do=
 it ?<br>
&gt;<br>
&gt; It would be better to put the const on the declaration in this case. =
=A0I.e.:<br>
&gt;<br>
&gt; - =A0 =A0 =A0 =A0char *plural =3D (DBIc_ACTIVE_KIDS(imp_dbh)=3D=3D1) ?=
 &quot;&quot; : &quot;s&quot;;<br>
&gt; + =A0 =A0 =A0 =A0const char *plural =3D (DBIc_ACTIVE_KIDS(imp_dbh)=3D=
=3D1) ? &quot;&quot; : &quot;s&quot;;<br>
&gt;<br>
&gt; but that may trigger other errors/warnings in later code which will ne=
ed<br>
&gt; attending to. (Same goes for the other hunk in the patch.)<br>
&gt;<br>
&gt; Could you give that a go?<br>
<br>
</div>Have you seen my second attempt ? It&#39;s going along the clang line=
<br>
and seems much cleaner.<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br>
--<br>
<a href=3D"mailto:pi@opsec.eu">pi@opsec.eu</a> =A0 =A0 =A0 =A0 =A0 =A0<a hr=
ef=3D"tel:%2B49%20171%203101372" value=3D"+491713101372">+49 171 3101372</a=
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 7 years to go !<br>
</div></div></blockquote></div><br><br clear=3D"all"><br>-- <br><div dir=3D=
"ltr">Jonathan Leffler &lt;<a href=3D"mailto:jonathan.leffler@gmail.com" ta=
rget=3D"_blank">jonathan.leffler@gmail.com</a>&gt;=A0 #include &lt;disclaim=
er.h&gt;<br>

Guardian of DBD::Informix - v2013.0521 - <a href=3D"http://dbi.perl.org" ta=
rget=3D"_blank">http://dbi.perl.org</a><br>&quot;Blessed are we who can lau=
gh at ourselves, for we shall never cease to be amused.&quot;</div>
</div>

--001a1133d324a9345604ddb72fbd--
0
jonathan
5/27/2013 6:18:45 PM
Reply:

Similar Artilces:

Patches for DBI v1.32
---559023410-851401618-1039913737=:6184 Content-Type: TEXT/PLAIN; charset=US-ASCII Dear Tim, Here's a new set of patches against the original DBI v1.32 for the files: Driver.xst dbd_xsh.h lib/DBI/DBD.pm The patches are gzipped. To apply them, use: gunzip DBI.patches.gz cd DBI-1.32 patch -p0 <../DBI.patches The DBD.pm file has undergone a whole lot more change -- it is, I think, in even better shape than the version shipped earlier. If you need them, I can redo the patches against that revised version of the file, but I'd rather no...

DBI w/ DBD:ODBC or DBI w/ DBD:mysql Which?
------=_NextPart_000_0009_01C1D022.ADFABA00 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I am new to Perl DBI programming But it is fairly simple.. I am using both Mysql 3.23.44nt and 3.23.43 Linux..as well as PostgreSQL 7.1 Linux and on WinXP on Cygwin. Perl on Linux was straight forward but the Perl on WIn is a bit = Different. I ran a simple script to insert records in a table as test and it worked = but I am unsure that the WinXP install of Perl and DBI is correct that is do I = have the=20 correct modules in place. ...

DBI w/ DBD:ODBC vs DBI w/ DBD:mysql
------=_NextPart_000_002D_01C1D002.8689BBD0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I am new to Perl DBI programming But it is fairly simple.. I am using both Mysql 3.23.44nt and 3.23.43 Linux..as well as PostgreSQL 7.1 Linux and on WinXP on Cygwin. Perl on Linux was straight forward but the Perl on WIn is a bit = Different. I ran a simple script to insert records in a table as test and it worked = but I am unsure that the WinXP install of Perl and DBI is correct that is do I = have the=20 correct modules in place. ...

Patch for DBI 1.34 Driver.xst
---559023410-851401618-1046978164=:26439 Content-Type: TEXT/PLAIN; charset=US-ASCII Hi, I've had multiple reports of problems compiling DBD::Informix 2003.03.* and 2003.04, on both Linux and Solaris, and the problem turns out to be in the DBI 1.34 code in Driver.xst for handling data_sources (which is still my fault - mostly). Newer versions of GCC (eg 3.2.1 - as found on my machine) are mostly C-99 compliant and accept variable declarations part way through a block of code; older versions of GCC (eg 2.9x) do not accept this, and neither do the Sun C Compilers. And the gener...

[perl5-dbi/DBI-Test] a2d1b2: create separate tests for DBI and DBI::Mock ...
----==_mimepart_51f946a54bb1b_2af891bd4c100430 Date: Wed, 31 Jul 2013 10:17:25 -0700 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-ID: <51f946a54c721_2af891bd4c100582@hookshot-fe3-pe1-prd.aws.github.net.mail> Branch: refs/heads/master Home: https://github.com/perl5-dbi/DBI-Test Commit: a2d1b22d134be0ca353e0f0b312fb14da24c798e https://github.com/perl5-dbi/DBI-Test/commit/a2d1b22d134be0ca353e0f0b312fb14da24c798e Author: Jens Rehsack <sno@netbsd.org> Date: 2013-07-31 (Wed, 31 Jul 2013) Changed ...

POSSIBLE BUG IN Win32 DBI INSTALL MODULE: DBI "prepare" no work FW: List 'dbi-users' closed to public posts
I have ActiveState Win32perl running. I installed fresh DBI, DBD, etc. from perl ppm.pl> prompt. But prepare( ) doesn't work (see below). perldoc DBI/DBD/DBI-FAQ are not useful since they assume it works. Any hints? Art www.mp3.com/ArthurSulit Classical Artist recently charted above Madonna -----Original Message----- From: Art Sulit [mailto:art@prs.net] Sent: Saturday, January 20, 2001 1:51 PM To: Webmaster@ActiveState.com Subject: POSSIBLE BUG IN YOUR DBI INSTALL MODULE: DBI "prepare" no work Hello, THERE IS A POSSIBLE BUG IN YOUR DBI INSTALL M...

[perl5-dbi/dbi]
----==_mimepart_515e8f3785207_523740c1306299e Date: Fri, 05 Apr 2013 01:45:43 -0700 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-ID: <515e8f3787c27_523740c13063084@hookshot-fe5-pe1-prd.aws.github.net.mail> Branch: refs/heads/trunk Home: https://github.com/perl5-dbi/dbi ----==_mimepart_515e8f3785207_523740c1306299e-- ...

DBD Oracle DBI driver
All, Does anyone know of a repository where I can find DBD::Oracle? I have = tried the ActiveState default repository but it reports it is not = available. Regards, Javier Moreno --------------060309040001010908050400 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 01/17/2005 12:04 PM, Moreno, Javier said: > Does anyone know of a repository where I can find DBD::Oracle? I have > tried the ActiveState default repository but it reports it is not > available. It would be worthwhile for you to read the responses sent...

[perl5-dbi/dbi] fc2ec2: add DBI::Test dependency
----==_mimepart_5169ac8ba2c2a_4a479bb1304466c Date: Sat, 13 Apr 2013 12:05:47 -0700 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-ID: <5169ac8ba5319_4a479bb13044782@hookshot-fe3-pe1-prd.aws.github.net.mail> Branch: refs/heads/dbi-test Home: https://github.com/perl5-dbi/dbi Commit: fc2ec21c76f2d70d504dfa53fa4766c477eb8ac5 https://github.com/perl5-dbi/dbi/commit/fc2ec21c76f2d70d504dfa53fa4766c477eb8ac5 Author: Jens Rehsack <sno@netbsd.org> Date: 2013-04-13 (Sat, 13 Apr 2013) Changed paths: ...

DBI use failure with DBI/DBD::Oracle on AIX 5.2
After being prepped by experiences of others in the README.aix file. I beleive (see below), I have a good installation. But on running my fist test prog I appear to have a permissions problem. This litlle ditty does not fail when run as root, but anyone else and it aborts on the 'use DBI;'. $ cat ora.pl #!/bin/perl -w use DBI; use strict; my ($dbname, $user, $passwd) = ('exua', 'remote', 'remote'); #$dbh = DBI->connect("dbi:Oracle:$dbname", $user, $passwd); #$dbh->do("SELECT * FROM DUAL"); $ $ ./ora.pl Can't lo...

[perl5-dbi/dbi] 33b922: The TYPE attribute should be NUMERIC, even in DBD:...
----==_mimepart_51f78db11b43e_274b649d58178538 Date: Tue, 30 Jul 2013 02:56:01 -0700 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-ID: <51f78db11beff_274b649d58178632@hookshot-fe2-pe1-prd.aws.github.net.mail> Branch: refs/heads/dir_search_hashes Home: https://github.com/perl5-dbi/dbi Commit: 33b92211c016edaf2c826b464018b9cdea3e3b46 https://github.com/perl5-dbi/dbi/commit/33b92211c016edaf2c826b464018b9cdea3e3b46 Author: H.Merijn Brand - Tux <h.m.brand@xs4all.nl> Date: 2013-07-30 (Tue, 30 Jul 2013)...

[perl5-dbi/dbi] a32d0b: Register neo_ prexfix for DBD::Neo4p.
----==_mimepart_52f88cfa92985_5474e79d349413e Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Branch: refs/heads/master Home: https://github.com/perl5-dbi/dbi Commit: a32d0b0a6307e427b7c667ec3ee0600fcb93be68 https://github.com/perl5-dbi/dbi/commit/a32d0b0a6307e427b7c667ec3ee0600fcb93be68 Author: Tim Bunce <Tim.Bunce@pobox.com> Date: 2014-02-10 (Mon, 10 Feb 2014) Changed paths: M DBI.pm Log Message: ----------- Register neo_ prexfix for DBD::Neo4p. ----==_mimepart_52f88cfa92985_5474e79d349413e-- ...

[perl5-dbi/dbi] 94c112: add class for driver without prefix warning
----==_mimepart_530ef04d87142_285befdd3c1179c9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Branch: refs/heads/master Home: https://github.com/perl5-dbi/dbi Commit: 94c1125e5c9234eaee43548dddbd83f7d8ef7dbd https://github.com/perl5-dbi/dbi/commit/94c1125e5c9234eaee43548dddbd83f7d8ef7dbd Author: Jens Rehsack <sno@netbsd.org> Date: 2014-02-26 (Wed, 26 Feb 2014) Changed paths: M lib/DBI/DBD/SqlEngine.pm M lib/DBI/DBD/SqlEngine/HowTo.pod Log Message: ----------- add class for driver without prefix warning ...

[perl5-dbi/dbi] 50d53f: add warning on unregistered driver (RT#93204)
----==_mimepart_530edf891a706_1f25dafd4014712 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Branch: refs/heads/master Home: https://github.com/perl5-dbi/dbi Commit: 50d53fbfdbb903bdd50e748376b3b62346d0afe2 https://github.com/perl5-dbi/dbi/commit/50d53fbfdbb903bdd50e748376b3b62346d0afe2 Author: Jens Rehsack <sno@netbsd.org> Date: 2014-02-26 (Wed, 26 Feb 2014) Changed paths: M lib/DBI/DBD/SqlEngine.pm Log Message: ----------- add warning on unregistered driver (RT#93204) ----==_mimepart_530edf891a706_1f25...

Web resources about - DBI Driver.xst and DBD::cego - perl.dbi.users

Resources last updated: 12/27/2015 6:36:00 PM