[Solar-talk] Collection Oddity
Raymond Kolbe
rkolbe at gmail.com
Tue Jan 29 22:30:45 CST 2008
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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman-mail3.webfaction.com/pipermail/solar-talk/attachments/20080129/979304b4/attachment.html
More information about the Solar-talk
mailing list