[pmwiki-devel] DataQuery 0.2 beta now available
marc
gmane at auxbuss.com
Tue Dec 26 09:51:42 CST 2006
> In any case, I just wanted to share that version 0.2 beta of DataQuery
> is now available in the Cookbook. It doesn't look like much, because
> I'm still working on the GUI, but it represents a total rewrite of
> version 0.1.
This looks interesting. Things are starting to work here, but in
DataStore::read I get:
Catchable fatal error: Object of class DataQuery could not be
converted to string
here:
foreach ($data as $key => $value) {
if (!in_array("$query.$key",$DQglobals['offlimits']))
$page['text'] .= "$fore$key: ".str_replace("\n","[[<<]]",$value)
. "$aft\n\n";
}
due to $query being an object. I think you're after:
$query->name or $query->getname()
as in
if (!in_array("$query->name.$key",$DQglobals['offlimits']))
But I didn't look too closely, so I'm probably way off.
Also, when I click a configure link on DataQuery.DataQuery, I get:
Warning: Invalid argument supplied for foreach()
relating to this is DataStore
function template() {
$page['text'] = " \n\n(:comment data:)\n\n";
$query = $this->loadquery($this->name);
foreach ($query->config as $key => $value)
$page['text'] .= "(:$key: $value:)\n\n";
return $page;
}
The error is thrown because $query is empty. This seems to happen when
table names contain underscores, such that $name is stored without the
underscore. I didn't investigate further.
For tables without an underscore in the name, I'm note sure what the
procedure should be to view a row.
Say, I have a table called recipes. It is listed on DataQuery.DataQuery.
When I click List, the search results show the appropriate rows, and I
can click on a row which, as your site says, displays nothing. However,
editing the page shows that it has the correct data. So far, so good.
Now, above the search results is a link to an absent page:
Recipes.Recipes
Clicking this presents an edit page filled with what I understand is
template data. e.g.:
(:comment data:)
(:`recipes`.`id`: :)
(: `recipes`.`title`: :)
(: `recipes`.`description`: :)
When I try to save this page I get:
You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'WHERE id='Recipes'' at line 1
PmWiki can't process your request
Cannot write page to Recipes.Recipes on database "testdb"...changes
not saved
The actual error is:
mysql error: [1064: You have an error in your SQL syntax. Check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'WHERE id='Recipes'' at line 1] in
EXECUTE("UPDATE recipes SET WHERE id='Recipes' ")
As I'm not sure what this is trying to do, I've not pursued it. It just
seems a bit odd that a PmWiki page change is attempting to update the
db, regardless of the SQL being incorrect.
In addition, when I click the Configure option for the recipes table on
DataQuery.DataQuery this creates an edit page
DataQuery.Recipes
populated with what look like the DataQuery object. e.g.:
(:comment data:)
(:database: testdb:)
(:table: recipes:)
(:join_field1: :)
(:join_to1: :)
(:calc1: :)
(:as1: :)
(:key: id:)
(:display: recipes.id, recipes.title, recipes.description, recipes.date,
recipes.instructions:)
(:match: :)
(:group: :)
(:order: id:)
(:limit: :)
(:where: 1:)
This I can save.
So, I'm close, but missing something. Hope you can help.
--
Best,
Marc
More information about the pmwiki-devel
mailing list