[pmwiki-users] SelectQuery development: database records as pages?

Pico pmwiki at ben-amotz.com
Tue Sep 26 21:35:37 CDT 2006

Patrick R. Michaud wrote:
> On Tue, Sep 26, 2006 at 05:15:44PM -0500, Ben Stallings wrote:
>> To be honest, I haven't used pagelists yet.  I'm going to go read up on 
>> them now.  But my gut reaction to this idea is that database information 
>> is fundamentally more structured than wiki information, and rightly 
>> so... my purpose in writing SelectQuery and UpdateForm was to use the 
>> wiki as a *front end* for the data, not to actually bring the data into 
>> the wiki.  [...]
>> I'd like a second opinion from someone who knows more about what 
>> pagelists can do... would it be useful to do what Pico is suggesting? 
>> Or would it open a whole new can of worms?  
> I think the most important point to be made here is that pagelists
> are all about doing things with lists of *pages*.  At the heart of
> the pagelist command is the idea that we're creating a list of
> pages of some sort, and then doing some processing on each page
> in that list.
> Somehow I think this is really different from SelectQuery, which
> is really about allowing arbitrary queries into MySQL databases,
> and such queries will probably always be more powerful than (:pagelist:).
Agreed: If the focus is on querying, you can't even begin to compare the 
pagelist directive to MySQL, or any other structured query language.

> Still, I can see how using (:pagelist:) to access records in a MySQL
> table could be somewhat useful.  

The real usefulness, in my view, is in formatting: leveraging the 
development that is taking place in PmWiki in using pagelist template 
formats to provide the layout for a stream of data that loops through 
similar patterns, whether they be pages, or records.

MySQL queries should still be used to gather the relevant records 
(recordset), just as a wikitrail can be employed to gather a relevant 
subset of pages of a site, that are then fed through a pagelist template 
for formatting.

It wouldn't be that hard to do, either--
> here are the key points:
>   - Each record in the MySQL table is conceptually a "page" in PmWiki
>   - Each record can be referenced by some unique identifier that
>     fits the PmWiki pagename format
>   - There's a way to get a list of all of the identifiers (pagenames)
>     from the table
>   - When PmWiki requests reading of a particular page (i.e., record),
>     the PageStore object returns a "page" where the text of the page
>     is a series of page text variable definitions.  
> For example, if we have a table with columns "name", "address", "city",
> then the custom PageStore object would query the table for a record
> and return markup text that looks like:
>     name: Alice Adams
>     address: 123 Any Street
>     city: Anywhere, USA
> Then (:pagelist:) would be able to make lists of records using
> pagelist templates and the page text variables.

> But as you mentioned, this is really more of "looking at a database
> as if it were a series of pages" instead of "providing an easy way to
> query a database".

Agreed: you still want to leverage the power of sql for the initial 
query and then the power of (pagelist) templating and PmWiki markup for 
formatting (and supplementing) the results.

Thank you!



         __  /
        /   /
       /___/ _/  ___/  __  /
      /      /  /     /   /
    _/     _/  ____/ ____/

 >>>===pmwiki at ben-amotz.com===>

More information about the pmwiki-users mailing list