Table data gateway pattern
From CSSEMediaWiki
(Difference between revisions)
m (New page: = Table Gateway Pattern = ''' An object that acts as a Gateway to a database table. One instance handles all the rows in the table. ''' == How it works == A simple interface that directl...) |
m |
||
Line 1: | Line 1: | ||
− | + | '' An object that acts as a Gateway to a database table. One instance handles all the rows in the table. '' | |
− | + | ||
− | + | = How it works = | |
A simple interface that directly maps onto the database. The class contains all the SQL to access the data from the database and simply return a RecordSet (or similar) of the data. The entire system is stateless, and any changes to the underlying database needs to be done with the Gateway class. | A simple interface that directly maps onto the database. The class contains all the SQL to access the data from the database and simply return a RecordSet (or similar) of the data. The entire system is stateless, and any changes to the underlying database needs to be done with the Gateway class. | ||
− | + | = When to use it = | |
For very simple database access. ''Stored procedures themselves are often organized as Table Data Gateways'' | For very simple database access. ''Stored procedures themselves are often organized as Table Data Gateways'' | ||
− | + | = Example = | |
− | + | [[Image:table_data.png]] | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
Latest revision as of 21:32, 17 October 2010
An object that acts as a Gateway to a database table. One instance handles all the rows in the table.
How it works
A simple interface that directly maps onto the database. The class contains all the SQL to access the data from the database and simply return a RecordSet (or similar) of the data. The entire system is stateless, and any changes to the underlying database needs to be done with the Gateway class.
When to use it
For very simple database access. Stored procedures themselves are often organized as Table Data Gateways