[Kansas-general] virtual tables
Berger, Daniel
djberge at qwest.com
Fri May 14 13:14:42 EDT 2004
Hi,
I was just thinking that it would be cool if you could create a virtual
table with the table method. For now, you can do something like:
ksdbh.table(:Students,:students), and this creates a Students class with
all the records from the students table.
What if we allowed the table method to accept a block to define what
data we want back in our class? For example:
ksdbh.table(:VStudents,:students){ students.student_id < 100 }
This would create a "virtual" class VStudents, that only contains
students with a student_id less than 100. So, what you end up with is
what amounts to a view based on a single table.
If we continue along these lines, we could allow the table method to
accept an array of table names and build a multi-table view. For
example:
ksdbh.table(:VStudents,[:students,:student_data]){
students.student_id > 100
students.student_id = :student_data.student_id
}
So, now we end up with a slightly more realistic view, mapped to our
class.
Whaddya think?
Dan
More information about the Kansas-general
mailing list