예제 #1
0
    public function __construct()
    {
        // Make a parent::CALL;
        parent::__construct();
        $this->objConfigurationFile = new S();
        $this->objConfigArray = new A();
        // Auto-DB-Config:
        $this->getQuery(new S('CREATE TABLE IF NOT EXISTS `_T_configuration` (`k` varchar(255) NOT NULL, `v` longtext NOT NULL,
	    PRIMARY KEY  (`k`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;'));
    }
예제 #2
0
 /**
  * Will execute necessary SQL operations on the current form ...
  *
  * This method, setSQLOperationsOnForm, you don't need to know the internal workings of it. This is because, as you can see
  * it is a private method, and thus, it's used internally by the class, to achieve it's goals of execution. Just pass on
  * and read any other 'public' or 'protected' method out there ...
  *
  * @param array $inputAttributes The core attributes (found in every HTML element) that can be set;
  * @param string $tp The path to the .tp file where to set those variables;
  */
 private static final function updateObjectPropertiesonSQLUpdateorInsert()
 {
     if (isset(self::$objFormDataContainer['update_or_insert']) && isset(self::$objFormDataContainer['table_name'])) {
         if (isset(self::$objFormDataContainer['update_where'])) {
             // Set it to what ever the developer wants it set to ...
             self::$objUpdateWhere = self::$objFormDataContainer['update_where'];
         } else {
             self::$objUpdateWhere = new S('%who = "%what"');
             self::$objUpdateWhere->doToken('%who', self::$objUpdateUpdateField);
             self::$objUpdateWhere->doToken('%what', self::$objUpdateUpdateId);
         }
         // Check to see which operation to execute ...
         if (self::$objFormDataContainer['update_or_insert'] == new S('update')) {
             // Do we have multiple or simple updates ...
             if (isset(self::$objFormDataContainer['table_join_on']) && isset(self::$objFormDataContainer['table_save_into'])) {
                 self::$objUpdateTableName = new S(self::$objFormDataContainer['table_name'] . _SP . self::$objFormDataContainer['table_join_on']);
                 $updateTable = self::$objFormDataContainer['table_save_into']->toValues();
                 $updateTableCount = count($updateTable);
                 $updateTable[$updateTableCount++] = self::$objFormDataContainer['table_name'];
                 for ($i = 0; $i < $updateTableCount; ++$i) {
                     self::$objUpdateTableFields = new A(array_merge(self::$objUpdateTableFields->toArray(), self::getFieldsFromTable(new S($updateTable[$i]))->toArray()));
                 }
             } else {
                 self::$objUpdateTableName = self::$objFormDataContainer['table_name'];
                 self::$objUpdateTableFields = self::getFieldsFromTable(self::$objUpdateTableName);
             }
         }
         if (!self::checkPOST()->toBoolean() == TRUE) {
             $q = new S('SELECT * FROM %table WHERE %condition LIMIT 1');
             $q->doToken('%table', self::$objUpdateTableName)->doToken('%condition', self::$objUpdateWhere);
             self::$objUpdateSELECTData = self::getQuery($q);
         }
     }
 }