コード例 #1
0
ファイル: view.php プロジェクト: madr/urban-octo-rotary-phone
 /**
  * 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
ファイル: init.php プロジェクト: madr/urban-octo-rotary-phone
/**
 * 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
ファイル: view.php プロジェクト: madr/urban-octo-rotary-phone
 /**
  * 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);
 }