cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <>
Subject Re: How to show files from database / DatabaseReader problem
Date Sun, 30 Nov 2003 10:33:17 GMT
On 30.11.2003 02:20, wrote:

> Hi,
> I have a big problem with Database reader. I'd like to make a common stuff - in 
> the database I are stored binary files (table structure looks: (id, content, 
> filename, mimetype) and I'd like to map url "file/234" on the accordant file. 
> Remind, that in the database can be stored everything possible stuff (images, 
> documents etc.).
> I tried to use databasereader. All works ok, until I'd like to change mime-type 
> to appropriate mime-type stored in the database. For this purpose should be 
> used parameter "content-type". But it doesn't work and doesn't return regular 
> value from database. It just returns that string, I inserted with parameter. It 
> is correct? If so, how can I solve my problem? I tried this solution:
> Usual select: "select content, mimetype from files where id=123 and status=1"
> Using databasereader:
> <map:match pattern="files/*">
>   <map:read type="databasereader" src="{1}" mime-type="plain/text">
>     <map:parameter name="table" value="files"/>
>     <map:parameter name="image" value="content"/>
>     <map:parameter name="key" value="id"/>
>     <map:parameter name="where" value="status=1"/>
>     <map:parameter name="content-type" value="mimetype"/>
>   </map:read>
> </map:match>
> But that doesn't work. So how to solve that? Or do you know some alternative 
> ways?

If you have a look at the source code
you will see that the mime-type is not taken from database, but the 
parameter value itself, i.e. 'mimetype'. If that's useful or not - I 
don't know. Maybe you can patch the databasereader.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message