Database / Installation FYI with Xampp

thread: 12 messages  |  last: a year ago  |  started: sunday, august 13, 2006, 12:06 am pdt


#1  |  mtbadfish (St. Paul, Minnesota) United States of America
Sunday, August 13, 2006, 12:06 AM PDT

I just started playing with Qcodo today. I ran into a problem when trying the examples where the one to many and many to many examples were failing.

I am using Xampp. With Xampp MySQL is set-up with Innodb disabled. The test db for the examples was created and the tables were MyIsam.

To correct the problem I had to alter the mysql\bin\my.cnf file to enable Innodb.

Here is the Innodb portion of the file as delivered:

skip-innodb
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = C:/xampp/xampp/mysql/data/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = C:/xampp/xampp/mysql/data/
#innodb_log_arch_dir = C:/xampp/xampp/mysql/data/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#set-variable = innodb_buffer_pool_size=16M
#set-variable = innodb_additional_mem_pool_size=2M
# Set .._log_file_size to 25 % of buffer pool size
#set-variable = innodb_log_file_size=5M
#set-variable = innodb_log_buffer_size=8M
#innodb_flush_log_at_trx_commit=1
#set-variable = innodb_lock_wait_timeout=50

Here is the code modified to enable Innodb:***Make sure you comment out the “skip-innodb” line.

#skip-innodb
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = C:/xampp/xampp/mysql/data/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = C:/xampp/xampp/mysql/data/
innodb_log_arch_dir = C:/xampp/xampp/mysql/data/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
set-variable = innodb_buffer_pool_size=16M
set-variable = innodb_additional_mem_pool_size=2M
# Set .._log_file_size to 25 % of buffer pool size
set-variable = innodb_log_file_size=5M
set-variable = innodb_log_buffer_size=8M
innodb_flush_log_at_trx_commit=1
set-variable = innodb_lock_wait_timeout=50

I hope this is of some help to other newcomers.

Mike

#2  |  alex94040 (Seattle, WA) United States of America Qcodo Core Contributor
Sunday, August 13, 2006, 1:49 AM PDT

Mike, this is such a very true showstopper - I reinstalled XAMPP another day and just couldn't get why QCodo wouldn't generate any many-to-many table relationships for me.

InnoDB it was - disabled in the my.cnf that ships by default.

#3  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Monday, August 14, 2006, 11:46 AM PDT

Alex / Mike, could you guys post here any error message/strings that showed up before you made the my.cnf change in the forum?  THat way, if newbies do searches on the error string, they'll be able to find your post. =)

#4  |  romcart (Redding, CA) United States of America Qcodo Core Contributor
Monday, August 14, 2006, 12:43 PM PDT

For anyone interested, there is a project similar to XAMPP called WAMP5 <http://www.wampserver.com/en/> that I recently used when seting up a Windows test server with QCodo, and it does not have InnoDB disabled by default.  IIRC, both XAMPP and WAMP5 still have magic quotes enabled by default, but at least QCodo warns about that one.

#5  |  mtbadfish (St. Paul, Minnesota) United States of America
Monday, August 14, 2006, 8:31 PM PDT

Mike,

I will re-configure and load Qcodo again to replicate the configuration I had before I got it working. Probably tomorrow. I'll post the errors then.

Thanks,
Mike

#6  |  alex94040 (Seattle, WA) United States of America Qcodo Core Contributor
Tuesday, August 15, 2006, 1:13 PM PDT

My errors were only around codegen not creating any relationships between tables - which is very understandable because foreign keys were not set.

One suggestion here, developing on romcart's idea - it would be great if codegen would check if tables are of type other than InnoDB, and there are no MyISAM workarounds in place. This would most likely mean that either the user forgot to setup tables as InnoDB (forgot to read the manual, just a mistake in the DDL), or because their MySQL install doesn't have InnoDB enabled (i.e. XAMPP by default).

Thanks!
-Alex

#7  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Wednesday, August 16, 2006, 10:39 AM PDT

Alex... it's a good suggestion, but unfortunately it's a workaround that is very specific to mysql... and qcodo (including the QCodeGen object, itself, which would be responsible for reporting such an error) is completely database agnostic.  (it uses the QDatabaseBase API to access the individual database(s)).

But it's an interesting idea... and one possible workaround would be to have the codegen reporting give a count as to how many relationships, in general, it thinks it has for each table... e.g.:

Successfully generated class:       Login (with 1 relationship)
Successfully generated class:       Person (with 1 relationship)
Successfully generated class:       PersonWithLock (with no relationships)
Successfully generated class:       Project (with 2 relationships)
Successfully generated TYPE class:  ProjectStatusType

So, at the very least, you get immediate feedback that something's not quite right when you see all your classes generated with no relationships.

what do you think?

#8  |  mtbadfish (St. Paul, Minnesota) United States of America
Wednesday, August 16, 2006, 9:42 PM PDT

Here is the error page you receive when you run the codegen when INNODB is not enabled in mysql/bin/my.sql

Take a look at your database and you will notice the “Type” for each of the tables is “MyISAM”.

The following errors were reported:

AssociationTable related_project_assn does not have exactly 2 foreign keys.
AssociationTable team_member_project_assn does not have exactly 2 foreign keys.



There were 5 tables available to attempt code generation:

Successfully generated class:       Login
Successfully generated class:       Person
Successfully generated class:       PersonWithLock
Successfully generated class:       Project
Successfully generated TYPE class:  ProjectStatusType



CodeGen was executed with the following settings:

DatabaseIndex           => '1'
ClassPrefix             => ''
ClassSuffix             => ''
TypeTableSuffix         => '_type'
AssociationTableSuffix  => '_assn'
StripTablePrefix        => ''
TemplateEscapeBegin     => '<%'
TemplateEscapeEnd       => '%>'
AssociatedObjectPrefix  => ''
ApplicationName         => 'Application'

#9  |  mtbadfish (St. Paul, Minnesota) United States of America
Wednesday, August 16, 2006, 9:51 PM PDT

Here are the errors I received when trying the individual examples-

When selecting “* Relationships (Foreign Keys)

Undefined GET property or variable in 'Project' class: ManagerPerson

When selecting “* Reverse Relationships (One-to-One and One-to-Many)

Listing of the Project(s) that This Person Manages

Fatal error: Call to undefined method Person::GetProjectAsManagerArray() in C:\xampp\xampp\htdocs\qcodo\wwwroot\examples\code_generator\reverse_relationships.php on line 87

When selecting “* Many-to-Many Relationships

Listing of the Project(s) that This Person is a Team Member of

Fatal error: Call to undefined method Person::GetProjectAsTeamMemberArray() in C:\xampp\xampp\htdocs\qcodo\wwwroot\examples\code_generator\relationships_many.php on line 69
.bc
#10  |  alex94040 (Seattle, WA) United States of America Qcodo Core Contributor
Sunday, September 24, 2006, 12:00 PM PDT

Mike, I like your workaround; it would at least suggest that something is going wrong. Another possible idea: detect that two tables have the same field name, and if there is no relationship between these two tables, create a warning (most likely, the user forgot to configure foreign key/association trick).



Copyright © 2005 - 2010, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.