[Solar-talk] Collection Oddity
Raymond Kolbe
rkolbe at gmail.com
Wed Jan 30 07:50:29 CST 2008
I am not sure what is going on. In one of my models I created the table in
MySQL and did not specify the table layout in _setup at all...only the table
name.
I have also worked with changing my PK after creating the table and Solar
was OK with the change.
What version of Solar are you using?
On Jan 30, 2008 7:29 AM, Kilbride, James P. <James.Kilbride at gd-ais.com>
wrote:
> So, one of my developers looked into this a little more. If we specify
> the primary key after the table is created or specify it not with the column
> name solar gives us that error. IF you set the primary key on the column
> during the initial table creation on the same line as the column solar gets
> it fine. Any ideas on whether mysql describes the table differently based on
> when the primary key is defined? I noticed that the key, when you run desc
> table shows up as PRI instead of P, if that makes a difference.
>
> James Kilbride
>
> ------------------------------
> *From:* solar-talk-bounces at lists.solarphp.com [mailto:
> solar-talk-bounces at lists.solarphp.com] *On Behalf Of *Kilbride, James P.
> *Sent:* Wednesday, January 30, 2008 7:13 AM
> *To:* solar-talk at lists.solarphp.com
> *Subject:* RE: [Solar-talk] Collection Oddity
>
> It did not. I had tried that and still got it which seemed rather odd,
> unless solar was somehow missing the fact that I had set it as primary.
>
> ------------------------------
> *From:* solar-talk-bounces at lists.solarphp.com [mailto:
> solar-talk-bounces at lists.solarphp.com] *On Behalf Of *Raymond Kolbe
> *Sent:* Tuesday, January 29, 2008 11:31 PM
> *To:* solar-talk at lists.solarphp.com
> *Subject:* Re: [Solar-talk] Collection Oddity
>
> I do believe that is why it is dying (no PK). When you specify the cols in
> _setup() in the model, you are only really specifying the cols that Solar
> should create ONLY if the table does not exist. If the table does exist,
> Solar pulls all the MySQL table info into it and uses that.
>
> Try just setting a PK in your MySQL table and see if that fixes your
> problem. I am not sure why you would not have a PK in your table anyways. If
> User_Prog_ID is not unique, create an ID col that auto inc.
>
> Also, do not make a compound PK since I do not think Solar supports it at
> all. I have tried this and it fails....keep it simple ;-)
>
> Let me know if that works.
>
> Thanks,
> Raymond Kolbe
>
> On Jan 29, 2008 9:31 AM, Kilbride, James P. <James.Kilbride at gd-ais.com>
> wrote:
>
> > Hey folks,
> >
> > One of my guys was playing around with mysql tables and had the
> > following table definition:
> >
> > CREATE TABLE `citis`.`Log` (
> > `User_Prog_ID` int(10) NULL,
> > `Event_Date` date NOT NULL,
> > `Event_Desc` TEXT NOT NULL
> > ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
> >
> > When I tried to use it as part of a model i can get it to the point
> > where it does an insert but the fetchAll seems to be dying when I try to
> > print out data with the following error:
> >
> > *Notice*: Undefined index: User_Prog_ID in*
> > C:\Solar\Solar\Sql\Model\Collection.php* on line* 62*
> >
> > Now the line in question is:
> >
> > $primary = $load[$this->_model->primary_col];
> >
> > Note that the table as defined, does not have a primary key. Is this
> > what is causing the model to fail? If so then why, after manually setting it
> > to use the id key as a primary column the system still fails on that line
> > though. Any ideas folks? Desc Log returns:
> >
> > "Field","Type","Null","Key","Default","Extra"
> > "User_Prog_ID","int(10)","NO","PRI","","auto_increment"
> > "Event_Date","date","NO","","",""
> > "Event_Desc","text","NO","","",""
> >
> > James Kilbride
> >
> > _______________________________________________
> > Solar-talk mailing list
> > Solar-talk at lists.solarphp.com
> > http://mailman-mail3.webfaction.com/listinfo/solar-talk
> >
> >
>
> _______________________________________________
> Solar-talk mailing list
> Solar-talk at lists.solarphp.com
> http://mailman-mail3.webfaction.com/listinfo/solar-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman-mail3.webfaction.com/pipermail/solar-talk/attachments/20080130/ecbeb11d/attachment-0001.html
More information about the Solar-talk
mailing list