[Trellis-developers] new database abstraction class

Shaddy Zeineddine shaddy at learning.net
Mon Apr 14 08:41:58 PDT 2008


New features:

improved efficiency: removed anything that wasn't necessary and made use
of mysqli class for very simple and clean code

load balancing support: very simple support for load balancing reads
while keeping all writes on a single database. requires that the
username/passwords and database names be identical across hosts. read
host is randomly selected per execution.

prepared statements: through mysqli

transactions: through mysqli

improved select_column: automatically decides whether to create an
associative array based on the number of columns selected


changes from SteamDB:

query no longer exists

for selects that were previously done with query, use select_rows instead

for inserts, updates, and deletes, use affect

this was done to eliminate processing required to identify the query type

step_select is now just select

select_column no longer has the second argument, if you select one
column, select_column will create a basic array of that column, if you
select two columns, it will create an associative array using the first
column as the key.

last_query no longer exists

all other changes will not affect current code.


what needs to be done in order to use TrellisDB...

-change all query methods to either select_rows or affect
-change all step_select methods to select
-remove second argument from select_column (still works with it)


since there i expect there to be some significant performance
improvements in high load environments (maybe a 5-10% reduction in
loading time), i would like to start using it as soon as possible. i
think it is reasonable to implement it in 0.5.1. Transactions will be
postponed until 0.6.0 because they will require InnoDB tables. This
requirement will mean that all write hosts must use all InnoDB tables.
We currently use a mix of InnoDB and MyISAM tables. However in version
0.6.0, InnoDB tables will be standard. MyISAM and Memory tables will be
used only on dedicated read hosts for maximum performance. (MyISAM is
only beneficial in FULL TEXT searching, Memory can only be used if
tables do not have any TEXT/BLOB columns). Prepared statements can be
used right away, but should be reserved for repetitive queries. This
includes queries found in some events and actions.



More information about the Trellis-developers mailing list