Hi again,
I hadn't mentioned before but my change was done in file:
/* SVN FILE: $Id: dbo_mysql.php 5612 2007-08-30 01:49:55Z phpnut $ */
Anyway, another problem I discovered, trying to move my database into cake
with bake, As I'd mentioned earlier, it was strange that bake wasn't quite
working right.
So I found that bake wasn't getting the names from the model. But then it
doesn't really use the model then....
bake.php:430 -> $modelFields = $db->describe($tempModel);
Probably the right fix would be to modify $db->describe() to add the 'name'
field to the array even though it's already indexed by name. This would
probably need to be done (or checked) in all the dbo files, but I only have
mysql handy, so that's all you get.
as in:
(from my previous fix, just inside the end of the if block I proposed, add
the following:
192 /*
193 ** to make name of column available
194 */
195 $column[0]['Field'] =
$column['COLUMN_NAME']['Field'];
------------------------
Then we need that value shoved into the $fields array, (happens right after
the if block closes 197 if you're following along. I placed last
in the construction of the fields array.
202 /*
203 ** jefkin, adding the name
value...
204 */
205 'name' =>
$column[0]['Field']
--------------------
So that make the name go through.
Jeff
On 9/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi group.
>
> New to cake, but I like the concept, installed, and tried bake.php on
> a table in a database, it kept giving me very strange results.
>
> Finally I just went with it to see if I could get things working.
>
> after some other configuration issues, I pointed at my 'questions'
> table page. http://myserver/questions/
>
> I received a whole slew of errors, like 'undefined index 'Type'... in
> cake/libs/model/dbo/dbo_mysql.php
> also an error for 'Null', 'Default', (each multiple times) and one
> time for 'Key'. for each column in the table.
>
> So being a decent debuger, I printed out the data in the database.
>
> mysql> describe questions;
> +---------+---------+------+-----+---------+----------------+
> | Field | Type | Null | Key | Default | Extra |
> +---------+---------+------+-----+---------+----------------+
> | id | int(11) | NO | PRI | NULL | auto_increment |
> | desc_id | int(11) | NO | MUL | 0 | |
> +---------+---------+------+-----+---------+----------------+
>
> database: mysql 5.0.22
>
> so as I said, I'm used to debuging, I printed out what the cake file
> was seeing:
>
> describe `questions`
>
> Array
> (
> [0] => Array
> (
> [COLUMN_NAME] => Array
> (
> [Field] => id
> )
>
> [COLUMN_TYPE] => Array
> (
> [Type] => int(11)
> )
>
> [IS_NULLABLE] => Array
> (
> [Null] => NO
> )
>
> [COLUMN_KEY] => Array
> (
> [Key] => PRI
> )
>
> [COLUMN_DEFAULT] => Array
> (
> [Default] =>
> )
>
> [EXTRA] => Array
> (
> [Extra] => auto_increment
> )
>
> )
>
> [1] => Array
> (
> [COLUMN_NAME] => Array
> (
> [Field] => desc_id
> )
>
> [COLUMN_TYPE] => Array
> (
> [Type] => int(11)
> )
>
> [IS_NULLABLE] => Array
> (
> [Null] => NO
> )
>
> [COLUMN_KEY] => Array
> (
> [Key] => MUL
> )
>
> [COLUMN_DEFAULT] => Array
> (
> [Default] => 0
> )
>
> [EXTRA] => Array
> (
> [Extra] =>
> )
>
> )
>
> )
>
> Wanting to see something real come out, I added the following lines to
> dbo_mysql.php file:
>
> in 'foreach ($cols as $column)'
>
> in 'if (isset($column[0]))'
>
> added lines:
> 180 /*
> 181 ** jefkin: fixing describe reading
> for MySql 5.0.22
> 182 */
> 183 if ((isset($column['COLUMN_NAME']))
> && (isset($column['COLUMN_TYPE'])) &&
> 184 (isset($column['IS_NULLABLE']))
> && (isset($column['COLUMN_KEY'])) &&
> 185 (isset($column['EXTRA'])))
> 186 {
> 187 $column[0]['Extra'] =
> $column['EXTRA']['Extra'];
> 188 $column[0]['Key'] =
> $column['COLUMN_KEY']['Key'];
> 189 $column[0]['Type'] =
> $column['COLUMN_TYPE']['Type'];
> 190 $column[0]['Null'] =
> $column['IS_NULLABLE']['Null'];
> 191 $column[0]['Default'] =
> $column['COLUMN_DEFAULT']['Default'];
> 192 }
>
> note my lines might be off from yours as I still had some debuging
> stuff in the file. But this patch seems to fix
> the page lookups, but seems to be missing the name when I run bake.php
> again.
>
> So... there you have it, now I've contributed to cake...
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---