Post by gary » Sun Mar 16, 2008 9:32 am

The main thing that annoys me about opencart code - is queries being all over the place.

The clean way to do it - is to create query class and place all queries there. Then create datasource class - and write a function for each query call.

Advantages - all queries are in once place - so when database schema is changed - all needed changes can be found at once. Also - having database access calls in one class - lets you re-use same code - and makes it easy to change it.

Now it is just a mess.

Also - the database class is missing transaction supporting code:

function transaction_begin(){
$this->connect();
mysql_query("BEGIN", $this->cn);
}
function transaction_rollback() {
    mysql_query("ROLLBACK", $this->cn);
$this->disconnect();
  }
function transaction_commit() {
    mysql_query("COMMIT", $this->cn);
$this->disconnect();
  }
function transaction_execute($sql){
return mysql_query($sql, $this->cn);
}
function get_transaction_insert_id(){
return mysql_insert_id($this->cn);
}

New member

Posts

Joined
Sun Nov 04, 2007 11:55 pm

Post by pdbs » Thu May 08, 2008 7:38 am

The one thing I would say is that I like the fact that this code is a good start. Can we  as a group contribute twoards this product and make the code function better through the resources we have and know?  If Interested I would like to see us continue this project to the next level.

New member

Posts

Joined
Thu May 08, 2008 2:56 am

Post by Kartoffelz » Mon May 19, 2008 6:15 pm

Certainly useful and should give more structure in especially the database class and work-arounds.

New member

Posts

Joined
Fri Apr 04, 2008 10:44 pm
Location - The Netherlands

Post by Daniel » Sat Jul 12, 2008 4:54 am

This has been done in the model part.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm
Who is online

Users browsing this forum: No registered users and 3 guests