- Seme Framework
- version 4.0.3
- Requirements
- Download & Install
- Configuration
- Tutorials
- URI Routing
- Constants
- Global Variables
- Model
- View
- Controller
- cdn_url
- config
- constructor
- getAdditional
- getAdditionalBefore
- getAdditionalAfter
- getAuthor
- getCanonical
- getContentLanguage
- getDescription
- getIcon
- getJsContent
- getJsFooter
- getJsReady
- getKey
- getKeyword
- getLang
- getRobots
- getShortcutIcon
- getThemeElement
- getTitle
- input
- lib
- load
- loadCss
- loadLayout
- putThemeContent
- putJsContent
- putJsFooter
- putJsReady
- render
- resetThemeContent
- session
- setAuthor
- setCanonical
- setContentLanguage
- setDescription
- setIcon
- setKey
- setKeyword
- setLang
- setShortcutIcon
- setTheme
- setTitle
- Library
- CLI (command line interface)
- Core
- Issue
- Deployment
Exec Method
The exec
method is used for executing raw SQL against the table.
Basic Usage
Here is the basic usage exec
method from $db
property on SENE_Model class.
$this->db->exec(string $sql): boolean
Parameters
This method has 1 required parameter.
$sql
The $sql value can be a completed single command of SQL
.
Example
Here is the example for exec
method in a model class.
class C_Produk_Model extends SENE_Model {
var $tbl = 'c_produk';
var $tbl_as = 'cp';
public function __construct(){
parent::__construct();
$this->db->from($this->tbl,$this->tbl_as);
}
...
public function unpublishOldProduct($id){
$sql = 'UPDATE '.$this->tbl.' SET is_published = 0 WHERE DATE(date_created) < DATE("2019-01-01")';
return $this->db->exec($sql);
}
...
}