<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/libs/Exception.php</filename>
    </added>
    <added>
      <filename>app/libs/Message.php</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -73,13 +73,22 @@ abstract class PhpBURN_Core implements IPhpBurn {
 		return $result;
 	}
 		
-	public function get() {
-		
+	public function get() {
 	}
 	
-	public function save() {
-		
-	}
+	public function save() {
+		$fields = array();
+		// if query is an insert
+		$insert = true;
+		foreach ($this-&gt;_mapObj-&gt;fields as $field =&gt; $infos) {
+			$fields[$field] = $this-&gt;_mapObj-&gt;getFieldValue($field);
+			if ($insert==true &amp;&amp; isset($infos['pk']) &amp;&amp; $infos['pk']==true &amp;&amp; !empty($fields[$field])) {
+				// query will be an update
+				$insert = false;
+			}
+		}
+		//execute query.
+	}
 	
 	public function delete() {
 		
@@ -120,4 +129,4 @@ abstract class PhpBURN_Core implements IPhpBurn {
 		
 	}
 }
-?&gt;
\ No newline at end of file
+?&gt;</diff>
      <filename>app/libs/Core.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,131 +1,129 @@
-&lt;?php
-PhpBurn::load(&quot;Dialect.IDialect&quot;);
-
-class PhpBURN_Dialect_MySQL implements IDialect {
-	
-	private $obj = null;
-	private $connection = null;
-	private $resultSet;
-	private $dataSet;
-	private $mode;
-	private $pointer;
-	
-	function __construct(PhpBurn_Core $obj) {
-		$this-&gt;obj =&amp; $obj;
-	}
-	function __destruct() {
-		unset($this);
-	}
+&lt;?php
+PhpBurn::load(&quot;Dialect.IDialect&quot;);
+
+class PhpBURN_Dialect_MySQL implements IDialect {
 	
-	/* Query Construction */
+	private $obj = null;
+	private $connection = null;
+	private $resultSet;
+	private $dataSet;
+	private $mode;
+	private $pointer;
 	
-	public function find($pk = null) {
-		
+	function __construct(PhpBurn_Core $obj) {
+		$this-&gt;obj =&amp; $obj;
+	}
+	function __destruct() {
+		unset($this);
+	}
+	
+	/* Query Construction */
+	
+	public function find($pk = null) {
+		
+	}
+	
+	protected function _prepareSQL($forCount = false, $what = '*') {
+		$sql = &quot;SELECT %s&quot;;
+
+		return sprintf($sql, ($forCount?'COUNT('.$what.')':$what));
 	}
 	
-	protected function _prepareSQL($forCount = false, $what = '*')
-	{
-		$sql = &quot;SELECT &quot;;
-		
-		
+	public function setConnection($connection) {
+		$this-&gt;connection =&amp; $connection;
+	}
+	
+	public function getConnection() {
+		return $this-&gt;connection;
+	}
+	
+	public function setMysqlMode($mode = &quot;&quot;) {
+		$this-&gt;mode = $mode;
 		
-		return $sql;
-	}
-	
-	public function setConnection($connection) {
-		$this-&gt;connection =&amp; $connection;
-	}
-	
-	public function getConnection() {
-		return $this-&gt;connection;
-	}
-	
-	public function setMysqlMode($mode = &quot;&quot;) {
-		$this-&gt;mode = $mode;
-		
-		if (empty($mode))
-			$this-&gt;setMysqlMode(MYSQL_ASSOC);
-	}
-	
-	public function execute($sql, $mode = &quot;&quot;) {
-		if (!isset($this-&gt;connection) &amp;&amp; empty($this-&gt;connection))
-			return false;
-		$this-&gt;setMysqlMode($mode);
-		$this-&gt;resultSet = $this-&gt;connection-&gt;executeSQL($sql);
-		while ($row = mysql_fetch_array($this-&gt;resultSet, $this-&gt;mode)) {
-			$dataSet[] = $row;
-		}
-		$this-&gt;setDataSet($dataSet);
-		$this-&gt;setPointer(0);
-		return true;
-	}
-	
-	public function num_rows() {
-		if (!isset($this-&gt;resultSet) &amp;&amp; empty($this-&gt;resultSet))
-			return 0;
-		return $this-&gt;getConnection()-&gt;num_rows($this-&gt;resultSet);
-	}
-	
-	public function affected_rows() {
-		if (!isset($this-&gt;resultSet) &amp;&amp; empty($this-&gt;resultSet))
-			return false;
-		return $this-&gt;getConnection()-&gt;affected_rows();
-	}
-	
-	public function moveFirst() {
-		$this-&gt;pointer = 0;
-	}
-	
-	public function moveNext() {
-		$this-&gt;pointer++;
-	}
-	
-	public function movePrev() {
-		$this-&gt;pointer--;
-	}
-	
-	public function moveLast() {
-		$this-&gt;pointer = $this-&gt;num_rows() - 1;
-	}
-	
-	public function getLast() {
-		return $this-&gt;num_rows() - 1;
-	}
-	
-	public function fetch_row($rowNumber) {
-		if (!isset($this-&gt;dataSet) &amp;&amp; !isset($this-&gt;dataSet[$rowNumber]))
-			return false;
-		return $this-&gt;dataSet[$rowNumber];
-	}
-	
-	public function fetch() {
-		$point = $this-&gt;getPointer();
-		$this-&gt;moveNext();
-		if ($point &gt; $this-&gt;getLast()) {
-			$this-&gt;moveFirst();
-			return false;
-		}
-		return $this-&gt;fetch_row($point);
-	}
-	
-//	@TODO: Create this method
-	public function getErrorMsg() {
-	}
-	
-	public function getDataSet() {
-		return $this-&gt;dataSet;
-	}
-	
-	public function setDataSet(array $dataSet) {
-		$this-&gt;dataSet = $dataSet;
-	}
-	
-	public function getPointer() {
-		return $this-&gt;pointer;
+		if (empty($mode))
+			$this-&gt;setMysqlMode(MYSQL_ASSOC);
+	}
+	
+	public function execute($sql, $mode = &quot;&quot;) {
+		if (!isset($this-&gt;connection) &amp;&amp; empty($this-&gt;connection))
+			return false;
+		$this-&gt;setMysqlMode($mode);
+		$this-&gt;resultSet = $this-&gt;connection-&gt;executeSQL($sql);
+		while ($row = mysql_fetch_array($this-&gt;resultSet, $this-&gt;mode)) {
+			$dataSet[] = $row;
+		}
+		$this-&gt;setDataSet($dataSet);
+		$this-&gt;setPointer(0);
+		return true;
+	}
+	
+	public function num_rows() {
+		if (!isset($this-&gt;resultSet) &amp;&amp; empty($this-&gt;resultSet))
+			return 0;
+		return $this-&gt;getConnection()-&gt;num_rows($this-&gt;resultSet);
+	}
+	
+	public function affected_rows() {
+		if (!isset($this-&gt;resultSet) &amp;&amp; empty($this-&gt;resultSet))
+			return false;
+		return $this-&gt;getConnection()-&gt;affected_rows();
+	}
+	
+	public function moveFirst() {
+		$this-&gt;pointer = 0;
+	}
+	
+	public function moveNext() {
+		$this-&gt;pointer++;
+	}
+	
+	public function movePrev() {
+		$this-&gt;pointer--;
+	}
+	
+	public function moveLast() {
+		$this-&gt;pointer = $this-&gt;num_rows() - 1;
+	}
+	
+	public function getLast() {
+		return $this-&gt;num_rows() - 1;
+	}
+	
+	public function fetch_row($rowNumber) {
+		if (!isset($this-&gt;dataSet) &amp;&amp; !isset($this-&gt;dataSet[$rowNumber]))
+			return false;
+		return $this-&gt;dataSet[$rowNumber];
+	}
+	
+	public function fetch() {
+		$point = $this-&gt;getPointer();
+		$this-&gt;moveNext();
+		if ($point &gt; $this-&gt;getLast()) {
+			$this-&gt;moveFirst();
+			return false;
+		}
+		return $this-&gt;fetch_row($point);
+	}
+	
+//	@TODO: Create this method
+	public function getErrorMsg() {
+		return $this-&gt;getConnection()-&gt;getErrorMsg();
+	}
+	
+	public function getDataSet() {
+		return $this-&gt;dataSet;
+	}
+	
+	public function setDataSet(array $dataSet) {
+		$this-&gt;dataSet = $dataSet;
+	}
+	
+	public function getPointer() {
+		return $this-&gt;pointer;
+	}
+	
+	public function setPointer($pointer) {
+		$this-&gt;pointer = $pointer;
 	}
-	
-	public function setPointer($pointer) {
-		$this-&gt;pointer = $pointer;
-	}
-}
-?&gt;
\ No newline at end of file
+}
+?&gt;</diff>
      <filename>app/libs/Dialect/MySQL.php</filename>
    </modified>
    <modified>
      <diff>@@ -119,5 +119,5 @@ abstract class PhpBURN {
 	}
 
 }
-PhpBURN::load('Configuration','Connection', 'IPhpBurn', 'Core', 'Dialect', 'Mapping');
-?&gt;
\ No newline at end of file
+PhpBURN::load('Configuration','Connection', 'IPhpBurn', 'Core', 'Dialect', 'Mapping','Exception','Message');
+?&gt;</diff>
      <filename>app/phpBurn.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6dc15916cba7577dcc4ded77a067325dbac8a964</id>
    </parent>
    <parent>
      <id>673c9e6f6dc76984c21a1bb40b0771e6aa321286</id>
    </parent>
  </parents>
  <author>
    <name>Klederson Bueno</name>
    <email>klederson@klederson.com</email>
  </author>
  <url>http://github.com/klederson/phpburn/commit/4aac0d2619b358543e981dac21aa25457250476a</url>
  <id>4aac0d2619b358543e981dac21aa25457250476a</id>
  <committed-date>2009-01-26T04:48:32-08:00</committed-date>
  <authored-date>2009-01-26T04:48:32-08:00</authored-date>
  <message>Several improvements</message>
  <tree>e41466e2b7ffd73ddcc01fbfdc6afbc4beb1ba60</tree>
  <committer>
    <name>Klederson Bueno</name>
    <email>klederson@klederson.com</email>
  </committer>
</commit>
