Hi all!
After my problem with aggregate functions together with dynamic where
clauses and a little discussion with Dirk i could announce i integrated
views!
I introduce a new tag in dbforms-config.xml:
1. <view name="my_view"
from="my_table"
>
field="field1" type="integer"
field="field2" type="integer"
search="searchfield1" type="integer"
search="searchfield2" type="integer"
</view>
Will result in:
select
field1,
field2
from
my_table
where
searchfield1="xxx" and/or searchfield2="xxx"
<view name="my_view"
from="my_table"
>
</view>
Will result in:
select
fields from my_table
from
my_table
With this several views for the same base table would be possible. So it
become possible to use the same table (modelling a hierarchy) several
times on the same page, which is not possible now because of naming
conflicts.
2. <view name="my_view"
from="my_table"
groupBy="field1, field2"
>
field="field1" type="integer"
field="field2" type="integer"
field="field3" type="integer"
expression="sum(field3)"
search="searchfield1" type="integer"
search="searchfield2" type="integer"
</view>
Will result in:
select
field1,
field2,
sum(field3) as field3
from
my_table
where
searchfield1="xxx" and/or searchfield2="xxx"
group by
field1, field2
having
field1="what_ever_you_like"
With this aggregate functions become possible!
To integrate this stuff "cleaning up" in Table, DbUpdateEvent,
DbInsertEvent and DbDeleteEvent was necassary, e.g. introduce new public
method getSelectStatement in Table an use it in the whole framework.
With this "cleaning up" it was possible to create a new class View which
extends the Table class and overload the the methods mentioned above.
Next step could be to make the view updateable - this could be easily
done introducing new tags for update and insert statments. I would
implement this at the time i need it.
Updating of a simple view mentioned above is possible know:
<view name="my_view"
from="my_table"
>
field="field1" type="integer"
field="field2" type="integer"
</view>
Will result in update mytable set field1=adf, field2=bla.
Sound this interesting enough to commit? Any suggestions or comments?
Regards,
Henner Kollmann
-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm
Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en
_______________________________________________
DbForms Mailing List
http://www.wap-force.net/dbforms