Page 1 of 1

PostPosted: Mon Nov 20, 2006 8:38 pm
by johnjake
Sorry bit of a noob question.

I have a simple db set up with two tables. An Item and an Inventory table.

Item Table
ItemId
Name
Subtitle

Inventory Table
InventoryId
ItemId
Quanity

relationships.ini in the Item folder:
[Inventories]
Inventory.ItemId = "$ItemId"

When I hit "new record" in the item tab I get the following error:
[pear_error: message="Parse error: Unknown action :s on line 1 select * from Inventory where Inventory.ItemId='$ItemId' ^ found: "s"" code=0 mode=return level=notice prefix="" info=""]
Fatal error: Cannot use object of type PEAR_Error as array in /srv/www/htdocs/dataface/SQL/Parser/wrapper.php on line 649

Any help would be most appreciated,

Thanks

Jake

PostPosted: Tue Nov 21, 2006 8:13 am
by Aoirthoir
Jake, in a couple of hours Mr. Steve (DF's designer) will be on. However, in the meantime you might want to change your relationships.ini to:

[Inventory]

the name of the group heading has to be exactly the name of your table. So unless your table is named Inventories, your group name (relationship name) should not be Inventories. Also caps will matter if you are in a linux/unix/mac environment, but should not matter in windows.

PostPosted: Tue Nov 21, 2006 3:07 pm
by johnjake
Thanks for the response, I tried changing that and I am still getting the same error.

On another note: is there something that needs to be done to make dataface pick up the changes, or are they automatically loaded?

PostPosted: Tue Nov 21, 2006 4:31 pm
by shannah
Hi Jake,

Actually... the name of the relationship can be anything you want.

This is puzzling... as everything appears to be in order.
One possible workaround (just to see if it works is) to change your relationships.ini file to:

[Inventories]
__sql__ = "select * from Inventory where ItemId='$ItemId'"

Still puzzled on why the problem though.. if you can send me the relevant SQL create table commands for the tables, I can set it up on my systems and see if I can trace the bug..

-Steve

PostPosted: Tue Nov 21, 2006 4:32 pm
by shannah
Changes automatically get reloaded...

PostPosted: Tue Nov 21, 2006 5:55 pm
by johnjake
I changed the relationships.ini file like you suggested. I got the following error:


Fatal error: [pear_error: message="Parse error: Unknown action :s on line 1 select * from Inventory where ItemId='$ItemId' ^ found: "s"" code=0 mode=return level=notice prefix="" info=""]
On line 178 of file /srv/www/htdocs/dataface/Dataface/Relationship.php in function printStackTrace()
On line 102 of file /srv/www/htdocs/dataface/Dataface/Relationship.php in function _init(select * from Inventory where ItemId='$ItemId')
On line 1173 of file /srv/www/htdocs/dataface/Dataface/Table.php in function Dataface_Relationship(Item,Inventory,select * from Inventory where ItemId='$ItemId')
On line 2351 of file /srv/www/htdocs/dataface/Dataface/Table.php in function _loadRelationshipsIniFile()
On line 744 of file /srv/www/htdocs/dataface/Dataface/QuickForm.php in function relationships()
On line 42 of file /srv/www/htdocs/dataface/actions/new.php in function _build()
On line 742 of file /srv/www/htdocs/dataface/Dataface/Application.php in function handle(Array)
On line 1140 of file /srv/www/htdocs/da in /srv/www/htdocs/dataface/Dataface/Relationship.php on line 178


I am running Apache 2 on SUSE 10.0 with PHP 5.1.2. The database is MySQL. I will send you the additional information you requested tonight when I get home.

Thanks for the help.

PostPosted: Tue Nov 21, 2006 6:05 pm
by shannah
What version of Dataface are you running?

-Steve

PostPosted: Tue Nov 21, 2006 7:05 pm
by johnjake
I am running 0.6.9r1

Here are my tables:

CREATE TABLE `Item` (
`ItemId` int(11) NOT NULL auto_increment,
`Name` varchar(32) default NULL,
`Subtitle` varchar(32) default NULL,
`Description` text,
`EstimatedPrice` int(11) default NULL,
PRIMARY KEY (`ItemId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE `Inventory` (
`InventoryId` int(11) NOT NULL auto_increment,
`ItemId` int(11) NOT NULL,
`LocationId` int(11) NOT NULL,
`Quanity` int(11) NOT NULL,
`LastChangeDate` datetime default NULL,
PRIMARY KEY (`InventoryId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

I have made no other changes other than the relationships.ini since I ran the makesite command.

Thanks for your time

Jake

PostPosted: Wed Nov 22, 2006 12:09 pm
by shannah
OK.. i downloaded and set up the same database and relationships.ini files on my local system and tried it with 0.6.9r1 and everything is working fine on this end (aside from a small caveat I mention below).

My guess is that there are some encoding problems with either your relationships.ini file, or some of your dataface files (more likely your relationships.ini file). What text editor are you using to edit your relationships.ini file, and what text encoding is used (e.g. UTF-8 or Latin-1, ...).

Things you may want to try:

1. Try saving your relationships.ini file with unix line breaks.
2. Make sure that your saving the relationships.ini file with the ISO-Latin-1 encoding (aka ISO-1159-1).

As far as the caveat is concerned, it has nothing to do with this error.. It just caused some Notices to be displayed because of an undefined variable. See http://framework.weblite.ca/development/issue-tracker/138 for the patch for this issue.

Hope this helps.

-Steve