diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..c86aeb5
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,48 @@
+language: php
+
+php:
+ - '5.5'
+ - '5.6'
+ - '7.0'
+ - hhvm
+ - nightly
+
+install:
+ - composer install
+
+env:
+ - DB=mysql
+ - DB=pgsql POSTGRESQL_VERSION=9.1
+ - DB=pgsql POSTGRESQL_VERSION=9.2
+ - DB=pgsql POSTGRESQL_VERSION=9.3
+ - DB=pgsql POSTGRESQL_VERSION=9.4
+
+before_script:
+ - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database qcubed;'; mysql -u root qcubed < test/db/mysql_innodb.sql; fi"
+ - sh -c "if [ '$DB' = 'pgsql' ]; then createdb qcubed -U postgres; psql -d qcubed -f test/db/pgsql.sql -U postgres; fi"
+
+script:
+ - ./vendor/bin/phpunit -c ./test/phpunit.xml --coverage-clover ./build/logs/clover.xml
+
+# code coverage
+addons:
+ code_climate:
+ repo_token: 814dfe2ee0ae6198e43e566e32ab85f40379b5abe06cd52b1f6a24e92b5de883
+
+# code coverage
+after_script:
+ - vendor/bin/test-reporter
+
+sudo: false
+
+matrix:
+ exclude:
+ - php: hhvm
+ env: DB=pgsql POSTGRESQL_VERSION=9.1 # driver currently unsupported by HHVM
+ - php: hhvm
+ env: DB=pgsql POSTGRESQL_VERSION=9.2 # driver currently unsupported by HHVM
+ - php: hhvm
+ env: DB=pgsql POSTGRESQL_VERSION=9.3 # driver currently unsupported by HHVM
+ - php: hhvm
+ env: DB=pgsql POSTGRESQL_VERSION=9.4 # driver currently unsupported by HHVM
+
diff --git a/LICENSE b/LICENSE
index 06996eb..1c1961a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2017 Shannon
+Copyright (c) 2017 Shannon Pekary spekary@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index 0d0118a..4839cc3 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,2 @@
-# qcubed-orm
+# QCubed Orm
QCubed Standalone ORM
diff --git a/composer.json b/composer.json
index 26eec7d..35aeb83 100644
--- a/composer.json
+++ b/composer.json
@@ -1,4 +1,11 @@
{
+ "repositories": [
+ {
+ "type": "vcs",
+ "url": "https://github.com/qcubed/common"
+ }
+ ],
+
"name": "qcubed/orm",
"description": "Database drivers, query support, and code generator for the object relational model for QCubed",
"keywords": ["php", "database", "orm"],
@@ -12,14 +19,14 @@
},
"require": {
"php": ">=5.5.0",
- "qcubed/common": "^4.0"
+ "qcubed/common": "dev-master"
+ },
+ "require-dev" : {
+ "phpunit/phpunit": "~4.8|~5.0"
},
"autoload": {
"psr-4": {
- "QCubed\\Database": "src/Database",
- "QCubed\\Query": "src/Query",
- "QCubed\\Codegen": "src/Codegen"
-
+ "QCubed\\": "src/"
}
}
}
diff --git a/install/project/includes/Codegen.php b/install/project/includes/Codegen.php
index ad33d0c..295ef22 100644
--- a/install/project/includes/Codegen.php
+++ b/install/project/includes/Codegen.php
@@ -1,6 +1,6 @@
Format parameter after
-creating the control, or specify this in an override in a Comment option.
-
-
-
-
-
-
diff --git a/install/project/includes/configuration/_LICENSE.txt b/install/project/includes/configuration/_LICENSE.txt
deleted file mode 100644
index 1932c41..0000000
--- a/install/project/includes/configuration/_LICENSE.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-Unless otherwise specified, all files in the QCubed Development Framework
-are under the following copyright and licensing policies:
-
-The QCubed Development Framework is distributed by the QCubed Project
-under the terms of the MIT License. More information can be found at
-http://www.opensource.org/licenses/mit-license.php
-
-Copyright (c) 2001 - 2009, Quasidea Development, LLC, QCubed Project
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
diff --git a/install/project/includes/configuration/_README.txt b/install/project/includes/configuration/_README.txt
deleted file mode 100644
index c05e9c1..0000000
--- a/install/project/includes/configuration/_README.txt
+++ /dev/null
@@ -1,102 +0,0 @@
-This is the central location for all included configuration files. Feel free to include
-any new classes or include files in this directory.
-
-
-
-**** configuration.inc.php ****
-
-This contains server-level configuration information (e.g. database connection
-information, docroot paths (including subfoldering and virtual directories),
-etc. A sample file is provided for you, and is used by the QCubed startup wizard
-to create an initial version. Feel free to make modifications to this file to have it reflect the
-configuration of your application, including any global defines that are particular to your application.
-
-See the inline documentation in configuration.sample.inc.php for more information.
-
-
-
-**** prepend.inc.php ****
-
-This is the top-level include file for any and all PHP scripts which use
-Qcubed. Global, application-wide loaders, settings, etc. are in this file.
-
-Feel free to make modifications/changes/additions to this file as you wish.
-Note that the QApplication class is defined in prepend.inc as well. Feel free
-to make changes, override methods, or add functionality to QApplication as
-needed.
-
-See the inline documentation in prepend.inc.php for more information.
-
-
-**** codegen_settings.xml ****
-
-This file controls overall settings for parts of the code generation. Feel free
-to change these as needed.
-
-
-**** codegen_options.json ****
-
-This file is created and maintained by the ModelConnectorEditor. It has options for
-the individual controls that correspond to fields in your database. There may be times
-that you need to directly edit this file, and you should feel free to do so.
-
-**** Codegen Notes ****
-
-QCubed is set up to generate a default set of objects and forms to get you started with your application.
-This is called “codegen”. The notes below will help you understand the process and how to customize it to your needs.
-Ideally, you should customize the codegen process first before starting to write you application code,
-but we know that development does not go always as planned, and the whole QCubed system is set up so that you can
-separate out your hand written code from the generated code, and continue to tweak the codegen process and re-generate code at any time.
-
-The codegen process starts at the QCubed start screen by clicking on the codegen link.
-PHP is executed to generate the files. Therefore, the target directories for codegen will need to be writable by the web server process.
-
-The codegen process works by instantiating a QCodeGen object. This object then looks in the template directories and begins
-to include the php files there that start with an underscore (_). These templates then include other files, which in turn
-may include other template files. This combination will eventually generate the forms, model connectors, and data table
-interface classes that you will base your application on.
-
-
-Model Connectors
-Model Connectors are helper classes that have methods which connect form controls to columns in SQLn data tables. Each column
-in the data table corresponds to a control that is generated in a model connector class. Your form object calls methods
-in the model connector to get copies of the controls and then to place them in the form.
-
-To customize the generated controls, you have the following choices:
-- Use the ModelConnectorEditor (see the example on this), to set specific options on each control.
-- Create your own code generating templates and place them in your project/includes/codegen/templates directory. Its best
- to do this by copying the corresponding file in the qcubed/framework/includes/codegen/templates directory and then
- editing the file and placing it in the corresponding location in the above project directory. The project directory
- files will override the files in the vendor directory.
-- Override the generated code by editing the model connectors in your project/includes/connector directory.
-
-
-Version 3
-
-QCubed Version 3 introduces the concept of having the controls themselves create the code to interact with the database
-for the ModelConnector, rather than the templates. Coupled with this is the ModelConnectorEditDlg dialog, which lets you
-right click on a control and edit many of the controls options. These changes get embedded into the generated ModelConnector.
-You can see a description of each option by hovering over the item in the dialog.
-
-These new features give the developer the ability to do the following:
-- Override the default control type to specify a particular control type
-- Allow custom controls and plugins to generate their own model connector code and have that code automatically be used
- instead of the default code just by specifying that control in the comments of a column.
-- Allow subclasses of standard controls to override the code generation methods to generate different code.
-- Specify additional overrides to control many aspects of control creation in the generated model connector.
-
-Notes for Upgrading from version 2
-
-Many of the problems that caused programmers to create their own templates are now solvable through the new Options
-feature available through Comments. However, you are still free to override the templates as needed. In fact, this new
-feature is implemented entirely through the templates, so if you want to keep your old templates, simply replace the new
-templates with the old ones from version 2.
-
-QLabel no longer accepts a strFormat parameter at create time. You can always set it using the ->Format parameter after
-creating the control, or specify this in an override in a Comment option.
-
-
-
-
-
-
diff --git a/install/project/includes/configuration/active/assets.cfg.php b/install/project/includes/configuration/active/assets.cfg.php
deleted file mode 100644
index 30b9f24..0000000
--- a/install/project/includes/configuration/active/assets.cfg.php
+++ /dev/null
@@ -1,78 +0,0 @@
- 'MySqli5',
+ 'adapter' => 'Mysqli5',
'server' => 'db',
'port' => null,
'database' => 'qcubed',
diff --git a/install/project/includes/configuration/active/directories.cfg.php b/install/project/includes/configuration/active/directories.cfg.php
deleted file mode 100644
index 31d9cea..0000000
--- a/install/project/includes/configuration/active/directories.cfg.php
+++ /dev/null
@@ -1,44 +0,0 @@
-
diff --git a/install/project/includes/configuration/configuration.inc.sample.php b/install/project/includes/configuration/configuration.inc.sample.php
deleted file mode 100644
index 8295682..0000000
--- a/install/project/includes/configuration/configuration.inc.sample.php
+++ /dev/null
@@ -1,435 +0,0 @@
- '{db1_adapter}',
- 'server' => '{db1_serverAddress}',
- 'port' => '{db1_serverport}',
- 'database' => '{db1_dbname}',
- 'username' => '{db1_username}',
- 'password' => '{db1_password}',
- 'caching' => false,
- 'profiling' => false)));
- -->*/
-
- // Additional Database Connection Strings can be defined here (e.g. for connection #2, #3, #4, #5, etc.)
- // define('DB_CONNECTION_2', serialize(array('adapter'=>'SqlServer', 'server'=>'localhost', 'port'=>null, 'database'=>'qcubed', 'username'=>'root', 'password'=>'', 'profiling'=>false)));
- // define('DB_CONNECTION_3', serialize(array('adapter'=>'MySqli', 'server'=>'localhost', 'port'=>null, 'database'=>'qcubed', 'username'=>'root', 'password'=>'', 'profiling'=>false)));
- // define('DB_CONNECTION_4', serialize(array('adapter'=>'MySql', 'server'=>'localhost', 'port'=>null, 'database'=>'qcubed', 'username'=>'root', 'password'=>'', 'profiling'=>false)));
- // define('DB_CONNECTION_5', serialize(array('adapter'=>'PostgreSql', 'server'=>'localhost', 'port'=>null, 'database'=>'qcubed', 'username'=>'root', 'password'=>'', 'profiling'=>false)));
- // define('DB_CONNECTION_6', serialize(array('adapter' => 'InformixPdo', 'host' => 'maxdata', 'server' => 'maxdata', 'service' => 9088, 'protocol' => 'onsoctcp', 'database' => 'qcubed', 'username' => 'root', 'password' => '', 'profiling' => false)));
-
- // Maximum index of the DB connections defined by DB_CONNECTION_# constants above
- // When reading the DB_CONNECTION_# constants, it will only go up to (and including) the index defined here
- // See ApplicationBase::InitializeDatabaseConnections()
- define ('MAX_DB_CONNECTION_INDEX', 1);
-
- /** The value for QApplication::$EncodingType constant */
- define('__APPLICATION_ENCODING_TYPE__', 'UTF-8');
-
- // (For PHP > v5.1) Setup the default timezone (if not already specified in php.ini)
- if ((function_exists('date_default_timezone_set')) && (!ini_get('date.timezone')))
- date_default_timezone_set('America/Los_Angeles');
-
-
- /*
- * Caching support for QCubed (Vaibhav Kaushal Jan 21, 2012)
- * Determines which class as a Cache Provider. It should be a subclass of QAbstractCacheProvider.
- * Setting it to null will disable caching. Current implentations are
- *
- * "QCacheProviderMemcache": this will use Memcache as the caching provider.
- * You must have the 'php5-memcache' package installed for this provider to work.
- *
- * "QCacheProviderLocalMemory": a local memory cache provider with a lifespan of the request
- * or session (if KeepInSession is configured).
- *
- * "QCacheProviderAPC": supports the APC interface. To use it, use PECL to install either
- * APC or APCu.
- *
- * "QCacheProviderNoCahce": provider which does no caching at all
- *
- * "QMultiLevelCacheProvider": a provider that can combine multiple providers into one.
- * This can be used for example to combine the LocalMemory cache provider with the Memcache based provider.
- */
- define("CACHE_PROVIDER_CLASS", null);
-
- /*
- * Options passed to the constructor of the Caching Provider class above.
- * For QCacheProviderMemcache, it's an array, where each item is an associative array of
- * server configuration options.
- * Please see the documentation for the constructor for each provider for a description of the accepted
- * options.
- */
- define ('CACHE_PROVIDER_OPTIONS' , serialize(
- array(
- array('host' => '127.0.0.1', 'port' => 11211, ),
- //array('host' => '10.0.2.2', 'port' => 11211, ), // adds a second server
- )
- ) );
-
- /*
- * Support for Watchers and automated updating of objects that display the results of table queries.
- *
- * The preferred way to setup your watcher is to make changes to the
- * public/includes/controls/QWatcher.class.php file. However, you can also set up your watcher here
- * using the following define. The main purpose of the define is to help with automated testing
- * and the examples site.
- */
- //define ('WATCHER_CLASS', 'QWatcherDB');
-
- /* Form State Handler. Determines which class is used to serialize the form in-between Ajax callbacks.
- *
- * Possible values are:
- * "QFormStateHandler": This is the "standard" FormState handler, storing the base64 encoded session data
- * (and if requested by QForm, encrypted) as a hidden form variable on the page, itself.
- *
- * "QSessionFormStateHandler": Simple Session-based FormState handler. Uses PHP Sessions so it's very straightforward
- * and simple, utilizing the session handling and cleanup functionality in PHP, itself.
- * The downside is that for long running sessions, each individual session file can get
- * very, very large, storing all hte various formstate data. Eventually (if individual
- * session files are larger than 10MB), you can theoretically observe a geometrical
- * degradation of performance.
- *
- * "QFileFormStateHandler": This will store the formstate in a pre-specified directory (__FILE_FORM_STATE_HANDLER_PATH__)
- * on the file system. This offers significant speed advantage over PHP SESSION because EACH
- * form state is saved in its own file, and only the form state that is needed for loading will
- * be accessed (as opposed to with session, ALL the form states are loaded into memory
- * every time).
- * The downside is that because it doesn't utilize PHP's session management subsystem,
- * this class must take care of its own garbage collection/deleting of old/outdated
- * formstate files.
- *
- * "QDbBackedFormStateHandler": This will store the formstate in a predefined table in one of the DBs in the array above.
- * It provides a way to maintain the FormStates without creating too many files on the server.
- * It also makes sure that the application remains fast and provides all the features of QFileFormStateHandler.
- * The algorithm to periodically clean up the DB is also provided (just like QFileFormStateHandler) .
- *
- * To use the QDbBackedFormStateHandler, the following two constants must be defined:
- * 1. __DB_BACKED_FORM_STATE_HANDLER_DB_INDEX__ : It is the numerical index of the DB from the list of DBs defined
- * above where the table to store the FormStates is present. Note, it is the numerical Index, not the DB name.
- * e.g. If it is present in the DB_CONNECTION_1, then the value must be defined as '1'.
- * 2. __DB_BACKED_FORM_STATE_HANDLER_TABLE_NAME__ : It is the name of the table where the FormStates must be stored
- * It must have following 4 columns:
- * i) page_id: varchar(80) - It must be the primary key.
- * ii) save_time: integer - This column should be indexed for performance reasons
- * iii) session_id: varchar(32) - This column should be indexed for performance reasons
- * iv) state_data: text - This column must NOT be indexed otherwise it will degrade the performance.
- *
- * NOTE: Formstates can be large, depending on the complexity of your forms.
- * For MySQL, you might have to increase the max_allowed_packet variable in your my.cnf file to the maximum size of a formstate.
- * Also for MySQL, you should choose a MEDIUMTEXT type of column, rather than TEXT. TEXT is limited to 64KB,
- * which will not be big enough for moderately complex forms, and will result in data errors.
- */
- define('__FORM_STATE_HANDLER__', 'QSessionFormStateHandler');
-
- // If using the QFileFormStateHandler, specify the path where QCubed will save the session state files (has to be writeable!)
- define('__FILE_FORM_STATE_HANDLER_PATH__', __PROJECT__ . '/tmp');
-
- // If using the QDbBackedSessionHandler, define the DB index where the table to store the formstates is present
- define('__DB_BACKED_FORM_STATE_HANDLER_DB_INDEX__', 1);
- // If using QDbBackedSessionHandler, specify the table name which would hold the formstates (must meet the requirements laid out above)
- define('__DB_BACKED_FORM_STATE_HANDLER_TABLE_NAME__', 'qc_formstate');
-
-
- /*
- * QCubed allows you to save / read / write your user PHP sessions in a database.
- * This is immensely helpful when you want to develop your QCubed based application
- * to support running on two different web servers with same data backends or with load balancing.
- * If you are using QSessionFormStateHandler, it also automatically centralizes your formstates.
- *
- * To avail this feature, you must have a dedicated table in one of your databases above.
- * The table must have 3 columns with follwing names and datatypes (note that column names should match exactly):
- *
- * [Column 1]
- * Name = id
- * Data Type = varchar / character with variable length. Must hold session number + session name. Typically this is 34 characters, but
- * you should make it big enough to handle any situation you may encounter.
- *
- * [Column 2]
- * Name = last_access_time
- * Data type = integer
- *
- * [Column 3]
- * Name = data
- * Data type = text
- *
- * For this to work, we need to know two things:
- * 1. The DB_CONNECTION index (repeat: the numerical index) of the database from the list of databases above
- * where this table is located.
- * 2. The name of the table in the database.
- *
- * Notes:
- * 1. if you do not want to use this feature, set the value of DB_BACKED_SESSION_HANDLER_DB_INDEX to 0.
- * 2. It is recommended that you create a primary key on the 'id' field and an index on the 'last_access_time' field
- * to speed up the database queries.
- * 3. This feature does not make use of the codegen feature. So you may exclude this table from being codegened.
- */
- // The database index where the Session storage tables are present. Remember, define it as an integer.
- define("DB_BACKED_SESSION_HANDLER_DB_INDEX", 0);
-
- // The table name to be used for session data storage (must meet the requirements laid out above)
- define("DB_BACKED_SESSION_HANDLER_TABLE_NAME", "qc_session");
-
- // Define the Filepath for the error page (path MUST be relative from the DOCROOT)
- define('ERROR_PAGE_PATH', __PHP_ASSETS__ . '/error_page.php');
-
- // Define the Filepath for any logged errors
- define('ERROR_LOG_PATH', __TMP__ . '/error_log');
-
- // Name of session variable used to save the state of form objects.
- define('__SESSION_SAVED_STATE__', 'QSavedState');
-
- // To Log ALL errors that have occurred, set flag to true
- // define('ERROR_LOG_FLAG', true);
-
- // To enable the display of "Friendly" error pages and messages, define them here (path MUST be relative from the DOCROOT)
- // define('ERROR_FRIENDLY_PAGE_PATH', __PHP_ASSETS__ . '/friendly_error_page.php');
- // define('ERROR_FRIENDLY_AJAX_MESSAGE', 'Oops! An error has occurred.\r\n\r\nThe error was logged, and we will take a look into this right away.');
-
- // If using HTML Purifier, the location of the writeable cache directory.
- define ('__PURIFIER_CACHE__', __CACHE__ . '/purifier');
-
- /** Uncomment if you are using QTimer to do performance testing. Will automatically output the results of your timers to the file. */
- //define ('__TIMER_OUT_FILE__', __TMP__ . '/timers.txt');
- break;
- }
-}
-?>
diff --git a/install/project/includes/configuration/footer.inc.php b/install/project/includes/configuration/footer.inc.php
deleted file mode 100644
index 0b2cee4..0000000
--- a/install/project/includes/configuration/footer.inc.php
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-