[prev] [thread] [next] [Date index for 2006/02/09]
This is a multi-part message in MIME format.
--===============0778212016==
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0359_01C62D9E.B5304500"
This is a multi-part message in MIME format.
------=_NextPart_000_0359_01C62D9E.B5304500
Content-Type: text/plain;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Greetings,
I've been using DBI for a long time and now I am quite excited to =
find CDBI. Then I started to convert my scripts by using CDBI.
but I am having some problems here which seems very weird to =
me:(platform is Windows + MSSQL)
package PDB::CustomerFieldTrackExt;
use strict;
use base 'PDB::DBI';
__PACKAGE__->table('CustomerFieldTrackExt');
__PACKAGE__->columns(All =3D> qw/ProjectID BugID Desc_Custom_2/);
1;
Table 'CustomerFieldTrackExt' has many fields, but there are only 3 =
columns useful as you see above.
#!/usr/bin/perl
use strict;
use PDB::CustomerFieldTrackExt;
my $dbh =3D PDB::CustomerFieldTrackExt->db_Main;=20
$dbh->trace(2);
my @objs =3D =
PDB::CustomerFieldTrackExt->retrieve(Desc_Custom_2=3D>"50846");
# I am not sure how to retrieve the datas with it.maybe following works.
foreach my $obj (@objs) {
print $obj->BugID,"\n";
}
>From the output I see the it excutes following sql:
SELECT projectid FROM CustomerFieldTrackExt WHERE =
desc_custom_2 =3D ?
1.. why bugid is not selected here? what if I only want to select =
bugid?
2.. what is more weird is if I reorder the columns in package =
PDB::CustomerFieldTrackExt; as following:
__PACKAGE__->columns(All =3D> qw/Desc_Custom_2 BugID =
ProjectID /);
=20
it will execute following sql:
SELECT bugid, projectid FROM CustomerFieldTrackExt =
WHERE desc_custom_2=3D?
=20
should this reorder cause executing different sql? It =
doesn't make any sense to me.:) could someone help to pick up some basic =
idea why CDBI do in this way?
Thanks
Alex
=20
------=_NextPart_000_0359_01C62D9E.B5304500
Content-Type: text/html;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dgb2312">
<META content=3D"MSHTML 6.00.2800.1528" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Greetings,</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2> I've =
been using=20
DBI for a long time and now I am quite excited to find CDBI. =
Then I=20
started to convert my scripts by using CDBI.</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>but I am having some =
problems here=20
which seems very weird to me:(platform is Windows + MSSQL)</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#800080 size=3D2>package=20
PDB::CustomerFieldTrackExt;<BR>use strict;<BR>use base =
'PDB::DBI';</FONT></DIV>
<DIV><FONT face=3DArial color=3D#800080 size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#800080=20
size=3D2>__PACKAGE__->table('CustomerFieldTrackExt');<BR>__PACKAGE__-&=
gt;columns(All=20
=3D> qw/ProjectID BugID Desc_Custom_2/);</FONT></DIV>
<DIV><FONT face=3DArial color=3D#800080 size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#800080 size=3D2>1;</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Table =
'CustomerFieldTrackExt' has=20
many fields, but there are only 3 columns useful as you see=20
above.</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#800080 size=3D2>#!/usr/bin/perl<BR>use =
strict;<BR>use=20
PDB::CustomerFieldTrackExt;<BR>my $dbh =3D =
PDB::CustomerFieldTrackExt->db_Main;=20
<BR>$dbh->trace(2);<BR>my @objs =3D=20
PDB::CustomerFieldTrackExt->retrieve(Desc_Custom_2=3D>"50846");</FO=
NT></DIV>
<DIV><FONT face=3DArial color=3D#800080 size=3D2># I am not sure how to =
retrieve the=20
datas with it.maybe following works.<BR>foreach my $obj (@objs)=20
{<BR> print $obj->BugID,"\n";<BR>}</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>From the output I see =
the it excutes=20
following sql:</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff=20
size=3D2> SELECT projectid=20
FROM CustomerFieldTrackExt WHERE desc_custom_2 =3D=20
?</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV>
<OL>
<LI><FONT face=3DArial color=3D#0000ff size=3D2>why bugid is not =
selected here? what=20
if I only want to select bugid?</FONT></LI>
<LI><FONT face=3DArial color=3D#0000ff size=3D2>what is more weird is =
if I reorder=20
the columns in package PDB::CustomerFieldTrackExt; as=20
following:</FONT></LI></OL>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2> =
=20
__PACKAGE__->columns(All =
=3D>=20
qw/Desc_Custom_2 BugID ProjectID =
/);</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff=20
size=3D2> &nbs=
p; </FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2> =
=20
it will execute following=20
sql:</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2> =
=20
SELECT bugid, projectid =
FROM =20
CustomerFieldTrackExt WHERE desc_custom_2=3D?</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2> =
</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff=20
size=3D2> &nbs=
p; should=20
this reorder cause executing different sql? It doesn't make any sense to =
me.:)=20
could someone help to pick up some basic idea why CDBI do in this=20
way?</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Alex</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2> =
</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT> </DIV></BODY></HTML>
------=_NextPart_000_0359_01C62D9E.B5304500--
--===============0778212016==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
--===============0778212016==--
|
[CDBI] Beginners problem
|
|
Re: [CDBI] Beginners problem
|
|
Re: [CDBI] Beginners problem
|
Generated at 23:19 on 12 Feb 2006 by mariachi v0.52