Ferreteria/v2/usage/db: Difference between revisions

From Woozle Writes Code
< Ferreteria‎ | v2‎ | usage
Jump to navigation Jump to search
(list of files; classes from data.php)
 
(v2, first draft)
Line 1: Line 1:
==About==
==About==
'''Databases''' in Ferreteria are managed through several sets of classes that work together:
'''Databases''' in Ferreteria are managed through several sets of classes that work together. I am in the process of rewriting this module from scratch; information about the existing code is in [[/v1]].
==Rules==
* Each '''Connection''' should be requested from the static '''DBO Factory''' class by passing it a connection spec.
* The Factory looks up which '''Connection''' class is needed for the type specified in the connection spec.
* The Factory creates the appropriate '''Connection''' object, passes it the rest of the spec to initialize it, and returns it to the caller.
==Files==
==Files==
* {{ferreteria/code|db/data.php}}
These have ''not'' yet been committed to GitHub:
* {{ferreteria/code|db/data-chained.php}}
* {{ferreteria/code|db/db.php}}
* {{ferreteria/code|db/data-indexed.php}}
* {{ferreteria/code|db/db-conn.php}}
* {{ferreteria/code|db/data-indexer.php}}
* {{ferreteria/code|db/db-engine.php}}
* {{ferreteria/code|db/data-records.php}}
* {{ferreteria/code|db/db-result.php}}
* {{ferreteria/code|db/data-table.php}}
==Classes==
==Classes==
===database connections & results===
===primary===
* '''clsDatabase_abstract''' (abs: {{ferreteria/code|db/data.php}})
* '''fcDBOFactory''' {{ferreteria/code|db/db.php}}: static class for creating connections
** '''clsDatabase''' (extends clsDatabase_abstract): this is actually specific to a particular library for MySQL, so it should probably be renamed
* '''fcDataEngine''' {{ferreteria/code|db/db-engine}}: handler for a particular type of database
to reflect that.
* '''fcDataConn''' {{ferreteria/code|db/db-conn.php}}: connection to a database
* '''clsDataEngine''' (abs: {{ferreteria/code|db/data.php}})
** '''clsDataEngine_CliSrv''' (abs; extends clsDataEngine): [[client-server]] database engine
*** '''clsDataEngine_MySQL''' (extends clsDataEngine_CliSrv): [[MySQL]] database engine using deprecated mysql library
*** '''clsDataEngine_MySQLi''' (abs; extends clsDataEngine_CliSrv): MySQL database engine using [http://php.net/manual/en/book.mysqli.php MySQLi] library
*** '''clsDataEngine_DBX''' (abs; extends clsDataEngine_CliSrv): MySQL database engine using dbx library
* '''clsDataResult''' (abs: {{ferreteria/code|db/data.php}})
** '''clsDataResult_MySQL''' (extends clsDataResult): [[MySQL]] data result
===helpers===
===helpers===
* '''clsSQLFilt''' ({{ferreteria/code|db/data.php}})

Revision as of 19:47, 13 March 2015

About

Databases in Ferreteria are managed through several sets of classes that work together. I am in the process of rewriting this module from scratch; information about the existing code is in /v1.

Rules

  • Each Connection should be requested from the static DBO Factory class by passing it a connection spec.
  • The Factory looks up which Connection class is needed for the type specified in the connection spec.
  • The Factory creates the appropriate Connection object, passes it the rest of the spec to initialize it, and returns it to the caller.

Files

These have not yet been committed to GitHub:

Classes

primary

helpers