예제 #1
0
 /**
  * execution of a prepared statement. 
  *
  * @param string $sql the sql query
  * @param mixed[] $inputs the variables of the prepared statement
  * @return mixed[] $dataquery array containing the newle created dataset.
  */
 public function execute($sql, $inputs = array())
 {
     $db = madr_mvc_model_db_singleton::instance();
     $query = $db->prepare($sql);
     $query->setFetchMode(PDO::FETCH_NAMED);
     count($inputs) == 0 ? $query->execute() : $query->execute($inputs);
     return $query->fetchAll();
 }
예제 #2
0
 public static function instance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_DATABASE, DB_UID, DB_PW);
         self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
         self::$instance->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1);
     }
     return self::$instance;
 }
예제 #3
0
/**
 * the initiation of the application
 * 
 * @author Anders Ytterström <*****@*****.**>
 * @name init.php
 * @since 2006-07-29
 * @version 1.0
 * @package library
 */
// Includes
require '../application/constants.php';
define('SECURE_ACTION_PATH', 'https://' . ROOT_PATH . 'application/controllers/');
define('ACTION_PATH', ROOT_PATH . 'application/controllers/');
define('VIEW_PATH', ROOT_PATH . 'application/views');
define('MODEL_PATH', ROOT_PATH . 'application/models/');
define('PLUGIN_PATH', ROOT_PATH . 'application/plugins/');
define('CACHE_PATH', ROOT_PATH . 'cache/');
define('CLASS_PATH', ROOT_PATH . 'madr/classes');
define('FCT_PATH', ROOT_PATH . 'madr/functions/');
require FCT_PATH . 'common.php';
require FCT_PATH . 'handlers.php';
// Basic configuration
set_time_limit(15);
setlocale(LC_ALL, 'sv_SE');
date_default_timezone_set('Europe/Stockholm');
error_reporting(SHOW_DEBUGGING_INFO ? E_ALL | E_STRICT : 0);
// database connection
$db = madr_mvc_model_db_singleton::instance();
// Initiate the session
@session_start();
예제 #4
0
 /**
  * execution of a prepared statement. 
  *
  * @param string $sql the sql query
  * @param mixed[] $inputs the variables of the prepared statement
  * @return mixed[] $dataquery array containing the newle created dataset.
  */
 public function execute($sql, $inputs = array())
 {
     $db = madr_mvc_model_db_singleton::instance();
 }
예제 #5
0
 /**
  * execute sql-query
  *
  * @param string $sql the prepared sql-query
  * @param mixed[] $inputs the inputs for the array
  */
 protected function execute($sql, $inputs = array())
 {
     $db = madr_mvc_model_db_singleton::instance();
     $query = $db->prepare($sql);
     count($inputs) == 0 ? $query->execute() : $query->execute($inputs);
 }