function create(array $data = null, $returning = "*") {
		$query = $this->getQueryWriter()->reset();
		$query->write("INSERT INTO", $this->conn->quoteName($this->name));
		if ($data) {
			$first = true;
			$params = array();
			foreach ($data as $key => $val) {
				$query->write($first ? "(" : ",", $key);
				$params[] = $query->param($val, $this->getAttributes()->getColumn($key)->type);
				$first and $first = false;
			}
			$query->write(") VALUES (", $params, ")");
		} else {
			$query->write("DEFAULT VALUES");
		}
		
		if (strlen($returning)) {
			$query->write("RETURNING", $returning);
		}
		return $this->execute($query);
	}
function create(array $data = null, $returning = "*") {
		$query = $this->getQueryWriter()->reset();
		$query->write("INSERT INTO", $this->conn->quoteName($this->name));
		if ($data) {
			$first = true;
			$params = array();
			foreach ($data as $key => $val) {
				$query->write($first ? "(" : ",", $key);
				$params[] = $query->param($val, $this->getAttributes()->getColumn($key)->type);
				$first and $first = false;
			}
			$query->write(") VALUES (", $params, ")");
		} else {
			$query->write("DEFAULT VALUES");
		}
		
		if (strlen($returning)) {
			$query->write("RETURNING", $returning);
		}
		return $this->execute($query);
	}
function create ( array $ data = null , $ returning = "*" ) { $ query = $ this -> getQueryWriter ( ) -> reset ( ) ; $ query -> write ( "INSERT INTO" , $ this -> conn -> quoteName ( $ this -> name ) ) ; if ( $ data ) { $ first = true ; $ params = array ( ) ; foreach ( $ data as $ key => $ val ) { $ query -> write ( $ first ? "(" : "," , $ key ) ; $ params [ ] = $ query -> param ( $ val , $ this -> getAttributes ( ) -> getColumn ( $ key ) -> type ) ; $ first and $ first = false ; } $ query -> write ( ") VALUES (" , $ params , ")" ) ; } else { $ query -> write ( "DEFAULT VALUES" ) ; } if ( strlen ( $ returning ) ) { $ query -> write ( "RETURNING" , $ returning ) ; } return $ this -> execute ( $ query ) ; }
Insert a row into the table
@param array $data
@param string $returning
@return mixed
Insert a row into the table