Blueprint changed by rejon:

Whiteboard changed:
  Current implementation
  -------------------------------------
  Now aiki manage multi-database hacking ezSql (only in mysql driver), with this
  ( libs/database/mysql.php line 254)
  if ( $str = @mysql_error($this->dbh) ){
    //check if multi database is enabled
   if (isset ($config["allow_multiple_databases"]) and 
$config["allow_multiple_databases"]){
  
  When a error is detect, then aiki find the database and launch a second 
connecion(?).
  The hack is only valid on sql statements with FROM (not valid for update or 
insert)
  
  $db as layer for connections
  ------------------------------------------------------------------
  A more elegant solution can be define $db object with this pseudo code:
  
  class db {
  
  private $connections;  // store  all connections..
  
  function __construct( ){
  $this->connections[]= new EzSQL ( params to connect. )
  }
  
  function add_connection( params to connect ){
    $this->connection = new EzSQL ( params to connect. )
  }
  
  function get_results($SQL,..) {
  if ( $SQL begin with a number:sql-statement )
    extract number and check it's a valid connection.
     return $this->connections[number]->get_results(SQL without number) }
  } else {
    return $this->connections[$this->default]->get_results(..) }
  }
  
  function get_var()    { same as above.. }
  function query()      { same as above..}
  
  In wigdet ( NORMAL_SELECT, (sql( markup:
  SELECT * FROM foo    -> over default connection
  1:SELECT * FROM foo   ->over connection 1.
  (sql(3:SELECT ....)
  
  @TODO use name instead numbers...
  
  In aiki core we can use $db without changes
  
  Conclusion
  ------------------------------------------------------------
  - some technical problems must be solve.
  - backward compatibility.
  - multi database for all drivers.
  - valid for select,update,insert....
+ 
+ ###
+ 
+ 
+ TOTALLY! @rejon
+ 
+ Also, I want this for the purposes of pushing a site between multiple
+ databases for backup, push to staging, and for comparing databases,
+ since that is the core of aiki! @rejon

-- 
Improve aiki multi-database
https://blueprints.launchpad.net/aikiframework/+spec/multidatabase

_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help   : https://help.launchpad.net/ListHelp

Reply via email to