diff --git a/ext/phalcon/db/adapter/pdo.zep.c b/ext/phalcon/db/adapter/pdo.zep.c deleted file mode 100644 index 018fa4a529b..00000000000 --- a/ext/phalcon/db/adapter/pdo.zep.c +++ /dev/null @@ -1,1590 +0,0 @@ - -#ifdef HAVE_CONFIG_H -#include "../../../ext_config.h" -#endif - -#include -#include "../../../php_ext.h" -#include "../../../ext.h" - -#include -#include -#include - -#include "kernel/main.h" -#include "kernel/fcall.h" -#include "ext/spl/spl_exceptions.h" -#include "kernel/exception.h" -#include "kernel/memory.h" -#include "kernel/object.h" -#include "kernel/operators.h" -#include "kernel/array.h" -#include "kernel/concat.h" -#include "kernel/string.h" -#include "ext/pdo/php_pdo_driver.h" - - -/** - * This file is part of the Phalcon. - * - * (c) Phalcon Team - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -/** - * Phalcon\Db\Adapter\Pdo - * - * Phalcon\Db\Adapter\Pdo is the Phalcon\Db that internally uses PDO to connect - * to a database - * - * - * use Phalcon\Db\Adapter\Pdo\Mysql; - * - * $config = [ - * "host" => "localhost", - * "dbname" => "blog", - * "port" => 3306, - * "username" => "sigma", - * "password" => "secret", - * ]; - * - * $connection = new Mysql($config); - * - */ -ZEPHIR_INIT_CLASS(Phalcon_Db_Adapter_Pdo) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Db\\Adapter, Pdo, phalcon, db_adapter_pdo, phalcon_db_adapter_ce, phalcon_db_adapter_pdo_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - - /** - * Last affected rows - */ - zend_declare_property_null(phalcon_db_adapter_pdo_ce, SL("affectedRows"), ZEND_ACC_PROTECTED TSRMLS_CC); - - /** - * PDO Handler - * - * @var \Pdo - */ - zend_declare_property_null(phalcon_db_adapter_pdo_ce, SL("pdo"), ZEND_ACC_PROTECTED TSRMLS_CC); - - return SUCCESS; - -} - -/** - * Constructor for Phalcon\Db\Adapter\Pdo - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, __construct) { - - zephir_fcall_cache_entry *_0 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *descriptor_param = NULL; - zval descriptor; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&descriptor); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &descriptor_param); - - ZEPHIR_OBS_COPY_OR_DUP(&descriptor, descriptor_param); - - - ZEPHIR_CALL_METHOD(NULL, this_ptr, "connect", NULL, 0, &descriptor); - zephir_check_call_status(); - ZEPHIR_CALL_PARENT(NULL, phalcon_db_adapter_pdo_ce, getThis(), "__construct", &_0, 0, &descriptor); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); - -} - -/** - * Returns the number of affected rows by the latest INSERT/UPDATE/DELETE - * executed in the database system - * - * - * $connection->execute( - * "DELETE FROM robots" - * ); - * - * echo $connection->affectedRows(), " were deleted"; - * - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, affectedRows) { - - zval *this_ptr = getThis(); - - - RETURN_MEMBER(getThis(), "affectedRows"); - -} - -/** - * Starts a transaction in the connection - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, begin) { - - zend_long ZEPHIR_LAST_CALL_STATUS, transactionLevel = 0; - zval *nesting_param = NULL, pdo, eventsManager, savepointName, _0, _1, _6, _2$$4, _3$$5, _7$$7; - zend_bool nesting, _4, _5; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&pdo); - ZVAL_UNDEF(&eventsManager); - ZVAL_UNDEF(&savepointName); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$5); - ZVAL_UNDEF(&_7$$7); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &nesting_param); - - if (!nesting_param) { - nesting = 1; - } else { - nesting = zephir_get_boolval(nesting_param); - } - - - zephir_read_property(&_0, this_ptr, SL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&pdo, &_0); - if (Z_TYPE_P(&pdo) != IS_OBJECT) { - RETURN_MM_BOOL(0); - } - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("transactionLevel") TSRMLS_CC)); - ZEPHIR_OBS_VAR(&_1); - zephir_read_property(&_1, this_ptr, SL("transactionLevel"), PH_NOISY_CC); - transactionLevel = zephir_get_intval(&_1); - if (transactionLevel == 1) { - zephir_read_property(&_2$$4, this_ptr, SL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_2$$4); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_3$$5); - ZVAL_STRING(&_3$$5, "db:beginTransaction"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_3$$5, this_ptr); - zephir_check_call_status(); - } - ZEPHIR_RETURN_CALL_METHOD(&pdo, "begintransaction", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - } - _4 = !transactionLevel; - if (!(_4)) { - _4 = !nesting; - } - _5 = _4; - if (!(_5)) { - ZEPHIR_CALL_METHOD(&_6, this_ptr, "isnestedtransactionswithsavepoints", NULL, 0); - zephir_check_call_status(); - _5 = !zephir_is_true(&_6); - } - if (_5) { - RETURN_MM_BOOL(0); - } - zephir_read_property(&_0, this_ptr, SL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_0); - ZEPHIR_CALL_METHOD(&savepointName, this_ptr, "getnestedtransactionsavepointname", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_7$$7); - ZVAL_STRING(&_7$$7, "db:createSavepoint"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_7$$7, this_ptr, &savepointName); - zephir_check_call_status(); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "createsavepoint", NULL, 0, &savepointName); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Commits the active transaction in the connection - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, commit) { - - zend_long ZEPHIR_LAST_CALL_STATUS, transactionLevel = 0; - zval *nesting_param = NULL, pdo, eventsManager, savepointName, _0, _1, _6, _2$$5, _3$$6, _7$$9; - zend_bool nesting, _4, _5; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&pdo); - ZVAL_UNDEF(&eventsManager); - ZVAL_UNDEF(&savepointName); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_2$$5); - ZVAL_UNDEF(&_3$$6); - ZVAL_UNDEF(&_7$$9); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &nesting_param); - - if (!nesting_param) { - nesting = 1; - } else { - nesting = zephir_get_boolval(nesting_param); - } - - - zephir_read_property(&_0, this_ptr, SL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&pdo, &_0); - if (Z_TYPE_P(&pdo) != IS_OBJECT) { - RETURN_MM_BOOL(0); - } - ZEPHIR_OBS_VAR(&_1); - zephir_read_property(&_1, this_ptr, SL("transactionLevel"), PH_NOISY_CC); - transactionLevel = zephir_get_intval(&_1); - if (UNEXPECTED(!transactionLevel)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "There is no active transaction", "phalcon/Db/Adapter/Pdo.zep", 152); - return; - } - if (transactionLevel == 1) { - zephir_read_property(&_2$$5, this_ptr, SL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_2$$5); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_3$$6); - ZVAL_STRING(&_3$$6, "db:commitTransaction"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_3$$6, this_ptr); - zephir_check_call_status(); - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("transactionLevel") TSRMLS_CC)); - ZEPHIR_RETURN_CALL_METHOD(&pdo, "commit", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - } - _4 = !transactionLevel; - if (!(_4)) { - _4 = !nesting; - } - _5 = _4; - if (!(_5)) { - ZEPHIR_CALL_METHOD(&_6, this_ptr, "isnestedtransactionswithsavepoints", NULL, 0); - zephir_check_call_status(); - _5 = !zephir_is_true(&_6); - } - if (_5) { - if (transactionLevel > 0) { - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("transactionLevel") TSRMLS_CC)); - } - RETURN_MM_BOOL(0); - } - zephir_read_property(&_0, this_ptr, SL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_0); - ZEPHIR_CALL_METHOD(&savepointName, this_ptr, "getnestedtransactionsavepointname", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_7$$9); - ZVAL_STRING(&_7$$9, "db:releaseSavepoint"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_7$$9, this_ptr, &savepointName); - zephir_check_call_status(); - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("transactionLevel") TSRMLS_CC)); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "releasesavepoint", NULL, 0, &savepointName); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Closes the active connection returning success. Phalcon automatically - * closes and destroys active connections when the request ends - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, close) { - - zval __$null; - zval *this_ptr = getThis(); - - ZVAL_NULL(&__$null); - - - zephir_update_property_zval(this_ptr, SL("pdo"), &__$null); - RETURN_BOOL(1); - -} - -/** - * This method is automatically called in \Phalcon\Db\Adapter\Pdo - * constructor. - * - * Call it when you need to restore a database connection. - * - * - * use Phalcon\Db\Adapter\Pdo\Mysql; - * - * // Make a connection - * $connection = new Mysql( - * [ - * "host" => "localhost", - * "username" => "sigma", - * "password" => "secret", - * "dbname" => "blog", - * "port" => 3306, - * ] - * ); - * - * // Reconnect - * $connection->connect(); - * - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, connect) { - - zend_string *_7; - zend_ulong _6; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *descriptor_param = NULL, username, password, dsnParts, dsnAttributes, dsnAttributesCustomRaw, dsnAttributesMap, options, key, value, _2, _3, *_4, _5, _10, _11, _12, _0$$3, _8$$10, _9$$11; - zval descriptor, _1$$3; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&descriptor); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&username); - ZVAL_UNDEF(&password); - ZVAL_UNDEF(&dsnParts); - ZVAL_UNDEF(&dsnAttributes); - ZVAL_UNDEF(&dsnAttributesCustomRaw); - ZVAL_UNDEF(&dsnAttributesMap); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_10); - ZVAL_UNDEF(&_11); - ZVAL_UNDEF(&_12); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_8$$10); - ZVAL_UNDEF(&_9$$11); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &descriptor_param); - - if (!descriptor_param) { - ZEPHIR_INIT_VAR(&descriptor); - array_init(&descriptor); - } else { - zephir_get_arrval(&descriptor, descriptor_param); - } - - - if (ZEPHIR_IS_EMPTY(&descriptor)) { - ZEPHIR_OBS_VAR(&_0$$3); - zephir_read_property(&_0$$3, this_ptr, SL("descriptor"), PH_NOISY_CC); - zephir_get_arrval(&_1$$3, &_0$$3); - ZEPHIR_CPY_WRT(&descriptor, &_1$$3); - } - ZEPHIR_OBS_VAR(&username); - if (zephir_array_isset_string_fetch(&username, &descriptor, SL("username"), 0)) { - zephir_array_unset_string(&descriptor, SL("username"), PH_SEPARATE); - } - ZEPHIR_OBS_VAR(&password); - if (zephir_array_isset_string_fetch(&password, &descriptor, SL("password"), 0)) { - zephir_array_unset_string(&descriptor, SL("password"), PH_SEPARATE); - } - if (zephir_array_isset_string(&descriptor, SL("dialectClass"))) { - zephir_array_unset_string(&descriptor, SL("dialectClass"), PH_SEPARATE); - } - ZEPHIR_OBS_VAR(&options); - if (zephir_array_isset_string_fetch(&options, &descriptor, SL("options"), 0)) { - zephir_array_unset_string(&descriptor, SL("options"), PH_SEPARATE); - } else { - ZEPHIR_INIT_NVAR(&options); - array_init(&options); - } - ZEPHIR_INIT_VAR(&_2); - ZVAL_LONG(&_2, 2); - zephir_array_update_long(&options, 3, &_2, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); - ZEPHIR_INIT_VAR(&dsnParts); - array_init(&dsnParts); - ZEPHIR_OBS_VAR(&dsnAttributesCustomRaw); - if (zephir_array_isset_string_fetch(&dsnAttributesCustomRaw, &descriptor, SL("dsn"), 0)) { - zephir_array_append(&dsnParts, &dsnAttributesCustomRaw, PH_SEPARATE, "phalcon/Db/Adapter/Pdo.zep", 281); - zephir_array_unset_string(&descriptor, SL("dsn"), PH_SEPARATE); - } - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getdsndefaults", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&dsnAttributesMap); - zephir_fast_array_merge(&dsnAttributesMap, &_3, &descriptor TSRMLS_CC); - zephir_is_iterable(&dsnAttributesMap, 0, "phalcon/Db/Adapter/Pdo.zep", 301); - if (Z_TYPE_P(&dsnAttributesMap) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&dsnAttributesMap), _6, _7, _4) - { - ZEPHIR_INIT_NVAR(&key); - if (_7 != NULL) { - ZVAL_STR_COPY(&key, _7); - } else { - ZVAL_LONG(&key, _6); - } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _4); - ZEPHIR_INIT_LNVAR(_8$$10); - ZEPHIR_CONCAT_VSV(&_8$$10, &key, "=", &value); - zephir_array_append(&dsnParts, &_8$$10, PH_SEPARATE, "phalcon/Db/Adapter/Pdo.zep", 297); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &dsnAttributesMap, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_5, &dsnAttributesMap, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_5)) { - break; - } - ZEPHIR_CALL_METHOD(&key, &dsnAttributesMap, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, &dsnAttributesMap, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_LNVAR(_9$$11); - ZEPHIR_CONCAT_VSV(&_9$$11, &key, "=", &value); - zephir_array_append(&dsnParts, &_9$$11, PH_SEPARATE, "phalcon/Db/Adapter/Pdo.zep", 297); - ZEPHIR_CALL_METHOD(NULL, &dsnAttributesMap, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&key); - ZEPHIR_INIT_VAR(&dsnAttributes); - zephir_fast_join_str(&dsnAttributes, SL(";"), &dsnParts TSRMLS_CC); - ZEPHIR_INIT_VAR(&_10); - object_init_ex(&_10, php_pdo_get_dbh_ce()); - zephir_read_property(&_11, this_ptr, SL("type"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_12); - ZEPHIR_CONCAT_VSV(&_12, &_11, ":", &dsnAttributes); - ZEPHIR_CALL_METHOD(NULL, &_10, "__construct", NULL, 0, &_12, &username, &password, &options); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, SL("pdo"), &_10); - RETURN_MM_BOOL(1); - -} - -/** - * Converts bound parameters such as :name: or ?1 into PDO bind params ? - * - * - * print_r( - * $connection->convertBoundParams( - * "SELECT * FROM robots WHERE name = :name:", - * [ - * "Bender", - * ] - * ) - * ); - * - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, convertBoundParams) { - - zend_long ZEPHIR_LAST_CALL_STATUS, setOrder = 0; - zval params; - zval *sql_param = NULL, *params_param = NULL, boundSql, placeHolders, bindPattern, matches, placeMatch, value, _0, _1, _2, *_3$$3, _4$$3, _9$$3, _5$$4, _6$$5, _7$$8, _8$$9; - zval sql; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&boundSql); - ZVAL_UNDEF(&placeHolders); - ZVAL_UNDEF(&bindPattern); - ZVAL_UNDEF(&matches); - ZVAL_UNDEF(&placeMatch); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_4$$3); - ZVAL_UNDEF(&_9$$3); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&_6$$5); - ZVAL_UNDEF(&_7$$8); - ZVAL_UNDEF(&_8$$9); - ZVAL_UNDEF(¶ms); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &sql_param, ¶ms_param); - - if (UNEXPECTED(Z_TYPE_P(sql_param) != IS_STRING && Z_TYPE_P(sql_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sql' must be of the type string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(sql_param) == IS_STRING)) { - zephir_get_strval(&sql, sql_param); - } else { - ZEPHIR_INIT_VAR(&sql); - ZVAL_EMPTY_STRING(&sql); - } - if (!params_param) { - ZEPHIR_INIT_VAR(¶ms); - array_init(¶ms); - } else { - zephir_get_arrval(¶ms, params_param); - } - - - ZEPHIR_INIT_VAR(&placeHolders); - array_init(&placeHolders); - ZEPHIR_INIT_VAR(&bindPattern); - ZVAL_STRING(&bindPattern, "/\\?([0-9]+)|:([a-zA-Z0-9_]+):/"); - ZEPHIR_INIT_VAR(&matches); - ZVAL_NULL(&matches); - setOrder = 2; - ZVAL_LONG(&_0, setOrder); - ZEPHIR_INIT_VAR(&_1); - ZVAL_LONG(&_2, setOrder); - zephir_preg_match(&_1, &bindPattern, &sql, &matches, 1, zephir_get_intval(&_0) , 0 TSRMLS_CC); - if (zephir_is_true(&_1)) { - zephir_is_iterable(&matches, 0, "phalcon/Db/Adapter/Pdo.zep", 357); - if (Z_TYPE_P(&matches) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&matches), _3$$3) - { - ZEPHIR_INIT_NVAR(&placeMatch); - ZVAL_COPY(&placeMatch, _3$$3); - ZEPHIR_OBS_NVAR(&value); - zephir_array_fetch_long(&_5$$4, &placeMatch, 1, PH_READONLY, "phalcon/Db/Adapter/Pdo.zep", 340 TSRMLS_CC); - if (!(zephir_array_isset_fetch(&value, ¶ms, &_5$$4, 0 TSRMLS_CC))) { - if (UNEXPECTED(!(zephir_array_isset_long(&placeMatch, 2)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Matched parameter wasn't found in parameters list", "phalcon/Db/Adapter/Pdo.zep", 344); - return; - } - ZEPHIR_OBS_NVAR(&value); - zephir_array_fetch_long(&_6$$5, &placeMatch, 2, PH_READONLY, "phalcon/Db/Adapter/Pdo.zep", 347 TSRMLS_CC); - if (UNEXPECTED(!(zephir_array_isset_fetch(&value, ¶ms, &_6$$5, 0 TSRMLS_CC)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Matched parameter wasn't found in parameters list", "phalcon/Db/Adapter/Pdo.zep", 350); - return; - } - } - zephir_array_append(&placeHolders, &value, PH_SEPARATE, "phalcon/Db/Adapter/Pdo.zep", 354); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &matches, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_4$$3, &matches, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_4$$3)) { - break; - } - ZEPHIR_CALL_METHOD(&placeMatch, &matches, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&value); - zephir_array_fetch_long(&_7$$8, &placeMatch, 1, PH_READONLY, "phalcon/Db/Adapter/Pdo.zep", 340 TSRMLS_CC); - if (!(zephir_array_isset_fetch(&value, ¶ms, &_7$$8, 0 TSRMLS_CC))) { - if (UNEXPECTED(!(zephir_array_isset_long(&placeMatch, 2)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Matched parameter wasn't found in parameters list", "phalcon/Db/Adapter/Pdo.zep", 344); - return; - } - ZEPHIR_OBS_NVAR(&value); - zephir_array_fetch_long(&_8$$9, &placeMatch, 2, PH_READONLY, "phalcon/Db/Adapter/Pdo.zep", 347 TSRMLS_CC); - if (UNEXPECTED(!(zephir_array_isset_fetch(&value, ¶ms, &_8$$9, 0 TSRMLS_CC)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Matched parameter wasn't found in parameters list", "phalcon/Db/Adapter/Pdo.zep", 350); - return; - } - } - zephir_array_append(&placeHolders, &value, PH_SEPARATE, "phalcon/Db/Adapter/Pdo.zep", 354); - ZEPHIR_CALL_METHOD(NULL, &matches, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&placeMatch); - ZEPHIR_INIT_VAR(&_9$$3); - ZVAL_STRING(&_9$$3, "?"); - ZEPHIR_CALL_FUNCTION(&boundSql, "preg_replace", NULL, 38, &bindPattern, &_9$$3, &sql); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(&boundSql, &sql); - } - zephir_create_array(return_value, 2, 0 TSRMLS_CC); - zephir_array_update_string(return_value, SL("sql"), &boundSql, PH_COPY | PH_SEPARATE); - zephir_array_update_string(return_value, SL("params"), &placeHolders, PH_COPY | PH_SEPARATE); - RETURN_MM(); - -} - -/** - * Escapes a value to avoid SQL injections according to the active charset - * in the connection - * - * - * $escapedStr = $connection->escapeString("some dangerous value"); - * - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, escapeString) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *str_param = NULL, _0; - zval str; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&str); - ZVAL_UNDEF(&_0); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &str_param); - - zephir_get_strval(&str, str_param); - - - zephir_read_property(&_0, this_ptr, SL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "quote", NULL, 0, &str); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Sends SQL statements to the database server returning the success state. - * Use this method only when the SQL statement sent to the server doesn't - * return any rows - * - * - * // Inserting data - * $success = $connection->execute( - * "INSERT INTO robots VALUES (1, 'Astro Boy')" - * ); - * - * $success = $connection->execute( - * "INSERT INTO robots VALUES (?, ?)", - * [ - * 1, - * "Astro Boy", - * ] - * ); - * - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, execute) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *sqlStatement_param = NULL, *bindParams = NULL, bindParams_sub, *bindTypes = NULL, bindTypes_sub, __$null, eventsManager, affectedRows, pdo, newStatement, statement, _0, _1$$3, _2$$3, _3$$9; - zval sqlStatement; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&sqlStatement); - ZVAL_UNDEF(&bindParams_sub); - ZVAL_UNDEF(&bindTypes_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&eventsManager); - ZVAL_UNDEF(&affectedRows); - ZVAL_UNDEF(&pdo); - ZVAL_UNDEF(&newStatement); - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$9); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &sqlStatement_param, &bindParams, &bindTypes); - - if (UNEXPECTED(Z_TYPE_P(sqlStatement_param) != IS_STRING && Z_TYPE_P(sqlStatement_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlStatement' must be of the type string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(sqlStatement_param) == IS_STRING)) { - zephir_get_strval(&sqlStatement, sqlStatement_param); - } else { - ZEPHIR_INIT_VAR(&sqlStatement); - ZVAL_EMPTY_STRING(&sqlStatement); - } - if (!bindParams) { - bindParams = &bindParams_sub; - bindParams = &__$null; - } - if (!bindTypes) { - bindTypes = &bindTypes_sub; - bindTypes = &__$null; - } - - - zephir_read_property(&_0, this_ptr, SL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_0); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - zephir_update_property_zval(this_ptr, SL("sqlStatement"), &sqlStatement); - zephir_update_property_zval(this_ptr, SL("sqlVariables"), bindParams); - zephir_update_property_zval(this_ptr, SL("sqlBindTypes"), bindTypes); - ZEPHIR_INIT_VAR(&_2$$3); - ZVAL_STRING(&_2$$3, "db:beforeQuery"); - ZEPHIR_CALL_METHOD(&_1$$3, &eventsManager, "fire", NULL, 0, &_2$$3, this_ptr); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_1$$3)) { - RETURN_MM_BOOL(0); - } - } - ZEPHIR_INIT_VAR(&affectedRows); - ZVAL_LONG(&affectedRows, 0); - zephir_read_property(&_0, this_ptr, SL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&pdo, &_0); - if (Z_TYPE_P(bindParams) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&statement, &pdo, "prepare", NULL, 0, &sqlStatement); - zephir_check_call_status(); - if (Z_TYPE_P(&statement) == IS_OBJECT) { - ZEPHIR_CALL_METHOD(&newStatement, this_ptr, "executeprepared", NULL, 0, &statement, bindParams, bindTypes); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&affectedRows, &newStatement, "rowcount", NULL, 0); - zephir_check_call_status(); - } - } else { - ZEPHIR_CALL_METHOD(&affectedRows, &pdo, "exec", NULL, 0, &sqlStatement); - zephir_check_call_status(); - } - if (Z_TYPE_P(&affectedRows) == IS_LONG) { - zephir_update_property_zval(this_ptr, SL("affectedRows"), &affectedRows); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_3$$9); - ZVAL_STRING(&_3$$9, "db:afterQuery"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_3$$9, this_ptr); - zephir_check_call_status(); - } - } - RETURN_MM_BOOL(1); - -} - -/** - * Executes a prepared statement binding. This function uses integer indexes - * starting from zero - * - * - * use Phalcon\Db\Column; - * - * $statement = $db->prepare( - * "SELECT * FROM robots WHERE name = :name" - * ); - * - * $result = $connection->executePrepared( - * $statement, - * [ - * "name" => "Voltron", - * ], - * [ - * "name" => Column::BIND_PARAM_INT, - * ] - * ); - * - * - * @param array dataTypes - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, executePrepared) { - - zval _5$$8, _8$$13, _25$$39, _27$$44; - zend_bool _4$$3, _24$$34; - zend_string *_3, *_13$$22, *_21$$31, *_31$$53, *_39$$62; - zend_ulong _2, _12$$22, _20$$31, _30$$53, _38$$62; - zephir_fcall_cache_entry *_7 = NULL, *_9 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval placeholders; - zval *statement, statement_sub, *placeholders_param = NULL, *dataTypes, dataTypes_sub, wildcard, value, type, castValue, parameter, position, itemValue, *_0, _1, _6$$12, *_10$$22, _11$$22, _14$$24, _15$$25, _16$$27, _17$$28, *_18$$31, _19$$31, _22$$32, _23$$33, _26$$43, *_28$$53, _29$$53, _32$$55, _33$$56, _34$$58, _35$$59, *_36$$62, _37$$62, _40$$63, _41$$64; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&statement_sub); - ZVAL_UNDEF(&dataTypes_sub); - ZVAL_UNDEF(&wildcard); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&castValue); - ZVAL_UNDEF(¶meter); - ZVAL_UNDEF(&position); - ZVAL_UNDEF(&itemValue); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_6$$12); - ZVAL_UNDEF(&_11$$22); - ZVAL_UNDEF(&_14$$24); - ZVAL_UNDEF(&_15$$25); - ZVAL_UNDEF(&_16$$27); - ZVAL_UNDEF(&_17$$28); - ZVAL_UNDEF(&_19$$31); - ZVAL_UNDEF(&_22$$32); - ZVAL_UNDEF(&_23$$33); - ZVAL_UNDEF(&_26$$43); - ZVAL_UNDEF(&_29$$53); - ZVAL_UNDEF(&_32$$55); - ZVAL_UNDEF(&_33$$56); - ZVAL_UNDEF(&_34$$58); - ZVAL_UNDEF(&_35$$59); - ZVAL_UNDEF(&_37$$62); - ZVAL_UNDEF(&_40$$63); - ZVAL_UNDEF(&_41$$64); - ZVAL_UNDEF(&placeholders); - ZVAL_UNDEF(&_5$$8); - ZVAL_UNDEF(&_8$$13); - ZVAL_UNDEF(&_25$$39); - ZVAL_UNDEF(&_27$$44); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &statement, &placeholders_param, &dataTypes); - - ZEPHIR_OBS_COPY_OR_DUP(&placeholders, placeholders_param); - - - zephir_is_iterable(&placeholders, 0, "phalcon/Db/Adapter/Pdo.zep", 570); - if (Z_TYPE_P(&placeholders) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&placeholders), _2, _3, _0) - { - ZEPHIR_INIT_NVAR(&wildcard); - if (_3 != NULL) { - ZVAL_STR_COPY(&wildcard, _3); - } else { - ZVAL_LONG(&wildcard, _2); - } - ZEPHIR_INIT_NVAR(&value); - ZVAL_COPY(&value, _0); - if (Z_TYPE_P(&wildcard) == IS_LONG) { - ZEPHIR_INIT_NVAR(¶meter); - ZVAL_LONG(¶meter, (zephir_get_numberval(&wildcard) + 1)); - } else if (Z_TYPE_P(&wildcard) == IS_STRING) { - ZEPHIR_CPY_WRT(¶meter, &wildcard); - } else { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid bind parameter (1)", "phalcon/Db/Adapter/Pdo.zep", 490); - return; - } - _4$$3 = Z_TYPE_P(dataTypes) == IS_ARRAY; - if (_4$$3) { - ZEPHIR_OBS_NVAR(&type); - _4$$3 = zephir_array_isset_fetch(&type, dataTypes, &wildcard, 0 TSRMLS_CC); - } - if (_4$$3) { - if (ZEPHIR_IS_LONG(&type, 32)) { - zephir_get_strval(&_5$$8, &value); - ZEPHIR_CPY_WRT(&castValue, &_5$$8); - ZEPHIR_INIT_NVAR(&type); - ZVAL_LONG(&type, 1024); - } else { - if (ZEPHIR_GLOBAL(db).force_casting) { - if (Z_TYPE_P(&value) != IS_ARRAY) { - do { - if (ZEPHIR_IS_LONG(&type, 1)) { - ZVAL_LONG(&_6$$12, 10); - ZEPHIR_CALL_FUNCTION(&castValue, "intval", &_7, 39, &value, &_6$$12); - zephir_check_call_status(); - break; - } - if (ZEPHIR_IS_LONG(&type, 2)) { - zephir_get_strval(&_8$$13, &value); - ZEPHIR_CPY_WRT(&castValue, &_8$$13); - break; - } - if (ZEPHIR_IS_LONG(&type, 0)) { - ZEPHIR_INIT_NVAR(&castValue); - ZVAL_NULL(&castValue); - break; - } - if (ZEPHIR_IS_LONG(&type, 5)) { - ZEPHIR_INIT_NVAR(&castValue); - ZVAL_BOOL(&castValue, zephir_get_boolval(&value)); - break; - } - ZEPHIR_CPY_WRT(&castValue, &value); - break; - } while(0); - - } else { - ZEPHIR_CPY_WRT(&castValue, &value); - } - } else { - ZEPHIR_CPY_WRT(&castValue, &value); - } - } - if (Z_TYPE_P(&castValue) != IS_ARRAY) { - if (ZEPHIR_IS_LONG(&type, 1024)) { - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, ¶meter, &castValue); - zephir_check_call_status(); - } else { - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, ¶meter, &castValue, &type); - zephir_check_call_status(); - } - } else { - zephir_is_iterable(&castValue, 0, "phalcon/Db/Adapter/Pdo.zep", 558); - if (Z_TYPE_P(&castValue) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&castValue), _12$$22, _13$$22, _10$$22) - { - ZEPHIR_INIT_NVAR(&position); - if (_13$$22 != NULL) { - ZVAL_STR_COPY(&position, _13$$22); - } else { - ZVAL_LONG(&position, _12$$22); - } - ZEPHIR_INIT_NVAR(&itemValue); - ZVAL_COPY(&itemValue, _10$$22); - if (ZEPHIR_IS_LONG(&type, 1024)) { - ZEPHIR_INIT_LNVAR(_14$$24); - ZEPHIR_CONCAT_VV(&_14$$24, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_14$$24, &itemValue); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_LNVAR(_15$$25); - ZEPHIR_CONCAT_VV(&_15$$25, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_15$$25, &itemValue, &type); - zephir_check_call_status(); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &castValue, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_11$$22, &castValue, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_11$$22)) { - break; - } - ZEPHIR_CALL_METHOD(&position, &castValue, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&itemValue, &castValue, "current", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(&type, 1024)) { - ZEPHIR_INIT_LNVAR(_16$$27); - ZEPHIR_CONCAT_VV(&_16$$27, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_16$$27, &itemValue); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_LNVAR(_17$$28); - ZEPHIR_CONCAT_VV(&_17$$28, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_17$$28, &itemValue, &type); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, &castValue, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&itemValue); - ZEPHIR_INIT_NVAR(&position); - } - } else { - if (Z_TYPE_P(&value) != IS_ARRAY) { - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, ¶meter, &value); - zephir_check_call_status(); - } else { - zephir_is_iterable(&value, 0, "phalcon/Db/Adapter/Pdo.zep", 566); - if (Z_TYPE_P(&value) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&value), _20$$31, _21$$31, _18$$31) - { - ZEPHIR_INIT_NVAR(&position); - if (_21$$31 != NULL) { - ZVAL_STR_COPY(&position, _21$$31); - } else { - ZVAL_LONG(&position, _20$$31); - } - ZEPHIR_INIT_NVAR(&itemValue); - ZVAL_COPY(&itemValue, _18$$31); - ZEPHIR_INIT_LNVAR(_22$$32); - ZEPHIR_CONCAT_VV(&_22$$32, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_22$$32, &itemValue); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &value, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_19$$31, &value, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_19$$31)) { - break; - } - ZEPHIR_CALL_METHOD(&position, &value, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&itemValue, &value, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_LNVAR(_23$$33); - ZEPHIR_CONCAT_VV(&_23$$33, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_23$$33, &itemValue); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &value, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&itemValue); - ZEPHIR_INIT_NVAR(&position); - } - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &placeholders, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1, &placeholders, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_1)) { - break; - } - ZEPHIR_CALL_METHOD(&wildcard, &placeholders, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&value, &placeholders, "current", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&wildcard) == IS_LONG) { - ZEPHIR_INIT_NVAR(¶meter); - ZVAL_LONG(¶meter, (zephir_get_numberval(&wildcard) + 1)); - } else if (Z_TYPE_P(&wildcard) == IS_STRING) { - ZEPHIR_CPY_WRT(¶meter, &wildcard); - } else { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid bind parameter (1)", "phalcon/Db/Adapter/Pdo.zep", 490); - return; - } - _24$$34 = Z_TYPE_P(dataTypes) == IS_ARRAY; - if (_24$$34) { - ZEPHIR_OBS_NVAR(&type); - _24$$34 = zephir_array_isset_fetch(&type, dataTypes, &wildcard, 0 TSRMLS_CC); - } - if (_24$$34) { - if (ZEPHIR_IS_LONG(&type, 32)) { - zephir_get_strval(&_25$$39, &value); - ZEPHIR_CPY_WRT(&castValue, &_25$$39); - ZEPHIR_INIT_NVAR(&type); - ZVAL_LONG(&type, 1024); - } else { - if (ZEPHIR_GLOBAL(db).force_casting) { - if (Z_TYPE_P(&value) != IS_ARRAY) { - do { - if (ZEPHIR_IS_LONG(&type, 1)) { - ZVAL_LONG(&_26$$43, 10); - ZEPHIR_CALL_FUNCTION(&castValue, "intval", &_7, 39, &value, &_26$$43); - zephir_check_call_status(); - break; - } - if (ZEPHIR_IS_LONG(&type, 2)) { - zephir_get_strval(&_27$$44, &value); - ZEPHIR_CPY_WRT(&castValue, &_27$$44); - break; - } - if (ZEPHIR_IS_LONG(&type, 0)) { - ZEPHIR_INIT_NVAR(&castValue); - ZVAL_NULL(&castValue); - break; - } - if (ZEPHIR_IS_LONG(&type, 5)) { - ZEPHIR_INIT_NVAR(&castValue); - ZVAL_BOOL(&castValue, zephir_get_boolval(&value)); - break; - } - ZEPHIR_CPY_WRT(&castValue, &value); - break; - } while(0); - - } else { - ZEPHIR_CPY_WRT(&castValue, &value); - } - } else { - ZEPHIR_CPY_WRT(&castValue, &value); - } - } - if (Z_TYPE_P(&castValue) != IS_ARRAY) { - if (ZEPHIR_IS_LONG(&type, 1024)) { - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, ¶meter, &castValue); - zephir_check_call_status(); - } else { - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, ¶meter, &castValue, &type); - zephir_check_call_status(); - } - } else { - zephir_is_iterable(&castValue, 0, "phalcon/Db/Adapter/Pdo.zep", 558); - if (Z_TYPE_P(&castValue) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&castValue), _30$$53, _31$$53, _28$$53) - { - ZEPHIR_INIT_NVAR(&position); - if (_31$$53 != NULL) { - ZVAL_STR_COPY(&position, _31$$53); - } else { - ZVAL_LONG(&position, _30$$53); - } - ZEPHIR_INIT_NVAR(&itemValue); - ZVAL_COPY(&itemValue, _28$$53); - if (ZEPHIR_IS_LONG(&type, 1024)) { - ZEPHIR_INIT_LNVAR(_32$$55); - ZEPHIR_CONCAT_VV(&_32$$55, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_32$$55, &itemValue); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_LNVAR(_33$$56); - ZEPHIR_CONCAT_VV(&_33$$56, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_33$$56, &itemValue, &type); - zephir_check_call_status(); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &castValue, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_29$$53, &castValue, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_29$$53)) { - break; - } - ZEPHIR_CALL_METHOD(&position, &castValue, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&itemValue, &castValue, "current", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_LONG(&type, 1024)) { - ZEPHIR_INIT_LNVAR(_34$$58); - ZEPHIR_CONCAT_VV(&_34$$58, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_34$$58, &itemValue); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_LNVAR(_35$$59); - ZEPHIR_CONCAT_VV(&_35$$59, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_35$$59, &itemValue, &type); - zephir_check_call_status(); - } - ZEPHIR_CALL_METHOD(NULL, &castValue, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&itemValue); - ZEPHIR_INIT_NVAR(&position); - } - } else { - if (Z_TYPE_P(&value) != IS_ARRAY) { - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, ¶meter, &value); - zephir_check_call_status(); - } else { - zephir_is_iterable(&value, 0, "phalcon/Db/Adapter/Pdo.zep", 566); - if (Z_TYPE_P(&value) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&value), _38$$62, _39$$62, _36$$62) - { - ZEPHIR_INIT_NVAR(&position); - if (_39$$62 != NULL) { - ZVAL_STR_COPY(&position, _39$$62); - } else { - ZVAL_LONG(&position, _38$$62); - } - ZEPHIR_INIT_NVAR(&itemValue); - ZVAL_COPY(&itemValue, _36$$62); - ZEPHIR_INIT_LNVAR(_40$$63); - ZEPHIR_CONCAT_VV(&_40$$63, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_40$$63, &itemValue); - zephir_check_call_status(); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &value, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_37$$62, &value, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_37$$62)) { - break; - } - ZEPHIR_CALL_METHOD(&position, &value, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&itemValue, &value, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_LNVAR(_41$$64); - ZEPHIR_CONCAT_VV(&_41$$64, ¶meter, &position); - ZEPHIR_CALL_METHOD(NULL, statement, "bindvalue", &_9, 0, &_41$$64, &itemValue); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &value, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&itemValue); - ZEPHIR_INIT_NVAR(&position); - } - } - ZEPHIR_CALL_METHOD(NULL, &placeholders, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&value); - ZEPHIR_INIT_NVAR(&wildcard); - ZEPHIR_CALL_METHOD(NULL, statement, "execute", NULL, 0); - zephir_check_call_status(); - RETVAL_ZVAL(statement, 1, 0); - RETURN_MM(); - -} - -/** - * Return the error info, if any - * - * @return array - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, getErrorInfo) { - - zval _0; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&_0); - - ZEPHIR_MM_GROW(); - - zephir_read_property(&_0, this_ptr, SL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "errorinfo", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Return internal PDO handler - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, getInternalHandler) { - - zval *this_ptr = getThis(); - - - RETURN_MEMBER(getThis(), "pdo"); - -} - -/** - * Returns the current transaction nesting level - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, getTransactionLevel) { - - zval *this_ptr = getThis(); - - - RETURN_MEMBER(getThis(), "transactionLevel"); - -} - -/** - * Checks whether the connection is under a transaction - * - * - * $connection->begin(); - * - * // true - * var_dump( - * $connection->isUnderTransaction() - * ); - * - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, isUnderTransaction) { - - zval pdo, _0; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&pdo); - ZVAL_UNDEF(&_0); - - ZEPHIR_MM_GROW(); - - zephir_read_property(&_0, this_ptr, SL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&pdo, &_0); - if (Z_TYPE_P(&pdo) != IS_OBJECT) { - RETURN_MM_BOOL(0); - } - ZEPHIR_RETURN_CALL_METHOD(&pdo, "intransaction", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Returns the insert id for the auto_increment/serial column inserted in - * the latest executed SQL statement - * - * - * // Inserting a new robot - * $success = $connection->insert( - * "robots", - * [ - * "Astro Boy", - * 1952, - * ], - * [ - * "name", - * "year", - * ] - * ); - * - * // Getting the generated id - * $id = $connection->lastInsertId(); - * - * - * @param string sequenceName - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, lastInsertId) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *sequenceName = NULL, sequenceName_sub, __$null, pdo, _0; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&sequenceName_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&pdo); - ZVAL_UNDEF(&_0); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &sequenceName); - - if (!sequenceName) { - sequenceName = &sequenceName_sub; - sequenceName = &__$null; - } - - - zephir_read_property(&_0, this_ptr, SL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&pdo, &_0); - if (Z_TYPE_P(&pdo) != IS_OBJECT) { - RETURN_MM_BOOL(0); - } - ZEPHIR_RETURN_CALL_METHOD(&pdo, "lastinsertid", NULL, 0, sequenceName); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Returns a PDO prepared statement to be executed with 'executePrepared' - * - * - * use Phalcon\Db\Column; - * - * $statement = $db->prepare( - * "SELECT * FROM robots WHERE name = :name" - * ); - * - * $result = $connection->executePrepared( - * $statement, - * [ - * "name" => "Voltron", - * ], - * [ - * "name" => Column::BIND_PARAM_INT, - * ] - * ); - * - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, prepare) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *sqlStatement_param = NULL, _0; - zval sqlStatement; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&sqlStatement); - ZVAL_UNDEF(&_0); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &sqlStatement_param); - - if (UNEXPECTED(Z_TYPE_P(sqlStatement_param) != IS_STRING && Z_TYPE_P(sqlStatement_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlStatement' must be of the type string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(sqlStatement_param) == IS_STRING)) { - zephir_get_strval(&sqlStatement, sqlStatement_param); - } else { - ZEPHIR_INIT_VAR(&sqlStatement); - ZVAL_EMPTY_STRING(&sqlStatement); - } - - - zephir_read_property(&_0, this_ptr, SL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_METHOD(&_0, "prepare", NULL, 0, &sqlStatement); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Sends SQL statements to the database server returning the success state. - * Use this method only when the SQL statement sent to the server is - * returning rows - * - * - * // Querying data - * $resultset = $connection->query( - * "SELECT * FROM robots WHERE type = 'mechanical'" - * ); - * - * $resultset = $connection->query( - * "SELECT * FROM robots WHERE type = ?", - * [ - * "mechanical", - * ] - * ); - * - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, query) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *sqlStatement_param = NULL, *bindParams = NULL, bindParams_sub, *bindTypes = NULL, bindTypes_sub, __$null, eventsManager, pdo, statement, params, types, _0, _3, _1$$3, _2$$3, _4$$9; - zval sqlStatement; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&sqlStatement); - ZVAL_UNDEF(&bindParams_sub); - ZVAL_UNDEF(&bindTypes_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&eventsManager); - ZVAL_UNDEF(&pdo); - ZVAL_UNDEF(&statement); - ZVAL_UNDEF(¶ms); - ZVAL_UNDEF(&types); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_4$$9); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &sqlStatement_param, &bindParams, &bindTypes); - - if (UNEXPECTED(Z_TYPE_P(sqlStatement_param) != IS_STRING && Z_TYPE_P(sqlStatement_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlStatement' must be of the type string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(sqlStatement_param) == IS_STRING)) { - zephir_get_strval(&sqlStatement, sqlStatement_param); - } else { - ZEPHIR_INIT_VAR(&sqlStatement); - ZVAL_EMPTY_STRING(&sqlStatement); - } - if (!bindParams) { - bindParams = &bindParams_sub; - bindParams = &__$null; - } - if (!bindTypes) { - bindTypes = &bindTypes_sub; - bindTypes = &__$null; - } - - - zephir_read_property(&_0, this_ptr, SL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_0); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - zephir_update_property_zval(this_ptr, SL("sqlStatement"), &sqlStatement); - zephir_update_property_zval(this_ptr, SL("sqlVariables"), bindParams); - zephir_update_property_zval(this_ptr, SL("sqlBindTypes"), bindTypes); - ZEPHIR_INIT_VAR(&_2$$3); - ZVAL_STRING(&_2$$3, "db:beforeQuery"); - ZEPHIR_CALL_METHOD(&_1$$3, &eventsManager, "fire", NULL, 0, &_2$$3, this_ptr); - zephir_check_call_status(); - if (ZEPHIR_IS_FALSE_IDENTICAL(&_1$$3)) { - RETURN_MM_BOOL(0); - } - } - zephir_read_property(&_0, this_ptr, SL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&pdo, &_0); - if (Z_TYPE_P(bindParams) == IS_ARRAY) { - ZEPHIR_CPY_WRT(¶ms, bindParams); - ZEPHIR_CPY_WRT(&types, bindTypes); - } else { - ZEPHIR_INIT_NVAR(¶ms); - array_init(¶ms); - ZEPHIR_INIT_NVAR(&types); - array_init(&types); - } - ZEPHIR_CALL_METHOD(&statement, &pdo, "prepare", NULL, 0, &sqlStatement); - zephir_check_call_status(); - if (UNEXPECTED(Z_TYPE_P(&statement) != IS_OBJECT)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Cannot prepare statement", "phalcon/Db/Adapter/Pdo.zep", 737); - return; - } - ZEPHIR_CALL_METHOD(&_3, this_ptr, "executeprepared", NULL, 0, &statement, ¶ms, &types); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(&statement, &_3); - if (Z_TYPE_P(&statement) == IS_OBJECT) { - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_4$$9); - ZVAL_STRING(&_4$$9, "db:afterQuery"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_4$$9, this_ptr); - zephir_check_call_status(); - } - object_init_ex(return_value, phalcon_db_result_pdo_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 40, this_ptr, &statement, &sqlStatement, bindParams, bindTypes); - zephir_check_call_status(); - RETURN_MM(); - } - RETURN_CCTOR(&statement); - -} - -/** - * Rollbacks the active transaction in the connection - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, rollback) { - - zend_long ZEPHIR_LAST_CALL_STATUS, transactionLevel = 0; - zval *nesting_param = NULL, pdo, eventsManager, savepointName, _0, _1, _6, _2$$5, _3$$6, _7$$9; - zend_bool nesting, _4, _5; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&pdo); - ZVAL_UNDEF(&eventsManager); - ZVAL_UNDEF(&savepointName); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_2$$5); - ZVAL_UNDEF(&_3$$6); - ZVAL_UNDEF(&_7$$9); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &nesting_param); - - if (!nesting_param) { - nesting = 1; - } else { - nesting = zephir_get_boolval(nesting_param); - } - - - zephir_read_property(&_0, this_ptr, SL("pdo"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&pdo, &_0); - if (Z_TYPE_P(&pdo) != IS_OBJECT) { - RETURN_MM_BOOL(0); - } - ZEPHIR_OBS_VAR(&_1); - zephir_read_property(&_1, this_ptr, SL("transactionLevel"), PH_NOISY_CC); - transactionLevel = zephir_get_intval(&_1); - if (UNEXPECTED(!transactionLevel)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "There is no active transaction", "phalcon/Db/Adapter/Pdo.zep", 779); - return; - } - if (transactionLevel == 1) { - zephir_read_property(&_2$$5, this_ptr, SL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_2$$5); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_3$$6); - ZVAL_STRING(&_3$$6, "db:rollbackTransaction"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_3$$6, this_ptr); - zephir_check_call_status(); - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("transactionLevel") TSRMLS_CC)); - ZEPHIR_RETURN_CALL_METHOD(&pdo, "rollback", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - } - _4 = !transactionLevel; - if (!(_4)) { - _4 = !nesting; - } - _5 = _4; - if (!(_5)) { - ZEPHIR_CALL_METHOD(&_6, this_ptr, "isnestedtransactionswithsavepoints", NULL, 0); - zephir_check_call_status(); - _5 = !zephir_is_true(&_6); - } - if (_5) { - if (transactionLevel > 0) { - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("transactionLevel") TSRMLS_CC)); - } - RETURN_MM_BOOL(0); - } - ZEPHIR_CALL_METHOD(&savepointName, this_ptr, "getnestedtransactionsavepointname", NULL, 0); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, SL("eventsManager"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&eventsManager, &_0); - if (Z_TYPE_P(&eventsManager) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_7$$9); - ZVAL_STRING(&_7$$9, "db:rollbackSavepoint"); - ZEPHIR_CALL_METHOD(NULL, &eventsManager, "fire", NULL, 0, &_7$$9, this_ptr, &savepointName); - zephir_check_call_status(); - } - RETURN_ON_FAILURE(zephir_property_decr(this_ptr, SL("transactionLevel") TSRMLS_CC)); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "rollbacksavepoint", NULL, 0, &savepointName); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Returns PDO adapter DSN defaults as a key-value map. - */ -PHP_METHOD(Phalcon_Db_Adapter_Pdo, getDsnDefaults) { - -} - diff --git a/ext/phalcon/db/adapter/pdo.zep.h b/ext/phalcon/db/adapter/pdo.zep.h deleted file mode 100644 index cb09d6143ce..00000000000 --- a/ext/phalcon/db/adapter/pdo.zep.h +++ /dev/null @@ -1,212 +0,0 @@ - -extern zend_class_entry *phalcon_db_adapter_pdo_ce; - -ZEPHIR_INIT_CLASS(Phalcon_Db_Adapter_Pdo); - -PHP_METHOD(Phalcon_Db_Adapter_Pdo, __construct); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, affectedRows); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, begin); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, commit); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, close); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, connect); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, convertBoundParams); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, escapeString); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, execute); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, executePrepared); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, getErrorInfo); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, getInternalHandler); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, getTransactionLevel); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, isUnderTransaction); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, lastInsertId); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, prepare); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, query); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, rollback); -PHP_METHOD(Phalcon_Db_Adapter_Pdo, getDsnDefaults); - -ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_adapter_pdo___construct, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, descriptor, 0) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_affectedrows, 0, 0, IS_LONG, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_affectedrows, 0, 0, IS_LONG, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_begin, 0, 0, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_begin, 0, 0, _IS_BOOL, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, nesting, _IS_BOOL, 0) -#else - ZEND_ARG_INFO(0, nesting) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_commit, 0, 0, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_commit, 0, 0, _IS_BOOL, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, nesting, _IS_BOOL, 0) -#else - ZEND_ARG_INFO(0, nesting) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_close, 0, 0, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_close, 0, 0, _IS_BOOL, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_connect, 0, 0, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_connect, 0, 0, _IS_BOOL, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, descriptor, 1) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_convertboundparams, 0, 1, IS_ARRAY, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_convertboundparams, 0, 1, IS_ARRAY, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, sql, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, sql) -#endif - ZEND_ARG_ARRAY_INFO(0, params, 0) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_escapestring, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_escapestring, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, str) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_execute, 0, 1, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_execute, 0, 1, _IS_BOOL, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, sqlStatement, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, sqlStatement) -#endif - ZEND_ARG_INFO(0, bindParams) - ZEND_ARG_INFO(0, bindTypes) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_db_adapter_pdo_executeprepared, 0, 3, PDOStatement, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_executeprepared, 0, 3, IS_OBJECT, "PDOStatement", 0) -#endif - ZEND_ARG_OBJ_INFO(0, statement, PDOStatement, 0) - ZEND_ARG_ARRAY_INFO(0, placeholders, 0) - ZEND_ARG_INFO(0, dataTypes) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_db_adapter_pdo_getinternalhandler, 0, 0, Pdo, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_getinternalhandler, 0, 0, IS_OBJECT, "Pdo", 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_gettransactionlevel, 0, 0, IS_LONG, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_gettransactionlevel, 0, 0, IS_LONG, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_isundertransaction, 0, 0, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_isundertransaction, 0, 0, _IS_BOOL, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_adapter_pdo_lastinsertid, 0, 0, 0) - ZEND_ARG_INFO(0, sequenceName) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_db_adapter_pdo_prepare, 0, 1, PDOStatement, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_prepare, 0, 1, IS_OBJECT, "PDOStatement", 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, sqlStatement, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, sqlStatement) -#endif -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_adapter_pdo_query, 0, 0, 1) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, sqlStatement, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, sqlStatement) -#endif - ZEND_ARG_INFO(0, bindParams) - ZEND_ARG_INFO(0, bindTypes) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_rollback, 0, 0, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_rollback, 0, 0, _IS_BOOL, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, nesting, _IS_BOOL, 0) -#else - ZEND_ARG_INFO(0, nesting) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_getdsndefaults, 0, 0, IS_ARRAY, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_adapter_pdo_getdsndefaults, 0, 0, IS_ARRAY, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -ZEPHIR_INIT_FUNCS(phalcon_db_adapter_pdo_method_entry) { - PHP_ME(Phalcon_Db_Adapter_Pdo, __construct, arginfo_phalcon_db_adapter_pdo___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) - PHP_ME(Phalcon_Db_Adapter_Pdo, affectedRows, arginfo_phalcon_db_adapter_pdo_affectedrows, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, begin, arginfo_phalcon_db_adapter_pdo_begin, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, commit, arginfo_phalcon_db_adapter_pdo_commit, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, close, arginfo_phalcon_db_adapter_pdo_close, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, connect, arginfo_phalcon_db_adapter_pdo_connect, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, convertBoundParams, arginfo_phalcon_db_adapter_pdo_convertboundparams, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, escapeString, arginfo_phalcon_db_adapter_pdo_escapestring, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, execute, arginfo_phalcon_db_adapter_pdo_execute, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, executePrepared, arginfo_phalcon_db_adapter_pdo_executeprepared, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, getErrorInfo, NULL, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, getInternalHandler, arginfo_phalcon_db_adapter_pdo_getinternalhandler, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, getTransactionLevel, arginfo_phalcon_db_adapter_pdo_gettransactionlevel, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, isUnderTransaction, arginfo_phalcon_db_adapter_pdo_isundertransaction, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, lastInsertId, arginfo_phalcon_db_adapter_pdo_lastinsertid, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, prepare, arginfo_phalcon_db_adapter_pdo_prepare, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, query, arginfo_phalcon_db_adapter_pdo_query, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, rollback, arginfo_phalcon_db_adapter_pdo_rollback, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Adapter_Pdo, getDsnDefaults, arginfo_phalcon_db_adapter_pdo_getdsndefaults, ZEND_ACC_ABSTRACT|ZEND_ACC_PROTECTED) - PHP_FE_END -}; diff --git a/ext/phalcon/db/dialect.zep.c b/ext/phalcon/db/dialect.zep.c deleted file mode 100644 index 7f2fbf05591..00000000000 --- a/ext/phalcon/db/dialect.zep.c +++ /dev/null @@ -1,2766 +0,0 @@ - -#ifdef HAVE_CONFIG_H -#include "../../ext_config.h" -#endif - -#include -#include "../../php_ext.h" -#include "../../ext.h" - -#include -#include -#include - -#include "kernel/main.h" -#include "kernel/concat.h" -#include "ext/spl/spl_exceptions.h" -#include "kernel/exception.h" -#include "kernel/operators.h" -#include "kernel/memory.h" -#include "kernel/object.h" -#include "kernel/string.h" -#include "kernel/fcall.h" -#include "kernel/array.h" - - -/** - * This file is part of the Phalcon Framework. - * - * (c) Phalcon Team - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -/** - * Phalcon\Db\Dialect - * - * This is the base class to each database dialect. This implements - * common methods to transform intermediate code into its RDBMS related syntax - */ -ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Db, Dialect, phalcon, db_dialect, phalcon_db_dialect_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - - zend_declare_property_null(phalcon_db_dialect_ce, SL("escapeChar"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_declare_property_null(phalcon_db_dialect_ce, SL("customFunctions"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_db_dialect_ce TSRMLS_CC, 1, phalcon_db_dialectinterface_ce); - return SUCCESS; - -} - -/** - * Generate SQL to create a new savepoint - */ -PHP_METHOD(Phalcon_Db_Dialect, createSavepoint) { - - zval *name_param = NULL; - zval name; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&name); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - ZVAL_EMPTY_STRING(&name); - } - - - ZEPHIR_CONCAT_SV(return_value, "SAVEPOINT ", &name); - RETURN_MM(); - -} - -/** - * Escape identifiers - */ -PHP_METHOD(Phalcon_Db_Dialect, escape) { - - zend_bool _2$$5, _12$$7, _13$$7, _17$$9, _18$$9; - zend_string *_11; - zend_ulong _10; - zval _7; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *str_param = NULL, *escapeChar_param = NULL, parts, key, part, newParts, _5, _6, *_8, _9, _0$$4, _3$$6, _14$$7, _16$$7, _19$$9, _21$$9; - zval str, escapeChar, _1$$4, _4$$6, _15$$7, _20$$9; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&str); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&_1$$4); - ZVAL_UNDEF(&_4$$6); - ZVAL_UNDEF(&_15$$7); - ZVAL_UNDEF(&_20$$9); - ZVAL_UNDEF(&parts); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&part); - ZVAL_UNDEF(&newParts); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_9); - ZVAL_UNDEF(&_0$$4); - ZVAL_UNDEF(&_3$$6); - ZVAL_UNDEF(&_14$$7); - ZVAL_UNDEF(&_16$$7); - ZVAL_UNDEF(&_19$$9); - ZVAL_UNDEF(&_21$$9); - ZVAL_UNDEF(&_7); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &str_param, &escapeChar_param); - - if (UNEXPECTED(Z_TYPE_P(str_param) != IS_STRING && Z_TYPE_P(str_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'str' must be of the type string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(str_param) == IS_STRING)) { - zephir_get_strval(&str, str_param); - } else { - ZEPHIR_INIT_VAR(&str); - ZVAL_EMPTY_STRING(&str); - } - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - - - if (!(ZEPHIR_GLOBAL(db).escape_identifiers)) { - RETURN_CTOR(&str); - } - if (ZEPHIR_IS_STRING(&escapeChar, "")) { - ZEPHIR_OBS_VAR(&_0$$4); - zephir_read_property(&_0$$4, this_ptr, SL("escapeChar"), PH_NOISY_CC); - zephir_get_strval(&_1$$4, &_0$$4); - ZEPHIR_CPY_WRT(&escapeChar, &_1$$4); - } - if (!(zephir_memnstr_str(&str, SL("."), "phalcon/Db/Dialect.zep", 48))) { - _2$$5 = !ZEPHIR_IS_STRING(&escapeChar, ""); - if (_2$$5) { - _2$$5 = !ZEPHIR_IS_STRING(&str, "*"); - } - if (_2$$5) { - ZEPHIR_INIT_VAR(&_3$$6); - ZEPHIR_INIT_VAR(&_4$$6); - ZEPHIR_CONCAT_VV(&_4$$6, &escapeChar, &escapeChar); - zephir_fast_str_replace(&_3$$6, &escapeChar, &_4$$6, &str TSRMLS_CC); - ZEPHIR_CONCAT_VVV(return_value, &escapeChar, &_3$$6, &escapeChar); - RETURN_MM(); - } - RETURN_CTOR(&str); - } - ZEPHIR_INIT_VAR(&_5); - ZEPHIR_INIT_VAR(&_6); - zephir_fast_trim(&_6, &str, &escapeChar, ZEPHIR_TRIM_BOTH TSRMLS_CC); - zephir_fast_explode_str(&_5, SL("."), &_6, LONG_MAX TSRMLS_CC); - zephir_get_arrval(&_7, &_5); - ZEPHIR_CPY_WRT(&parts, &_7); - ZEPHIR_CPY_WRT(&newParts, &parts); - zephir_is_iterable(&parts, 0, "phalcon/Db/Dialect.zep", 68); - if (Z_TYPE_P(&parts) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&parts), _10, _11, _8) - { - ZEPHIR_INIT_NVAR(&key); - if (_11 != NULL) { - ZVAL_STR_COPY(&key, _11); - } else { - ZVAL_LONG(&key, _10); - } - ZEPHIR_INIT_NVAR(&part); - ZVAL_COPY(&part, _8); - _12$$7 = ZEPHIR_IS_STRING(&escapeChar, ""); - if (!(_12$$7)) { - _12$$7 = ZEPHIR_IS_STRING(&part, ""); - } - _13$$7 = _12$$7; - if (!(_13$$7)) { - _13$$7 = ZEPHIR_IS_STRING(&part, "*"); - } - if (_13$$7) { - continue; - } - ZEPHIR_INIT_NVAR(&_14$$7); - ZEPHIR_INIT_LNVAR(_15$$7); - ZEPHIR_CONCAT_VV(&_15$$7, &escapeChar, &escapeChar); - zephir_fast_str_replace(&_14$$7, &escapeChar, &_15$$7, &part TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_16$$7); - ZEPHIR_CONCAT_VVV(&_16$$7, &escapeChar, &_14$$7, &escapeChar); - zephir_array_update_zval(&newParts, &key, &_16$$7, PH_COPY | PH_SEPARATE); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &parts, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_9, &parts, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_9)) { - break; - } - ZEPHIR_CALL_METHOD(&key, &parts, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&part, &parts, "current", NULL, 0); - zephir_check_call_status(); - _17$$9 = ZEPHIR_IS_STRING(&escapeChar, ""); - if (!(_17$$9)) { - _17$$9 = ZEPHIR_IS_STRING(&part, ""); - } - _18$$9 = _17$$9; - if (!(_18$$9)) { - _18$$9 = ZEPHIR_IS_STRING(&part, "*"); - } - if (_18$$9) { - continue; - } - ZEPHIR_INIT_NVAR(&_19$$9); - ZEPHIR_INIT_LNVAR(_20$$9); - ZEPHIR_CONCAT_VV(&_20$$9, &escapeChar, &escapeChar); - zephir_fast_str_replace(&_19$$9, &escapeChar, &_20$$9, &part TSRMLS_CC); - ZEPHIR_INIT_LNVAR(_21$$9); - ZEPHIR_CONCAT_VVV(&_21$$9, &escapeChar, &_19$$9, &escapeChar); - zephir_array_update_zval(&newParts, &key, &_21$$9, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(NULL, &parts, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&part); - ZEPHIR_INIT_NVAR(&key); - zephir_fast_join_str(return_value, SL("."), &newParts TSRMLS_CC); - RETURN_MM(); - -} - -/** - * Escape Schema - */ -PHP_METHOD(Phalcon_Db_Dialect, escapeSchema) { - - zval *str_param = NULL, *escapeChar_param = NULL, _0$$4, _2; - zval str, escapeChar, _1$$4; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&str); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&_1$$4); - ZVAL_UNDEF(&_0$$4); - ZVAL_UNDEF(&_2); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &str_param, &escapeChar_param); - - if (UNEXPECTED(Z_TYPE_P(str_param) != IS_STRING && Z_TYPE_P(str_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'str' must be of the type string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(str_param) == IS_STRING)) { - zephir_get_strval(&str, str_param); - } else { - ZEPHIR_INIT_VAR(&str); - ZVAL_EMPTY_STRING(&str); - } - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - - - if (!(ZEPHIR_GLOBAL(db).escape_identifiers)) { - RETURN_CTOR(&str); - } - if (ZEPHIR_IS_STRING(&escapeChar, "")) { - ZEPHIR_OBS_VAR(&_0$$4); - zephir_read_property(&_0$$4, this_ptr, SL("escapeChar"), PH_NOISY_CC); - zephir_get_strval(&_1$$4, &_0$$4); - ZEPHIR_CPY_WRT(&escapeChar, &_1$$4); - } - ZEPHIR_INIT_VAR(&_2); - zephir_fast_trim(&_2, &str, &escapeChar, ZEPHIR_TRIM_BOTH TSRMLS_CC); - ZEPHIR_CONCAT_VVV(return_value, &escapeChar, &_2, &escapeChar); - RETURN_MM(); - -} - -/** - * Returns a SQL modified with a FOR UPDATE clause - * - * - * $sql = $dialect->forUpdate("SELECT * FROM robots"); - * - * echo $sql; // SELECT * FROM robots FOR UPDATE - * - */ -PHP_METHOD(Phalcon_Db_Dialect, forUpdate) { - - zval *sqlQuery_param = NULL; - zval sqlQuery; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&sqlQuery); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &sqlQuery_param); - - if (UNEXPECTED(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be of the type string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(sqlQuery_param) == IS_STRING)) { - zephir_get_strval(&sqlQuery, sqlQuery_param); - } else { - ZEPHIR_INIT_VAR(&sqlQuery); - ZVAL_EMPTY_STRING(&sqlQuery); - } - - - ZEPHIR_CONCAT_VS(return_value, &sqlQuery, " FOR UPDATE"); - RETURN_MM(); - -} - -/** - * Gets a list of columns with escaped identifiers - * - * - * echo $dialect->getColumnList( - * [ - * "column1", - * "column", - * ] - * ); - * - */ -PHP_METHOD(Phalcon_Db_Dialect, getColumnList) { - - zephir_fcall_cache_entry *_3 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *columnList_param = NULL, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, column, *_0, _1, _2$$3, _4$$4; - zval columnList, columns; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&columnList); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &columnList_param, &escapeChar_param, &bindCounts); - - ZEPHIR_OBS_COPY_OR_DUP(&columnList, columnList_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - ZEPHIR_INIT_VAR(&columns); - array_init(&columns); - zephir_is_iterable(&columnList, 0, "phalcon/Db/Dialect.zep", 124); - if (Z_TYPE_P(&columnList) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&columnList), _0) - { - ZEPHIR_INIT_NVAR(&column); - ZVAL_COPY(&column, _0); - ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "getsqlcolumn", &_3, 41, &column, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_append(&columns, &_2$$3, PH_SEPARATE, "phalcon/Db/Dialect.zep", 121); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &columnList, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1, &columnList, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_1)) { - break; - } - ZEPHIR_CALL_METHOD(&column, &columnList, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4$$4, this_ptr, "getsqlcolumn", &_3, 41, &column, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_append(&columns, &_4$$4, PH_SEPARATE, "phalcon/Db/Dialect.zep", 121); - ZEPHIR_CALL_METHOD(NULL, &columnList, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&column); - zephir_fast_join_str(return_value, SL(", "), &columns TSRMLS_CC); - RETURN_MM(); - -} - -/** - * Returns registered functions - */ -PHP_METHOD(Phalcon_Db_Dialect, getCustomFunctions) { - - zval *this_ptr = getThis(); - - - RETURN_MEMBER(getThis(), "customFunctions"); - -} - -/** - * Resolve Column expressions - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlColumn) { - - zend_bool _5, _3$$4, _4$$4; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *column = NULL, column_sub, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, columnExpression, columnAlias, columnField, columnDomain, _6, _0$$3, _1$$6, _2$$7; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&columnExpression); - ZVAL_UNDEF(&columnAlias); - ZVAL_UNDEF(&columnField); - ZVAL_UNDEF(&columnDomain); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$6); - ZVAL_UNDEF(&_2$$7); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &column, &escapeChar_param, &bindCounts); - - ZEPHIR_SEPARATE_PARAM(column); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - if (Z_TYPE_P(column) != IS_ARRAY) { - ZVAL_NULL(&_0$$3); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparequalified", NULL, 0, column, &_0$$3, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); - } - if (!(zephir_array_isset_string(column, SL("type")))) { - ZEPHIR_OBS_VAR(&columnField); - zephir_array_fetch_long(&columnField, column, 0, PH_NOISY, "phalcon/Db/Dialect.zep", 150 TSRMLS_CC); - if (Z_TYPE_P(&columnField) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&columnExpression); - zephir_create_array(&columnExpression, 2, 0 TSRMLS_CC); - add_assoc_stringl_ex(&columnExpression, SL("type"), SL("scalar")); - zephir_array_update_string(&columnExpression, SL("value"), &columnField, PH_COPY | PH_SEPARATE); - } else if (ZEPHIR_IS_STRING(&columnField, "*")) { - ZEPHIR_INIT_VAR(&_1$$6); - zephir_create_array(&_1$$6, 1, 0 TSRMLS_CC); - add_assoc_stringl_ex(&_1$$6, SL("type"), SL("all")); - ZEPHIR_CPY_WRT(&columnExpression, &_1$$6); - } else { - ZEPHIR_INIT_VAR(&_2$$7); - zephir_create_array(&_2$$7, 2, 0 TSRMLS_CC); - add_assoc_stringl_ex(&_2$$7, SL("type"), SL("qualified")); - zephir_array_update_string(&_2$$7, SL("name"), &columnField, PH_COPY | PH_SEPARATE); - ZEPHIR_CPY_WRT(&columnExpression, &_2$$7); - } - ZEPHIR_OBS_VAR(&columnDomain); - _3$$4 = zephir_array_isset_long_fetch(&columnDomain, column, 1, 0 TSRMLS_CC); - if (_3$$4) { - _3$$4 = !ZEPHIR_IS_STRING(&columnDomain, ""); - } - if (_3$$4) { - zephir_array_update_string(&columnExpression, SL("domain"), &columnDomain, PH_COPY | PH_SEPARATE); - } - ZEPHIR_OBS_VAR(&columnAlias); - _4$$4 = zephir_array_isset_long_fetch(&columnAlias, column, 2, 0 TSRMLS_CC); - if (_4$$4) { - _4$$4 = zephir_is_true(&columnAlias); - } - if (_4$$4) { - zephir_array_update_string(&columnExpression, SL("sqlAlias"), &columnAlias, PH_COPY | PH_SEPARATE); - } - } else { - ZEPHIR_CPY_WRT(&columnExpression, column); - } - ZEPHIR_CALL_METHOD(column, this_ptr, "getsqlexpression", NULL, 0, &columnExpression, &escapeChar, bindCounts); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&columnAlias); - _5 = zephir_array_isset_string_fetch(&columnAlias, &columnExpression, SL("sqlAlias"), 0); - if (!(_5)) { - ZEPHIR_OBS_NVAR(&columnAlias); - _5 = zephir_array_isset_string_fetch(&columnAlias, &columnExpression, SL("alias"), 0); - } - if (_5) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparecolumnalias", NULL, 0, column, &columnAlias, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); - } - ZVAL_NULL(&_6); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparecolumnalias", NULL, 0, column, &_6, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Transforms an intermediate representation for an expression into a database system valid expression - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpression) { - - zend_bool _1$$9; - zend_long ZEPHIR_LAST_CALL_STATUS, i = 0, _2$$9; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, type, times, postTimes, rawValue, value, _11, _12, _0$$7, _3$$9, _4$$11, _5$$11, _6$$8, _7$$14, _8$$14, _9$$18, _10$$18; - zval expression, placeholders; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&placeholders); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(×); - ZVAL_UNDEF(&postTimes); - ZVAL_UNDEF(&rawValue); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_11); - ZVAL_UNDEF(&_12); - ZVAL_UNDEF(&_0$$7); - ZVAL_UNDEF(&_3$$9); - ZVAL_UNDEF(&_4$$11); - ZVAL_UNDEF(&_5$$11); - ZVAL_UNDEF(&_6$$8); - ZVAL_UNDEF(&_7$$14); - ZVAL_UNDEF(&_8$$14); - ZVAL_UNDEF(&_9$$18); - ZVAL_UNDEF(&_10$$18); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts); - - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - ZEPHIR_OBS_VAR(&type); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&type, &expression, SL("type"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL expression", "phalcon/Db/Dialect.zep", 214); - return; - } - do { - if (ZEPHIR_IS_STRING(&type, "scalar")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionscalar", NULL, 42, &expression, &escapeChar, bindCounts); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "object")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionobject", NULL, 43, &expression, &escapeChar, bindCounts); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "qualified")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionqualified", NULL, 44, &expression, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "literal")) { - zephir_array_fetch_string(&_0$$7, &expression, SL("value"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 249 TSRMLS_CC); - RETURN_CTOR(&_0$$7); - } - if (ZEPHIR_IS_STRING(&type, "placeholder")) { - ZEPHIR_OBS_VAR(×); - if (zephir_array_isset_string_fetch(×, &expression, SL("times"), 0)) { - ZEPHIR_INIT_VAR(&placeholders); - array_init(&placeholders); - ZEPHIR_OBS_VAR(&rawValue); - zephir_array_fetch_string(&rawValue, &expression, SL("rawValue"), PH_NOISY, "phalcon/Db/Dialect.zep", 255 TSRMLS_CC); - ZEPHIR_OBS_VAR(&value); - zephir_array_fetch_string(&value, &expression, SL("value"), PH_NOISY, "phalcon/Db/Dialect.zep", 256 TSRMLS_CC); - ZEPHIR_OBS_VAR(&postTimes); - if (zephir_array_isset_fetch(&postTimes, bindCounts, &rawValue, 0 TSRMLS_CC)) { - ZEPHIR_CPY_WRT(×, &postTimes); - } - ZEPHIR_CPY_WRT(&_3$$9, ×); - _2$$9 = 1; - _1$$9 = 0; - if (ZEPHIR_GE_LONG(&_3$$9, _2$$9)) { - while (1) { - if (_1$$9) { - _2$$9++; - if (!(ZEPHIR_GE_LONG(&_3$$9, _2$$9))) { - break; - } - } else { - _1$$9 = 1; - } - i = _2$$9; - ZEPHIR_SINIT_NVAR(_4$$11); - ZVAL_LONG(&_4$$11, ((i - 1))); - ZEPHIR_INIT_LNVAR(_5$$11); - ZEPHIR_CONCAT_VV(&_5$$11, &value, &_4$$11); - zephir_array_append(&placeholders, &_5$$11, PH_SEPARATE, "phalcon/Db/Dialect.zep", 263); - } - } - zephir_fast_join_str(return_value, SL(", "), &placeholders TSRMLS_CC); - RETURN_MM(); - } - zephir_array_fetch_string(&_6$$8, &expression, SL("value"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 269 TSRMLS_CC); - RETURN_CTOR(&_6$$8); - } - if (ZEPHIR_IS_STRING(&type, "binary-op")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionbinaryoperations", NULL, 45, &expression, &escapeChar, bindCounts); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "unary-op")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionunaryoperations", NULL, 46, &expression, &escapeChar, bindCounts); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "parentheses")) { - zephir_array_fetch_string(&_8$$14, &expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 295 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_7$$14, this_ptr, "getsqlexpression", NULL, 47, &_8$$14, &escapeChar, bindCounts); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, "(", &_7$$14, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "functionCall")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionfunctioncall", NULL, 48, &expression, &escapeChar, bindCounts); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "list")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionlist", NULL, 49, &expression, &escapeChar, bindCounts); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "all")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionall", NULL, 50, &expression, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "select")) { - zephir_array_fetch_string(&_10$$18, &expression, SL("value"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 327 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_9$$18, this_ptr, "select", NULL, 0, &_10$$18); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, "(", &_9$$18, ")"); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "cast")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressioncastvalue", NULL, 51, &expression, &escapeChar, bindCounts); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "convert")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionconvertvalue", NULL, 52, &expression, &escapeChar, bindCounts); - zephir_check_call_status(); - RETURN_MM(); - } - if (ZEPHIR_IS_STRING(&type, "case")) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressioncase", NULL, 53, &expression, &escapeChar, bindCounts); - zephir_check_call_status(); - RETURN_MM(); - } - } while(0); - - ZEPHIR_INIT_VAR(&_11); - object_init_ex(&_11, phalcon_db_exception_ce); - ZEPHIR_INIT_VAR(&_12); - ZEPHIR_CONCAT_SVS(&_12, "Invalid SQL expression type '", &type, "'"); - ZEPHIR_CALL_METHOD(NULL, &_11, "__construct", NULL, 1, &_12); - zephir_check_call_status(); - zephir_throw_exception_debug(&_11, "phalcon/Db/Dialect.zep", 360 TSRMLS_CC); - ZEPHIR_MM_RESTORE(); - return; - -} - -/** - * Transform an intermediate representation of a schema/table into a - * database system valid expression - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlTable) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *table, table_sub, *escapeChar_param = NULL, tableName, schemaName, aliasName; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&table_sub); - ZVAL_UNDEF(&tableName); - ZVAL_UNDEF(&schemaName); - ZVAL_UNDEF(&aliasName); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &table, &escapeChar_param); - - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - - - if (Z_TYPE_P(table) == IS_ARRAY) { - ZEPHIR_OBS_VAR(&tableName); - zephir_array_fetch_long(&tableName, table, 0, PH_NOISY, "phalcon/Db/Dialect.zep", 376 TSRMLS_CC); - ZEPHIR_OBS_VAR(&schemaName); - zephir_array_isset_long_fetch(&schemaName, table, 1, 0 TSRMLS_CC); - ZEPHIR_OBS_VAR(&aliasName); - zephir_array_isset_long_fetch(&aliasName, table, 2, 0 TSRMLS_CC); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparetable", NULL, 0, &tableName, &schemaName, &aliasName, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "escape", NULL, 54, table, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Generates the SQL for LIMIT clause - * - * - * // SELECT * FROM robots LIMIT 10 - * echo $dialect->limit( - * "SELECT * FROM robots", - * 10 - * ); - * - * // SELECT * FROM robots LIMIT 10 OFFSET 50 - * echo $dialect->limit( - * "SELECT * FROM robots", - * [10, 50] - * ); - * - */ -PHP_METHOD(Phalcon_Db_Dialect, limit) { - - zend_bool _2$$3; - zval *sqlQuery_param = NULL, *number, number_sub, _0$$3, _1$$3, _3$$3, _4$$4, _5$$4; - zval sqlQuery; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&sqlQuery); - ZVAL_UNDEF(&number_sub); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&_5$$4); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &sqlQuery_param, &number); - - if (UNEXPECTED(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be of the type string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(sqlQuery_param) == IS_STRING)) { - zephir_get_strval(&sqlQuery, sqlQuery_param); - } else { - ZEPHIR_INIT_VAR(&sqlQuery); - ZVAL_EMPTY_STRING(&sqlQuery); - } - - - if (Z_TYPE_P(number) == IS_ARRAY) { - zephir_array_fetch_long(&_0$$3, number, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 419 TSRMLS_CC); - ZEPHIR_INIT_VAR(&_1$$3); - ZEPHIR_CONCAT_SV(&_1$$3, " LIMIT ", &_0$$3); - zephir_concat_self(&sqlQuery, &_1$$3 TSRMLS_CC); - _2$$3 = zephir_array_isset_long(number, 1); - if (_2$$3) { - zephir_array_fetch_long(&_3$$3, number, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 421 TSRMLS_CC); - _2$$3 = ((zephir_fast_strlen_ev(&_3$$3)) ? 1 : 0); - } - if (_2$$3) { - zephir_array_fetch_long(&_4$$4, number, 1, PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 422 TSRMLS_CC); - ZEPHIR_INIT_VAR(&_5$$4); - ZEPHIR_CONCAT_SV(&_5$$4, " OFFSET ", &_4$$4); - zephir_concat_self(&sqlQuery, &_5$$4 TSRMLS_CC); - } - RETURN_CTOR(&sqlQuery); - } - ZEPHIR_CONCAT_VSV(return_value, &sqlQuery, " LIMIT ", number); - RETURN_MM(); - -} - -/** - * Registers custom SQL functions - */ -PHP_METHOD(Phalcon_Db_Dialect, registerCustomFunction) { - - zval *name_param = NULL, *customFunction, customFunction_sub; - zval name; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&customFunction_sub); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &name_param, &customFunction); - - zephir_get_strval(&name, name_param); - - - zephir_update_property_array(this_ptr, SL("customFunctions"), &name, customFunction); - RETURN_THIS(); - -} - -/** - * Generate SQL to release a savepoint - */ -PHP_METHOD(Phalcon_Db_Dialect, releaseSavepoint) { - - zval *name_param = NULL; - zval name; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&name); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - ZVAL_EMPTY_STRING(&name); - } - - - ZEPHIR_CONCAT_SV(return_value, "RELEASE SAVEPOINT ", &name); - RETURN_MM(); - -} - -/** - * Generate SQL to rollback a savepoint - */ -PHP_METHOD(Phalcon_Db_Dialect, rollbackSavepoint) { - - zval *name_param = NULL; - zval name; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&name); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - ZVAL_EMPTY_STRING(&name); - } - - - ZEPHIR_CONCAT_SV(return_value, "ROLLBACK TO SAVEPOINT ", &name); - RETURN_MM(); - -} - -/** - * Builds a SELECT statement - */ -PHP_METHOD(Phalcon_Db_Dialect, select) { - - zend_bool _5, _9, _12, _15, _18, _21, _23; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *definition_param = NULL, tables, columns, sql, distinct, joins, where, escapeChar, groupBy, having, orderBy, limit, forUpdate, bindCounts, _0, _1, _2, _3, _4, _6$$9, _7$$9, _8$$9, _10$$10, _11$$10, _13$$11, _14$$11, _16$$12, _17$$12, _19$$13, _20$$13; - zval definition, _22$$14; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&definition); - ZVAL_UNDEF(&_22$$14); - ZVAL_UNDEF(&tables); - ZVAL_UNDEF(&columns); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&distinct); - ZVAL_UNDEF(&joins); - ZVAL_UNDEF(&where); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&groupBy); - ZVAL_UNDEF(&having); - ZVAL_UNDEF(&orderBy); - ZVAL_UNDEF(&limit); - ZVAL_UNDEF(&forUpdate); - ZVAL_UNDEF(&bindCounts); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_6$$9); - ZVAL_UNDEF(&_7$$9); - ZVAL_UNDEF(&_8$$9); - ZVAL_UNDEF(&_10$$10); - ZVAL_UNDEF(&_11$$10); - ZVAL_UNDEF(&_13$$11); - ZVAL_UNDEF(&_14$$11); - ZVAL_UNDEF(&_16$$12); - ZVAL_UNDEF(&_17$$12); - ZVAL_UNDEF(&_19$$13); - ZVAL_UNDEF(&_20$$13); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &definition_param); - - ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); - - - ZEPHIR_OBS_VAR(&tables); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&tables, &definition, SL("tables"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'tables' is required in the definition array", "phalcon/Db/Dialect.zep", 468); - return; - } - ZEPHIR_OBS_VAR(&columns); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&columns, &definition, SL("columns"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'columns' is required in the definition array", "phalcon/Db/Dialect.zep", 474); - return; - } - ZEPHIR_OBS_VAR(&distinct); - if (zephir_array_isset_string_fetch(&distinct, &definition, SL("distinct"), 0)) { - ZEPHIR_INIT_VAR(&sql); - if (zephir_is_true(&distinct)) { - ZVAL_STRING(&sql, "SELECT DISTINCT"); - } else { - ZVAL_STRING(&sql, "SELECT ALL"); - } - } else { - ZEPHIR_INIT_NVAR(&sql); - ZVAL_STRING(&sql, "SELECT"); - } - ZEPHIR_OBS_VAR(&bindCounts); - zephir_array_isset_string_fetch(&bindCounts, &definition, SL("bindCounts"), 0); - zephir_read_property(&_0, this_ptr, SL("escapeChar"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&escapeChar, &_0); - ZEPHIR_CALL_METHOD(&_1, this_ptr, "getcolumnlist", NULL, 55, &columns, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2); - ZEPHIR_CONCAT_SV(&_2, " ", &_1); - zephir_concat_self(&sql, &_2 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "getsqlexpressionfrom", NULL, 56, &tables, &escapeChar); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_4); - ZEPHIR_CONCAT_SV(&_4, " ", &_3); - zephir_concat_self(&sql, &_4 TSRMLS_CC); - ZEPHIR_OBS_VAR(&joins); - _5 = zephir_array_isset_string_fetch(&joins, &definition, SL("joins"), 0); - if (_5) { - _5 = zephir_is_true(&joins); - } - if (_5) { - zephir_array_fetch_string(&_7$$9, &definition, SL("joins"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 505 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_6$$9, this_ptr, "getsqlexpressionjoins", NULL, 57, &_7$$9, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_8$$9); - ZEPHIR_CONCAT_SV(&_8$$9, " ", &_6$$9); - zephir_concat_self(&sql, &_8$$9 TSRMLS_CC); - } - ZEPHIR_OBS_VAR(&where); - _9 = zephir_array_isset_string_fetch(&where, &definition, SL("where"), 0); - if (_9) { - _9 = zephir_is_true(&where); - } - if (_9) { - ZEPHIR_CALL_METHOD(&_10$$10, this_ptr, "getsqlexpressionwhere", NULL, 58, &where, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_11$$10); - ZEPHIR_CONCAT_SV(&_11$$10, " ", &_10$$10); - zephir_concat_self(&sql, &_11$$10 TSRMLS_CC); - } - ZEPHIR_OBS_VAR(&groupBy); - _12 = zephir_array_isset_string_fetch(&groupBy, &definition, SL("group"), 0); - if (_12) { - _12 = zephir_is_true(&groupBy); - } - if (_12) { - ZEPHIR_CALL_METHOD(&_13$$11, this_ptr, "getsqlexpressiongroupby", NULL, 59, &groupBy, &escapeChar); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_14$$11); - ZEPHIR_CONCAT_SV(&_14$$11, " ", &_13$$11); - zephir_concat_self(&sql, &_14$$11 TSRMLS_CC); - } - ZEPHIR_OBS_VAR(&having); - _15 = zephir_array_isset_string_fetch(&having, &definition, SL("having"), 0); - if (_15) { - _15 = zephir_is_true(&having); - } - if (_15) { - ZEPHIR_CALL_METHOD(&_16$$12, this_ptr, "getsqlexpressionhaving", NULL, 60, &having, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_17$$12); - ZEPHIR_CONCAT_SV(&_17$$12, " ", &_16$$12); - zephir_concat_self(&sql, &_17$$12 TSRMLS_CC); - } - ZEPHIR_OBS_VAR(&orderBy); - _18 = zephir_array_isset_string_fetch(&orderBy, &definition, SL("order"), 0); - if (_18) { - _18 = zephir_is_true(&orderBy); - } - if (_18) { - ZEPHIR_CALL_METHOD(&_19$$13, this_ptr, "getsqlexpressionorderby", NULL, 61, &orderBy, &escapeChar, &bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_20$$13); - ZEPHIR_CONCAT_SV(&_20$$13, " ", &_19$$13); - zephir_concat_self(&sql, &_20$$13 TSRMLS_CC); - } - ZEPHIR_OBS_VAR(&limit); - _21 = zephir_array_isset_string_fetch(&limit, &definition, SL("limit"), 0); - if (_21) { - _21 = zephir_is_true(&limit); - } - if (_21) { - ZEPHIR_INIT_VAR(&_22$$14); - zephir_create_array(&_22$$14, 2, 0 TSRMLS_CC); - zephir_array_update_string(&_22$$14, SL("sql"), &sql, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_22$$14, SL("value"), &limit, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&sql, this_ptr, "getsqlexpressionlimit", NULL, 62, &_22$$14, &escapeChar, &bindCounts); - zephir_check_call_status(); - } - _23 = zephir_array_isset_string_fetch(&forUpdate, &definition, SL("forUpdate"), 1); - if (_23) { - _23 = zephir_is_true(&forUpdate); - } - if (_23) { - zephir_concat_self_str(&sql, SL(" FOR UPDATE") TSRMLS_CC); - } - RETURN_CCTOR(&sql); - -} - -/** - * Checks whether the platform supports savepoints - */ -PHP_METHOD(Phalcon_Db_Dialect, supportsSavepoints) { - - zval *this_ptr = getThis(); - - - RETURN_BOOL(1); - -} - -/** - * Checks whether the platform supports releasing savepoints. - */ -PHP_METHOD(Phalcon_Db_Dialect, supportsReleaseSavepoints) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - - - ZEPHIR_MM_GROW(); - - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "supportssavepoints", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Returns the size of the column enclosed in parentheses - */ -PHP_METHOD(Phalcon_Db_Dialect, getColumnSize) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column, column_sub, _0; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&_0); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &column); - - - - ZEPHIR_CALL_METHOD(&_0, column, "getsize", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVS(return_value, "(", &_0, ")"); - RETURN_MM(); - -} - -/** - * Returns the column size and scale enclosed in parentheses - */ -PHP_METHOD(Phalcon_Db_Dialect, getColumnSizeAndScale) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column, column_sub, _0, _1; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &column); - - - - ZEPHIR_CALL_METHOD(&_0, column, "getsize", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1, column, "getscale", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "(", &_0, ",", &_1, ")"); - RETURN_MM(); - -} - -/** - * Checks the column type and if not string it returns the type reference - */ -PHP_METHOD(Phalcon_Db_Dialect, checkColumnType) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column, column_sub, _0; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&_0); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &column); - - - - ZEPHIR_CALL_METHOD(&_0, column, "gettype", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&_0) == IS_STRING) { - ZEPHIR_RETURN_CALL_METHOD(column, "gettypereference", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_RETURN_CALL_METHOD(column, "gettype", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Checks the column type and returns the updated SQL statement - */ -PHP_METHOD(Phalcon_Db_Dialect, checkColumnTypeSql) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column, column_sub, _0; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&column_sub); - ZVAL_UNDEF(&_0); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &column); - - - - ZEPHIR_CALL_METHOD(&_0, column, "gettype", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&_0) != IS_STRING) { - RETURN_MM_STRING(""); - } - ZEPHIR_RETURN_CALL_METHOD(column, "gettype", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Resolve * - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionAll) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, domain, _0; - zval expression; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&domain); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &expression_param, &escapeChar_param); - - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - - - ZEPHIR_OBS_VAR(&domain); - zephir_array_isset_string_fetch(&domain, &expression, SL("domain"), 0); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "*"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparequalified", NULL, 0, &_0, &domain, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Resolve binary operations expressions - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionBinaryOperations) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, left, right, _0, _1, _2; - zval expression; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&left); - ZVAL_UNDEF(&right); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts); - - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - zephir_array_fetch_string(&_0, &expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 636 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", NULL, 0, &_0, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_fetch_string(&_1, &expression, SL("right"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 642 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", NULL, 47, &_1, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_fetch_string(&_2, &expression, SL("op"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 647 TSRMLS_CC); - ZEPHIR_CONCAT_VSVSV(return_value, &left, " ", &_2, " ", &right); - RETURN_MM(); - -} - -/** - * Resolve CASE expressions - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionCase) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar, sql; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, whenClause, _0, _1, _2, _3, *_4, _5, _6$$3, _7$$4, _8$$4, _9$$4, _10$$4, _11$$4, _12$$5, _13$$5, _14$$5, _15$$6, _16$$7, _17$$7, _18$$7, _19$$7, _20$$7, _21$$8, _22$$8, _23$$8; - zval expression; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&whenClause); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_6$$3); - ZVAL_UNDEF(&_7$$4); - ZVAL_UNDEF(&_8$$4); - ZVAL_UNDEF(&_9$$4); - ZVAL_UNDEF(&_10$$4); - ZVAL_UNDEF(&_11$$4); - ZVAL_UNDEF(&_12$$5); - ZVAL_UNDEF(&_13$$5); - ZVAL_UNDEF(&_14$$5); - ZVAL_UNDEF(&_15$$6); - ZVAL_UNDEF(&_16$$7); - ZVAL_UNDEF(&_17$$7); - ZVAL_UNDEF(&_18$$7); - ZVAL_UNDEF(&_19$$7); - ZVAL_UNDEF(&_20$$7); - ZVAL_UNDEF(&_21$$8); - ZVAL_UNDEF(&_22$$8); - ZVAL_UNDEF(&_23$$8); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&sql); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts); - - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - zephir_array_fetch_string(&_1, &expression, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 658 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getsqlexpression", NULL, 0, &_1, &escapeChar, bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2); - ZEPHIR_CONCAT_SV(&_2, "CASE ", &_0); - zephir_get_strval(&sql, &_2); - zephir_array_fetch_string(&_3, &expression, SL("when-clauses"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 660 TSRMLS_CC); - zephir_is_iterable(&_3, 0, "phalcon/Db/Dialect.zep", 671); - if (Z_TYPE_P(&_3) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_3), _4) - { - ZEPHIR_INIT_NVAR(&whenClause); - ZVAL_COPY(&whenClause, _4); - zephir_array_fetch_string(&_6$$3, &whenClause, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 661 TSRMLS_CC); - if (ZEPHIR_IS_STRING(&_6$$3, "when")) { - zephir_array_fetch_string(&_8$$4, &whenClause, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 663 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_7$$4, this_ptr, "getsqlexpression", NULL, 47, &_8$$4, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_fetch_string(&_10$$4, &whenClause, SL("then"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 665 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_9$$4, this_ptr, "getsqlexpression", NULL, 47, &_10$$4, &escapeChar, bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_LNVAR(_11$$4); - ZEPHIR_CONCAT_SVSV(&_11$$4, " WHEN ", &_7$$4, " THEN ", &_9$$4); - zephir_concat_self(&sql, &_11$$4 TSRMLS_CC); - } else { - zephir_array_fetch_string(&_13$$5, &whenClause, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 667 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_12$$5, this_ptr, "getsqlexpression", NULL, 47, &_13$$5, &escapeChar, bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_LNVAR(_14$$5); - ZEPHIR_CONCAT_SV(&_14$$5, " ELSE ", &_12$$5); - zephir_concat_self(&sql, &_14$$5 TSRMLS_CC); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_3, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_5, &_3, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_5)) { - break; - } - ZEPHIR_CALL_METHOD(&whenClause, &_3, "current", NULL, 0); - zephir_check_call_status(); - zephir_array_fetch_string(&_15$$6, &whenClause, SL("type"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 661 TSRMLS_CC); - if (ZEPHIR_IS_STRING(&_15$$6, "when")) { - zephir_array_fetch_string(&_17$$7, &whenClause, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 663 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_16$$7, this_ptr, "getsqlexpression", NULL, 47, &_17$$7, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_fetch_string(&_19$$7, &whenClause, SL("then"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 665 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_18$$7, this_ptr, "getsqlexpression", NULL, 47, &_19$$7, &escapeChar, bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_LNVAR(_20$$7); - ZEPHIR_CONCAT_SVSV(&_20$$7, " WHEN ", &_16$$7, " THEN ", &_18$$7); - zephir_concat_self(&sql, &_20$$7 TSRMLS_CC); - } else { - zephir_array_fetch_string(&_22$$8, &whenClause, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 667 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_21$$8, this_ptr, "getsqlexpression", NULL, 47, &_22$$8, &escapeChar, bindCounts); - zephir_check_call_status(); - ZEPHIR_INIT_LNVAR(_23$$8); - ZEPHIR_CONCAT_SV(&_23$$8, " ELSE ", &_21$$8); - zephir_concat_self(&sql, &_23$$8 TSRMLS_CC); - } - ZEPHIR_CALL_METHOD(NULL, &_3, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&whenClause); - ZEPHIR_CONCAT_VS(return_value, &sql, " END"); - RETURN_MM(); - -} - -/** - * Resolve CAST of values - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionCastValue) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, left, right, _0, _1; - zval expression; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&left); - ZVAL_UNDEF(&right); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts); - - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - zephir_array_fetch_string(&_0, &expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 682 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", NULL, 0, &_0, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_fetch_string(&_1, &expression, SL("right"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 688 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", NULL, 47, &_1, &escapeChar, bindCounts); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "CAST(", &left, " AS ", &right, ")"); - RETURN_MM(); - -} - -/** - * Resolve CONVERT of values encodings - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionConvertValue) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, left, right, _0, _1; - zval expression; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&left); - ZVAL_UNDEF(&right); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts); - - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - zephir_array_fetch_string(&_0, &expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 704 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", NULL, 0, &_0, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_fetch_string(&_1, &expression, SL("right"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 710 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", NULL, 47, &_1, &escapeChar, bindCounts); - zephir_check_call_status(); - ZEPHIR_CONCAT_SVSVS(return_value, "CONVERT(", &left, " USING ", &right, ")"); - RETURN_MM(); - -} - -/** - * Resolve a FROM clause - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionFrom) { - - zephir_fcall_cache_entry *_3 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression, expression_sub, *escapeChar_param = NULL, table, tables, *_0$$3, _1$$3, _5$$3, _2$$4, _4$$5; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression_sub); - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&tables); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &expression, &escapeChar_param); - - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - - - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&tables); - array_init(&tables); - zephir_is_iterable(expression, 0, "phalcon/Db/Dialect.zep", 732); - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(expression), _0$$3) - { - ZEPHIR_INIT_NVAR(&table); - ZVAL_COPY(&table, _0$$3); - ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "getsqltable", &_3, 63, &table, &escapeChar); - zephir_check_call_status(); - zephir_array_append(&tables, &_2$$4, PH_SEPARATE, "phalcon/Db/Dialect.zep", 729); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, expression, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1$$3, expression, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_1$$3)) { - break; - } - ZEPHIR_CALL_METHOD(&table, expression, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4$$5, this_ptr, "getsqltable", &_3, 63, &table, &escapeChar); - zephir_check_call_status(); - zephir_array_append(&tables, &_4$$5, PH_SEPARATE, "phalcon/Db/Dialect.zep", 729); - ZEPHIR_CALL_METHOD(NULL, expression, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&table); - ZEPHIR_INIT_VAR(&_5$$3); - zephir_fast_join_str(&_5$$3, SL(", "), &tables TSRMLS_CC); - ZEPHIR_CPY_WRT(&tables, &_5$$3); - } else { - ZEPHIR_CPY_WRT(&tables, expression); - } - ZEPHIR_CONCAT_SV(return_value, "FROM ", &tables); - RETURN_MM(); - -} - -/** - * Resolve function calls - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionFunctionCall) { - - zend_bool _1, _3$$4; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts, bindCounts_sub, __$false, name, customFunction, arguments, _0, _4$$4; - zval expression, _2$$4; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&customFunction); - ZVAL_UNDEF(&arguments); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 1, &expression_param, &escapeChar_param, &bindCounts); - - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - - - ZEPHIR_OBS_VAR(&name); - zephir_array_fetch_string(&name, &expression, SL("name"), PH_NOISY, "phalcon/Db/Dialect.zep", 747 TSRMLS_CC); - ZEPHIR_OBS_VAR(&customFunction); - zephir_read_property(&_0, this_ptr, SL("customFunctions"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset_fetch(&customFunction, &_0, &name, 0 TSRMLS_CC)) { - ZEPHIR_RETURN_CALL_ZVAL_FUNCTION(&customFunction, NULL, 0, this_ptr, &expression, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_OBS_VAR(&arguments); - _1 = zephir_array_isset_string_fetch(&arguments, &expression, SL("arguments"), 0); - if (_1) { - _1 = Z_TYPE_P(&arguments) == IS_ARRAY; - } - if (_1) { - ZEPHIR_INIT_VAR(&_2$$4); - zephir_create_array(&_2$$4, 3, 0 TSRMLS_CC); - add_assoc_stringl_ex(&_2$$4, SL("type"), SL("list")); - zephir_array_update_string(&_2$$4, SL("parentheses"), &__$false, PH_COPY | PH_SEPARATE); - zephir_array_update_string(&_2$$4, SL("value"), &arguments, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_METHOD(&arguments, this_ptr, "getsqlexpression", NULL, 0, &_2$$4, &escapeChar, bindCounts); - zephir_check_call_status(); - _3$$4 = zephir_array_isset_string(&expression, SL("distinct")); - if (_3$$4) { - zephir_array_fetch_string(&_4$$4, &expression, SL("distinct"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 765 TSRMLS_CC); - _3$$4 = zephir_is_true(&_4$$4); - } - if (_3$$4) { - ZEPHIR_CONCAT_VSVS(return_value, &name, "(DISTINCT ", &arguments, ")"); - RETURN_MM(); - } - ZEPHIR_CONCAT_VSVS(return_value, &name, "(", &arguments, ")"); - RETURN_MM(); - } - ZEPHIR_CONCAT_VS(return_value, &name, "()"); - RETURN_MM(); - -} - -/** - * Resolve a GROUP BY clause - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionGroupBy) { - - zephir_fcall_cache_entry *_3 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression, expression_sub, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, field, fields, *_0$$3, _1$$3, _5$$3, _2$$4, _4$$6; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression_sub); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&field); - ZVAL_UNDEF(&fields); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_5$$3); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_4$$6); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression, &escapeChar_param, &bindCounts); - - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&fields); - array_init(&fields); - zephir_is_iterable(expression, 0, "phalcon/Db/Dialect.zep", 797); - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(expression), _0$$3) - { - ZEPHIR_INIT_NVAR(&field); - ZVAL_COPY(&field, _0$$3); - if (UNEXPECTED(Z_TYPE_P(&field) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-GROUP-BY expression", "phalcon/Db/Dialect.zep", 787); - return; - } - ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "getsqlexpression", &_3, 0, &field, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_append(&fields, &_2$$4, PH_SEPARATE, "phalcon/Db/Dialect.zep", 794); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, expression, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1$$3, expression, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_1$$3)) { - break; - } - ZEPHIR_CALL_METHOD(&field, expression, "current", NULL, 0); - zephir_check_call_status(); - if (UNEXPECTED(Z_TYPE_P(&field) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-GROUP-BY expression", "phalcon/Db/Dialect.zep", 787); - return; - } - ZEPHIR_CALL_METHOD(&_4$$6, this_ptr, "getsqlexpression", &_3, 47, &field, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_append(&fields, &_4$$6, PH_SEPARATE, "phalcon/Db/Dialect.zep", 794); - ZEPHIR_CALL_METHOD(NULL, expression, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&field); - ZEPHIR_INIT_VAR(&_5$$3); - zephir_fast_join_str(&_5$$3, SL(", "), &fields TSRMLS_CC); - ZEPHIR_CPY_WRT(&fields, &_5$$3); - } else { - ZEPHIR_CPY_WRT(&fields, expression); - } - ZEPHIR_CONCAT_SV(return_value, "GROUP BY ", &fields); - RETURN_MM(); - -} - -/** - * Resolve a HAVING clause - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionHaving) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, _0; - zval expression; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts); - - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - ZEPHIR_CALL_METHOD(&_0, this_ptr, "getsqlexpression", NULL, 0, &expression, &escapeChar, bindCounts); - zephir_check_call_status(); - ZEPHIR_CONCAT_SV(return_value, "HAVING ", &_0); - RETURN_MM(); - -} - -/** - * Resolve a JOINs clause - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionJoins) { - - zend_bool _2$$3, _9$$3, _13$$11, _19$$11; - zephir_fcall_cache_entry *_3 = NULL, *_11 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar, sql; - zval *expression, expression_sub, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, condition, join, joinCondition, joinTable, joinType, joinConditionsArray, *_0, _1, _10$$3, _12$$3, *_4$$6, _5$$6, _8$$6, _6$$7, _7$$8, _20$$11, _21$$11, *_14$$14, _15$$14, _18$$14, _16$$15, _17$$16; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression_sub); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&condition); - ZVAL_UNDEF(&join); - ZVAL_UNDEF(&joinCondition); - ZVAL_UNDEF(&joinTable); - ZVAL_UNDEF(&joinType); - ZVAL_UNDEF(&joinConditionsArray); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_10$$3); - ZVAL_UNDEF(&_12$$3); - ZVAL_UNDEF(&_5$$6); - ZVAL_UNDEF(&_8$$6); - ZVAL_UNDEF(&_6$$7); - ZVAL_UNDEF(&_7$$8); - ZVAL_UNDEF(&_20$$11); - ZVAL_UNDEF(&_21$$11); - ZVAL_UNDEF(&_15$$14); - ZVAL_UNDEF(&_18$$14); - ZVAL_UNDEF(&_16$$15); - ZVAL_UNDEF(&_17$$16); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&sql); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression, &escapeChar_param, &bindCounts); - - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - ZEPHIR_INIT_VAR(&joinType); - ZVAL_STRING(&joinType, ""); - ZEPHIR_INIT_VAR(&sql); - ZVAL_STRING(&sql, ""); - zephir_is_iterable(expression, 0, "phalcon/Db/Dialect.zep", 859); - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(expression), _0) - { - ZEPHIR_INIT_NVAR(&join); - ZVAL_COPY(&join, _0); - ZEPHIR_OBS_NVAR(&joinConditionsArray); - _2$$3 = zephir_array_isset_string_fetch(&joinConditionsArray, &join, SL("conditions"), 0); - if (_2$$3) { - _2$$3 = !(ZEPHIR_IS_EMPTY(&joinConditionsArray)); - } - if (_2$$3) { - if (!(zephir_array_isset_long(&joinConditionsArray, 0))) { - ZEPHIR_CALL_METHOD(&joinCondition, this_ptr, "getsqlexpression", &_3, 0, &joinConditionsArray, &escapeChar, bindCounts); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&joinCondition); - array_init(&joinCondition); - zephir_is_iterable(&joinConditionsArray, 0, "phalcon/Db/Dialect.zep", 844); - if (Z_TYPE_P(&joinConditionsArray) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&joinConditionsArray), _4$$6) - { - ZEPHIR_INIT_NVAR(&condition); - ZVAL_COPY(&condition, _4$$6); - ZEPHIR_CALL_METHOD(&_6$$7, this_ptr, "getsqlexpression", &_3, 47, &condition, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_append(&joinCondition, &_6$$7, PH_SEPARATE, "phalcon/Db/Dialect.zep", 841); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &joinConditionsArray, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_5$$6, &joinConditionsArray, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_5$$6)) { - break; - } - ZEPHIR_CALL_METHOD(&condition, &joinConditionsArray, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_7$$8, this_ptr, "getsqlexpression", &_3, 47, &condition, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_append(&joinCondition, &_7$$8, PH_SEPARATE, "phalcon/Db/Dialect.zep", 841); - ZEPHIR_CALL_METHOD(NULL, &joinConditionsArray, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&condition); - ZEPHIR_INIT_NVAR(&_8$$6); - zephir_fast_join_str(&_8$$6, SL(" AND "), &joinCondition TSRMLS_CC); - ZEPHIR_CPY_WRT(&joinCondition, &_8$$6); - } - } else { - ZEPHIR_INIT_NVAR(&joinCondition); - ZVAL_LONG(&joinCondition, 1); - } - ZEPHIR_OBS_NVAR(&joinType); - _9$$3 = zephir_array_isset_string_fetch(&joinType, &join, SL("type"), 0); - if (_9$$3) { - _9$$3 = zephir_is_true(&joinType); - } - if (_9$$3) { - zephir_concat_self_str(&joinType, SL(" ") TSRMLS_CC); - } - zephir_array_fetch_string(&_10$$3, &join, SL("source"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 854 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&joinTable, this_ptr, "getsqltable", &_11, 63, &_10$$3, &escapeChar); - zephir_check_call_status(); - ZEPHIR_INIT_LNVAR(_12$$3); - ZEPHIR_CONCAT_SVSVSV(&_12$$3, " ", &joinType, "JOIN ", &joinTable, " ON ", &joinCondition); - zephir_concat_self(&sql, &_12$$3 TSRMLS_CC); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, expression, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1, expression, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_1)) { - break; - } - ZEPHIR_CALL_METHOD(&join, expression, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&joinConditionsArray); - _13$$11 = zephir_array_isset_string_fetch(&joinConditionsArray, &join, SL("conditions"), 0); - if (_13$$11) { - _13$$11 = !(ZEPHIR_IS_EMPTY(&joinConditionsArray)); - } - if (_13$$11) { - if (!(zephir_array_isset_long(&joinConditionsArray, 0))) { - ZEPHIR_CALL_METHOD(&joinCondition, this_ptr, "getsqlexpression", &_3, 47, &joinConditionsArray, &escapeChar, bindCounts); - zephir_check_call_status(); - } else { - ZEPHIR_INIT_NVAR(&joinCondition); - array_init(&joinCondition); - zephir_is_iterable(&joinConditionsArray, 0, "phalcon/Db/Dialect.zep", 844); - if (Z_TYPE_P(&joinConditionsArray) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&joinConditionsArray), _14$$14) - { - ZEPHIR_INIT_NVAR(&condition); - ZVAL_COPY(&condition, _14$$14); - ZEPHIR_CALL_METHOD(&_16$$15, this_ptr, "getsqlexpression", &_3, 47, &condition, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_append(&joinCondition, &_16$$15, PH_SEPARATE, "phalcon/Db/Dialect.zep", 841); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &joinConditionsArray, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_15$$14, &joinConditionsArray, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_15$$14)) { - break; - } - ZEPHIR_CALL_METHOD(&condition, &joinConditionsArray, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_17$$16, this_ptr, "getsqlexpression", &_3, 47, &condition, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_append(&joinCondition, &_17$$16, PH_SEPARATE, "phalcon/Db/Dialect.zep", 841); - ZEPHIR_CALL_METHOD(NULL, &joinConditionsArray, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&condition); - ZEPHIR_INIT_NVAR(&_18$$14); - zephir_fast_join_str(&_18$$14, SL(" AND "), &joinCondition TSRMLS_CC); - ZEPHIR_CPY_WRT(&joinCondition, &_18$$14); - } - } else { - ZEPHIR_INIT_NVAR(&joinCondition); - ZVAL_LONG(&joinCondition, 1); - } - ZEPHIR_OBS_NVAR(&joinType); - _19$$11 = zephir_array_isset_string_fetch(&joinType, &join, SL("type"), 0); - if (_19$$11) { - _19$$11 = zephir_is_true(&joinType); - } - if (_19$$11) { - zephir_concat_self_str(&joinType, SL(" ") TSRMLS_CC); - } - zephir_array_fetch_string(&_20$$11, &join, SL("source"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 854 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&joinTable, this_ptr, "getsqltable", &_11, 63, &_20$$11, &escapeChar); - zephir_check_call_status(); - ZEPHIR_INIT_LNVAR(_21$$11); - ZEPHIR_CONCAT_SVSVSV(&_21$$11, " ", &joinType, "JOIN ", &joinTable, " ON ", &joinCondition); - zephir_concat_self(&sql, &_21$$11 TSRMLS_CC); - ZEPHIR_CALL_METHOD(NULL, expression, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&join); - RETURN_CTOR(&sql); - -} - -/** - * Resolve a LIMIT clause - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionLimit) { - - zend_bool _2$$4; - zval _4; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression, expression_sub, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, sql, value, limit, offset, _0$$4, _1$$5, _3$$7; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression_sub); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&sql); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&limit); - ZVAL_UNDEF(&offset); - ZVAL_UNDEF(&_0$$4); - ZVAL_UNDEF(&_1$$5); - ZVAL_UNDEF(&_3$$7); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&_4); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression, &escapeChar_param, &bindCounts); - - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - ZEPHIR_INIT_VAR(&sql); - ZVAL_STRING(&sql, ""); - ZEPHIR_INIT_VAR(&offset); - ZVAL_NULL(&offset); - ZEPHIR_OBS_VAR(&value); - zephir_array_fetch_string(&value, expression, SL("value"), PH_NOISY, "phalcon/Db/Dialect.zep", 869 TSRMLS_CC); - if (zephir_array_isset_string(expression, SL("sql"))) { - ZEPHIR_OBS_NVAR(&sql); - zephir_array_fetch_string(&sql, expression, SL("sql"), PH_NOISY, "phalcon/Db/Dialect.zep", 872 TSRMLS_CC); - } - if (Z_TYPE_P(&value) == IS_ARRAY) { - ZEPHIR_OBS_VAR(&_0$$4); - zephir_array_fetch_string(&_0$$4, &value, SL("number"), PH_NOISY, "phalcon/Db/Dialect.zep", 876 TSRMLS_CC); - if (Z_TYPE_P(&_0$$4) == IS_ARRAY) { - zephir_array_fetch_string(&_1$$5, &value, SL("number"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 878 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&limit, this_ptr, "getsqlexpression", NULL, 0, &_1$$5, &escapeChar, bindCounts); - zephir_check_call_status(); - } else { - ZEPHIR_OBS_NVAR(&limit); - zephir_array_fetch_string(&limit, &value, SL("number"), PH_NOISY, "phalcon/Db/Dialect.zep", 883 TSRMLS_CC); - } - ZEPHIR_OBS_NVAR(&offset); - _2$$4 = zephir_array_isset_string_fetch(&offset, &value, SL("offset"), 0); - if (_2$$4) { - _2$$4 = Z_TYPE_P(&offset) == IS_ARRAY; - } - if (_2$$4) { - ZEPHIR_CALL_METHOD(&_3$$7, this_ptr, "getsqlexpression", NULL, 47, &offset, &escapeChar, bindCounts); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(&offset, &_3$$7); - } - } else { - ZEPHIR_CPY_WRT(&limit, &value); - } - ZEPHIR_INIT_VAR(&_4); - zephir_create_array(&_4, 2, 0 TSRMLS_CC); - zephir_array_fast_append(&_4, &limit); - zephir_array_fast_append(&_4, &offset); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "limit", NULL, 0, &sql, &_4); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Resolve Lists - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionList) { - - zend_bool _0, _1, _7$$4; - zephir_fcall_cache_entry *_5 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, item, values, separator, *_2$$4, _3$$4, _8$$4, _9$$4, _4$$5, _6$$6; - zval expression, items; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&items); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&item); - ZVAL_UNDEF(&values); - ZVAL_UNDEF(&separator); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_8$$4); - ZVAL_UNDEF(&_9$$4); - ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&_6$$6); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts); - - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - ZEPHIR_INIT_VAR(&items); - array_init(&items); - ZEPHIR_INIT_VAR(&separator); - ZVAL_STRING(&separator, ", "); - if (zephir_array_isset_string(&expression, SL("separator"))) { - ZEPHIR_OBS_NVAR(&separator); - zephir_array_fetch_string(&separator, &expression, SL("separator"), PH_NOISY, "phalcon/Db/Dialect.zep", 916 TSRMLS_CC); - } - ZEPHIR_OBS_VAR(&values); - _0 = zephir_array_isset_long_fetch(&values, &expression, 0, 0 TSRMLS_CC); - if (!(_0)) { - ZEPHIR_OBS_NVAR(&values); - _0 = zephir_array_isset_string_fetch(&values, &expression, SL("value"), 0); - } - _1 = _0; - if (_1) { - _1 = Z_TYPE_P(&values) == IS_ARRAY; - } - if (_1) { - zephir_is_iterable(&values, 0, "phalcon/Db/Dialect.zep", 925); - if (Z_TYPE_P(&values) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&values), _2$$4) - { - ZEPHIR_INIT_NVAR(&item); - ZVAL_COPY(&item, _2$$4); - ZEPHIR_CALL_METHOD(&_4$$5, this_ptr, "getsqlexpression", &_5, 0, &item, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_append(&items, &_4$$5, PH_SEPARATE, "phalcon/Db/Dialect.zep", 922); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &values, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_3$$4, &values, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_3$$4)) { - break; - } - ZEPHIR_CALL_METHOD(&item, &values, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_6$$6, this_ptr, "getsqlexpression", &_5, 47, &item, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_append(&items, &_6$$6, PH_SEPARATE, "phalcon/Db/Dialect.zep", 922); - ZEPHIR_CALL_METHOD(NULL, &values, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&item); - _7$$4 = zephir_array_isset_string(&expression, SL("parentheses")); - if (_7$$4) { - zephir_array_fetch_string(&_8$$4, &expression, SL("parentheses"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 925 TSRMLS_CC); - _7$$4 = ZEPHIR_IS_FALSE_IDENTICAL(&_8$$4); - } - if (_7$$4) { - zephir_fast_join(return_value, &separator, &items TSRMLS_CC); - RETURN_MM(); - } - ZEPHIR_INIT_VAR(&_9$$4); - zephir_fast_join(&_9$$4, &separator, &items TSRMLS_CC); - ZEPHIR_CONCAT_SVS(return_value, "(", &_9$$4, ")"); - RETURN_MM(); - } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-list expression", "phalcon/Db/Dialect.zep", 932); - return; - -} - -/** - * Resolve object expressions - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionObject) { - - zend_bool _0, _1; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, domain, objectExpression; - zval expression; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&domain); - ZVAL_UNDEF(&objectExpression); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts); - - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - ZEPHIR_INIT_VAR(&domain); - ZVAL_NULL(&domain); - ZEPHIR_INIT_VAR(&objectExpression); - zephir_create_array(&objectExpression, 1, 0 TSRMLS_CC); - add_assoc_stringl_ex(&objectExpression, SL("type"), SL("all")); - ZEPHIR_OBS_NVAR(&domain); - _0 = zephir_array_isset_string_fetch(&domain, &expression, SL("column"), 0); - if (!(_0)) { - ZEPHIR_OBS_NVAR(&domain); - _0 = zephir_array_isset_string_fetch(&domain, &expression, SL("domain"), 0); - } - _1 = _0; - if (_1) { - _1 = !ZEPHIR_IS_STRING(&domain, ""); - } - if (_1) { - zephir_array_update_string(&objectExpression, SL("domain"), &domain, PH_COPY | PH_SEPARATE); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpression", NULL, 0, &objectExpression, &escapeChar, bindCounts); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Resolve an ORDER BY clause - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionOrderBy) { - - zend_bool _4$$4, _7$$7; - zephir_fcall_cache_entry *_3 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression, expression_sub, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, field, fields, type, fieldSql, *_0$$3, _1$$3, _9$$3, _2$$4, _5$$6, _6$$7, _8$$9; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression_sub); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&field); - ZVAL_UNDEF(&fields); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&fieldSql); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_9$$3); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_5$$6); - ZVAL_UNDEF(&_6$$7); - ZVAL_UNDEF(&_8$$9); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression, &escapeChar_param, &bindCounts); - - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - ZEPHIR_INIT_VAR(&fieldSql); - ZVAL_NULL(&fieldSql); - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&fields); - array_init(&fields); - zephir_is_iterable(expression, 0, "phalcon/Db/Dialect.zep", 985); - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(expression), _0$$3) - { - ZEPHIR_INIT_NVAR(&field); - ZVAL_COPY(&field, _0$$3); - if (UNEXPECTED(Z_TYPE_P(&field) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-ORDER-BY expression", "phalcon/Db/Dialect.zep", 966); - return; - } - zephir_array_fetch_long(&_2$$4, &field, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 970 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&fieldSql, this_ptr, "getsqlexpression", &_3, 0, &_2$$4, &escapeChar, bindCounts); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&type); - _4$$4 = zephir_array_isset_long_fetch(&type, &field, 1, 0 TSRMLS_CC); - if (_4$$4) { - _4$$4 = !ZEPHIR_IS_STRING(&type, ""); - } - if (_4$$4) { - ZEPHIR_INIT_LNVAR(_5$$6); - ZEPHIR_CONCAT_SV(&_5$$6, " ", &type); - zephir_concat_self(&fieldSql, &_5$$6 TSRMLS_CC); - } - zephir_array_append(&fields, &fieldSql, PH_SEPARATE, "phalcon/Db/Dialect.zep", 982); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, expression, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_1$$3, expression, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_1$$3)) { - break; - } - ZEPHIR_CALL_METHOD(&field, expression, "current", NULL, 0); - zephir_check_call_status(); - if (UNEXPECTED(Z_TYPE_P(&field) != IS_ARRAY)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-ORDER-BY expression", "phalcon/Db/Dialect.zep", 966); - return; - } - zephir_array_fetch_long(&_6$$7, &field, 0, PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 970 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&fieldSql, this_ptr, "getsqlexpression", &_3, 47, &_6$$7, &escapeChar, bindCounts); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&type); - _7$$7 = zephir_array_isset_long_fetch(&type, &field, 1, 0 TSRMLS_CC); - if (_7$$7) { - _7$$7 = !ZEPHIR_IS_STRING(&type, ""); - } - if (_7$$7) { - ZEPHIR_INIT_LNVAR(_8$$9); - ZEPHIR_CONCAT_SV(&_8$$9, " ", &type); - zephir_concat_self(&fieldSql, &_8$$9 TSRMLS_CC); - } - zephir_array_append(&fields, &fieldSql, PH_SEPARATE, "phalcon/Db/Dialect.zep", 982); - ZEPHIR_CALL_METHOD(NULL, expression, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&field); - ZEPHIR_INIT_VAR(&_9$$3); - zephir_fast_join_str(&_9$$3, SL(", "), &fields TSRMLS_CC); - ZEPHIR_CPY_WRT(&fields, &_9$$3); - } else { - ZEPHIR_CPY_WRT(&fields, expression); - } - ZEPHIR_CONCAT_SV(return_value, "ORDER BY ", &fields); - RETURN_MM(); - -} - -/** - * Resolve qualified expressions - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionQualified) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, column, domain; - zval expression; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&domain); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &expression_param, &escapeChar_param); - - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - - - ZEPHIR_OBS_VAR(&column); - zephir_array_fetch_string(&column, &expression, SL("name"), PH_NOISY, "phalcon/Db/Dialect.zep", 1000 TSRMLS_CC); - ZEPHIR_OBS_VAR(&domain); - if (!(zephir_array_isset_string_fetch(&domain, &expression, SL("domain"), 0))) { - ZEPHIR_INIT_NVAR(&domain); - ZVAL_NULL(&domain); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparequalified", NULL, 0, &column, &domain, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); - -} - -/** - * Resolve Column expressions - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionScalar) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, value, _0$$3; - zval expression; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts); - - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - if (zephir_array_isset_string(&expression, SL("column"))) { - zephir_array_fetch_string(&_0$$3, &expression, SL("column"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 1020 TSRMLS_CC); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlcolumn", NULL, 41, &_0$$3); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_OBS_VAR(&value); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&value, &expression, SL("value"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL expression", "phalcon/Db/Dialect.zep", 1024); - return; - } - if (Z_TYPE_P(&value) == IS_ARRAY) { - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpression", NULL, 0, &value, &escapeChar, bindCounts); - zephir_check_call_status(); - RETURN_MM(); - } - RETURN_CCTOR(&value); - -} - -/** - * Resolve unary operations expressions - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionUnaryOperations) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression_param = NULL, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, left, right, _0$$3, _1$$3, _2$$4, _3$$4; - zval expression; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&left); - ZVAL_UNDEF(&right); - ZVAL_UNDEF(&_0$$3); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression_param, &escapeChar_param, &bindCounts); - - ZEPHIR_OBS_COPY_OR_DUP(&expression, expression_param); - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - ZEPHIR_OBS_VAR(&left); - if (zephir_array_isset_string_fetch(&left, &expression, SL("left"), 0)) { - ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "getsqlexpression", NULL, 0, &left, &escapeChar, bindCounts); - zephir_check_call_status(); - zephir_array_fetch_string(&_1$$3, &expression, SL("op"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 1045 TSRMLS_CC); - ZEPHIR_CONCAT_VSV(return_value, &_0$$3, " ", &_1$$3); - RETURN_MM(); - } - ZEPHIR_OBS_VAR(&right); - if (zephir_array_isset_string_fetch(&right, &expression, SL("right"), 0)) { - zephir_array_fetch_string(&_2$$4, &expression, SL("op"), PH_NOISY | PH_READONLY, "phalcon/Db/Dialect.zep", 1052 TSRMLS_CC); - ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "getsqlexpression", NULL, 47, &right, &escapeChar, bindCounts); - zephir_check_call_status(); - ZEPHIR_CONCAT_VSV(return_value, &_2$$4, " ", &_3$$4); - RETURN_MM(); - } - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-unary expression", "phalcon/Db/Dialect.zep", 1055); - return; - -} - -/** - * Resolve a WHERE clause - */ -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionWhere) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval escapeChar; - zval *expression, expression_sub, *escapeChar_param = NULL, *bindCounts = NULL, bindCounts_sub, __$null, whereSql; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&expression_sub); - ZVAL_UNDEF(&bindCounts_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&whereSql); - ZVAL_UNDEF(&escapeChar); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &expression, &escapeChar_param, &bindCounts); - - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - if (!bindCounts) { - bindCounts = &bindCounts_sub; - bindCounts = &__$null; - } - - - if (Z_TYPE_P(expression) == IS_ARRAY) { - ZEPHIR_CALL_METHOD(&whereSql, this_ptr, "getsqlexpression", NULL, 0, expression, &escapeChar, bindCounts); - zephir_check_call_status(); - } else { - ZEPHIR_CPY_WRT(&whereSql, expression); - } - ZEPHIR_CONCAT_SV(return_value, "WHERE ", &whereSql); - RETURN_MM(); - -} - -/** - * Prepares column for this RDBMS - */ -PHP_METHOD(Phalcon_Db_Dialect, prepareColumnAlias) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *qualified_param = NULL, *alias_param = NULL, *escapeChar_param = NULL, _0$$3; - zval qualified, alias, escapeChar; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&qualified); - ZVAL_UNDEF(&alias); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&_0$$3); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &qualified_param, &alias_param, &escapeChar_param); - - if (UNEXPECTED(Z_TYPE_P(qualified_param) != IS_STRING && Z_TYPE_P(qualified_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'qualified' must be of the type string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(qualified_param) == IS_STRING)) { - zephir_get_strval(&qualified, qualified_param); - } else { - ZEPHIR_INIT_VAR(&qualified); - ZVAL_EMPTY_STRING(&qualified); - } - if (!alias_param) { - ZEPHIR_INIT_VAR(&alias); - ZVAL_STRING(&alias, ""); - } else { - zephir_get_strval(&alias, alias_param); - } - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - - - if (!ZEPHIR_IS_STRING(&alias, "")) { - ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "escape", NULL, 54, &alias, &escapeChar); - zephir_check_call_status(); - ZEPHIR_CONCAT_VSV(return_value, &qualified, " AS ", &_0$$3); - RETURN_MM(); - } - RETURN_CTOR(&qualified); - -} - -/** - * Prepares table for this RDBMS - */ -PHP_METHOD(Phalcon_Db_Dialect, prepareTable) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *table_param = NULL, *schema_param = NULL, *alias_param = NULL, *escapeChar_param = NULL, _0, _1$$3, _2$$3, _3$$4, _4$$4; - zval table, schema, alias, escapeChar; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&table); - ZVAL_UNDEF(&schema); - ZVAL_UNDEF(&alias); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_4$$4); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 3, &table_param, &schema_param, &alias_param, &escapeChar_param); - - if (UNEXPECTED(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be of the type string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(table_param) == IS_STRING)) { - zephir_get_strval(&table, table_param); - } else { - ZEPHIR_INIT_VAR(&table); - ZVAL_EMPTY_STRING(&table); - } - if (!schema_param) { - ZEPHIR_INIT_VAR(&schema); - ZVAL_STRING(&schema, ""); - } else { - zephir_get_strval(&schema, schema_param); - } - if (!alias_param) { - ZEPHIR_INIT_VAR(&alias); - ZVAL_STRING(&alias, ""); - } else { - zephir_get_strval(&alias, alias_param); - } - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - - - ZEPHIR_CALL_METHOD(&_0, this_ptr, "escape", NULL, 54, &table, &escapeChar); - zephir_check_call_status(); - zephir_get_strval(&table, &_0); - if (!ZEPHIR_IS_STRING(&schema, "")) { - ZEPHIR_CALL_METHOD(&_1$$3, this_ptr, "escapeschema", NULL, 64, &schema, &escapeChar); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_2$$3); - ZEPHIR_CONCAT_VSV(&_2$$3, &_1$$3, ".", &table); - zephir_get_strval(&table, &_2$$3); - } - if (!ZEPHIR_IS_STRING(&alias, "")) { - ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "escape", NULL, 54, &alias, &escapeChar); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_4$$4); - ZEPHIR_CONCAT_VSV(&_4$$4, &table, " AS ", &_3$$4); - zephir_get_strval(&table, &_4$$4); - } - RETURN_CTOR(&table); - -} - -/** - * Prepares qualified for this RDBMS - */ -PHP_METHOD(Phalcon_Db_Dialect, prepareQualified) { - - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *column_param = NULL, *domain_param = NULL, *escapeChar_param = NULL; - zval column, domain, escapeChar, _0$$3; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&column); - ZVAL_UNDEF(&domain); - ZVAL_UNDEF(&escapeChar); - ZVAL_UNDEF(&_0$$3); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &column_param, &domain_param, &escapeChar_param); - - if (UNEXPECTED(Z_TYPE_P(column_param) != IS_STRING && Z_TYPE_P(column_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'column' must be of the type string") TSRMLS_CC); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(column_param) == IS_STRING)) { - zephir_get_strval(&column, column_param); - } else { - ZEPHIR_INIT_VAR(&column); - ZVAL_EMPTY_STRING(&column); - } - if (!domain_param) { - ZEPHIR_INIT_VAR(&domain); - ZVAL_STRING(&domain, ""); - } else { - zephir_get_strval(&domain, domain_param); - } - if (!escapeChar_param) { - ZEPHIR_INIT_VAR(&escapeChar); - ZVAL_STRING(&escapeChar, ""); - } else { - zephir_get_strval(&escapeChar, escapeChar_param); - } - - - if (!ZEPHIR_IS_STRING(&domain, "")) { - ZEPHIR_INIT_VAR(&_0$$3); - ZEPHIR_CONCAT_VSV(&_0$$3, &domain, ".", &column); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "escape", NULL, 54, &_0$$3, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "escape", NULL, 54, &column, &escapeChar); - zephir_check_call_status(); - RETURN_MM(); - -} - diff --git a/ext/phalcon/db/dialect.zep.h b/ext/phalcon/db/dialect.zep.h deleted file mode 100644 index bc9ec7f520b..00000000000 --- a/ext/phalcon/db/dialect.zep.h +++ /dev/null @@ -1,635 +0,0 @@ - -extern zend_class_entry *phalcon_db_dialect_ce; - -ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect); - -PHP_METHOD(Phalcon_Db_Dialect, createSavepoint); -PHP_METHOD(Phalcon_Db_Dialect, escape); -PHP_METHOD(Phalcon_Db_Dialect, escapeSchema); -PHP_METHOD(Phalcon_Db_Dialect, forUpdate); -PHP_METHOD(Phalcon_Db_Dialect, getColumnList); -PHP_METHOD(Phalcon_Db_Dialect, getCustomFunctions); -PHP_METHOD(Phalcon_Db_Dialect, getSqlColumn); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpression); -PHP_METHOD(Phalcon_Db_Dialect, getSqlTable); -PHP_METHOD(Phalcon_Db_Dialect, limit); -PHP_METHOD(Phalcon_Db_Dialect, registerCustomFunction); -PHP_METHOD(Phalcon_Db_Dialect, releaseSavepoint); -PHP_METHOD(Phalcon_Db_Dialect, rollbackSavepoint); -PHP_METHOD(Phalcon_Db_Dialect, select); -PHP_METHOD(Phalcon_Db_Dialect, supportsSavepoints); -PHP_METHOD(Phalcon_Db_Dialect, supportsReleaseSavepoints); -PHP_METHOD(Phalcon_Db_Dialect, getColumnSize); -PHP_METHOD(Phalcon_Db_Dialect, getColumnSizeAndScale); -PHP_METHOD(Phalcon_Db_Dialect, checkColumnType); -PHP_METHOD(Phalcon_Db_Dialect, checkColumnTypeSql); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionAll); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionBinaryOperations); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionCase); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionCastValue); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionConvertValue); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionFrom); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionFunctionCall); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionGroupBy); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionHaving); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionJoins); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionLimit); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionList); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionObject); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionOrderBy); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionQualified); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionScalar); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionUnaryOperations); -PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionWhere); -PHP_METHOD(Phalcon_Db_Dialect, prepareColumnAlias); -PHP_METHOD(Phalcon_Db_Dialect, prepareTable); -PHP_METHOD(Phalcon_Db_Dialect, prepareQualified); - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_createsavepoint, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_createsavepoint, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, name) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_escape, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_escape, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, str) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_escapeschema, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_escapeschema, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, str) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_forupdate, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_forupdate, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, sqlQuery, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, sqlQuery) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getcolumnlist, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getcolumnlist, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, columnList, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getcustomfunctions, 0, 0, IS_ARRAY, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getcustomfunctions, 0, 0, IS_ARRAY, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlcolumn, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlcolumn, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_INFO(0, column) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpression, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpression, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, expression, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqltable, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqltable, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_INFO(0, table) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_limit, 0, 2, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_limit, 0, 2, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, sqlQuery, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, sqlQuery) -#endif - ZEND_ARG_INFO(0, number) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_db_dialect_registercustomfunction, 0, 2, Phalcon\\Db\\Dialect, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_registercustomfunction, 0, 2, IS_OBJECT, "Phalcon\\Db\\Dialect", 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, name) -#endif - ZEND_ARG_INFO(0, customFunction) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_releasesavepoint, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_releasesavepoint, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, name) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_rollbacksavepoint, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_rollbacksavepoint, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, name) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_select, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_select, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, definition, 0) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_supportssavepoints, 0, 0, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_supportssavepoints, 0, 0, _IS_BOOL, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_supportsreleasesavepoints, 0, 0, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_supportsreleasesavepoints, 0, 0, _IS_BOOL, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getcolumnsize, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getcolumnsize, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_OBJ_INFO(0, column, Phalcon\\Db\\ColumnInterface, 0) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getcolumnsizeandscale, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getcolumnsizeandscale, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_OBJ_INFO(0, column, Phalcon\\Db\\ColumnInterface, 0) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_checkcolumntype, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_checkcolumntype, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_OBJ_INFO(0, column, Phalcon\\Db\\ColumnInterface, 0) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_checkcolumntypesql, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_checkcolumntypesql, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_OBJ_INFO(0, column, Phalcon\\Db\\ColumnInterface, 0) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionall, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionall, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, expression, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionbinaryoperations, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionbinaryoperations, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, expression, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressioncase, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressioncase, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, expression, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressioncastvalue, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressioncastvalue, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, expression, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionconvertvalue, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionconvertvalue, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, expression, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionfrom, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionfrom, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_INFO(0, expression) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionfunctioncall, 0, 2, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionfunctioncall, 0, 2, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, expression, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressiongroupby, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressiongroupby, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_INFO(0, expression) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionhaving, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionhaving, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, expression, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionjoins, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionjoins, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_INFO(0, expression) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionlimit, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionlimit, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_INFO(0, expression) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionlist, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionlist, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, expression, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionobject, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionobject, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, expression, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionorderby, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionorderby, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_INFO(0, expression) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionqualified, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionqualified, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, expression, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionscalar, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionscalar, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, expression, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionunaryoperations, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionunaryoperations, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, expression, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionwhere, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionwhere, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_INFO(0, expression) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_preparecolumnalias, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_preparecolumnalias, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, qualified, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, qualified) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, alias, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, alias) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_preparetable, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_preparetable, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, table) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schema, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, schema) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, alias, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, alias) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_preparequalified, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialect_preparequalified, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, column, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, column) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, domain) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif -ZEND_END_ARG_INFO() - -ZEPHIR_INIT_FUNCS(phalcon_db_dialect_method_entry) { - PHP_ME(Phalcon_Db_Dialect, createSavepoint, arginfo_phalcon_db_dialect_createsavepoint, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, escape, arginfo_phalcon_db_dialect_escape, ZEND_ACC_FINAL|ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, escapeSchema, arginfo_phalcon_db_dialect_escapeschema, ZEND_ACC_FINAL|ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, forUpdate, arginfo_phalcon_db_dialect_forupdate, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, getColumnList, arginfo_phalcon_db_dialect_getcolumnlist, ZEND_ACC_FINAL|ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, getCustomFunctions, arginfo_phalcon_db_dialect_getcustomfunctions, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, getSqlColumn, arginfo_phalcon_db_dialect_getsqlcolumn, ZEND_ACC_FINAL|ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, getSqlExpression, arginfo_phalcon_db_dialect_getsqlexpression, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, getSqlTable, arginfo_phalcon_db_dialect_getsqltable, ZEND_ACC_FINAL|ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, limit, arginfo_phalcon_db_dialect_limit, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, registerCustomFunction, arginfo_phalcon_db_dialect_registercustomfunction, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, releaseSavepoint, arginfo_phalcon_db_dialect_releasesavepoint, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, rollbackSavepoint, arginfo_phalcon_db_dialect_rollbacksavepoint, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, select, arginfo_phalcon_db_dialect_select, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, supportsSavepoints, arginfo_phalcon_db_dialect_supportssavepoints, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, supportsReleaseSavepoints, arginfo_phalcon_db_dialect_supportsreleasesavepoints, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Db_Dialect, getColumnSize, arginfo_phalcon_db_dialect_getcolumnsize, ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getColumnSizeAndScale, arginfo_phalcon_db_dialect_getcolumnsizeandscale, ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, checkColumnType, arginfo_phalcon_db_dialect_checkcolumntype, ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, checkColumnTypeSql, arginfo_phalcon_db_dialect_checkcolumntypesql, ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionAll, arginfo_phalcon_db_dialect_getsqlexpressionall, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionBinaryOperations, arginfo_phalcon_db_dialect_getsqlexpressionbinaryoperations, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionCase, arginfo_phalcon_db_dialect_getsqlexpressioncase, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionCastValue, arginfo_phalcon_db_dialect_getsqlexpressioncastvalue, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionConvertValue, arginfo_phalcon_db_dialect_getsqlexpressionconvertvalue, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionFrom, arginfo_phalcon_db_dialect_getsqlexpressionfrom, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionFunctionCall, arginfo_phalcon_db_dialect_getsqlexpressionfunctioncall, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionGroupBy, arginfo_phalcon_db_dialect_getsqlexpressiongroupby, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionHaving, arginfo_phalcon_db_dialect_getsqlexpressionhaving, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionJoins, arginfo_phalcon_db_dialect_getsqlexpressionjoins, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionLimit, arginfo_phalcon_db_dialect_getsqlexpressionlimit, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionList, arginfo_phalcon_db_dialect_getsqlexpressionlist, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionObject, arginfo_phalcon_db_dialect_getsqlexpressionobject, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionOrderBy, arginfo_phalcon_db_dialect_getsqlexpressionorderby, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionQualified, arginfo_phalcon_db_dialect_getsqlexpressionqualified, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionScalar, arginfo_phalcon_db_dialect_getsqlexpressionscalar, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionUnaryOperations, arginfo_phalcon_db_dialect_getsqlexpressionunaryoperations, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, getSqlExpressionWhere, arginfo_phalcon_db_dialect_getsqlexpressionwhere, ZEND_ACC_FINAL|ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, prepareColumnAlias, arginfo_phalcon_db_dialect_preparecolumnalias, ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, prepareTable, arginfo_phalcon_db_dialect_preparetable, ZEND_ACC_PROTECTED) - PHP_ME(Phalcon_Db_Dialect, prepareQualified, arginfo_phalcon_db_dialect_preparequalified, ZEND_ACC_PROTECTED) - PHP_FE_END -}; diff --git a/ext/phalcon/db/dialectinterface.zep.c b/ext/phalcon/db/dialectinterface.zep.c deleted file mode 100644 index f2f20b2a1de..00000000000 --- a/ext/phalcon/db/dialectinterface.zep.c +++ /dev/null @@ -1,206 +0,0 @@ - -#ifdef HAVE_CONFIG_H -#include "../../ext_config.h" -#endif - -#include -#include "../../php_ext.h" -#include "../../ext.h" - -#include - -#include "kernel/main.h" - - -/** - * This file is part of the Phalcon Framework. - * - * (c) Phalcon Team - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -/** - * Phalcon\Db\DialectInterface - * - * Interface for Phalcon\Db dialects - */ -ZEPHIR_INIT_CLASS(Phalcon_Db_DialectInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Db, DialectInterface, phalcon, db_dialectinterface, phalcon_db_dialectinterface_method_entry); - - return SUCCESS; - -} - -/** - * Generates SQL to add a column to a table - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, addColumn); - -/** - * Generates SQL to add an index to a table - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, addForeignKey); - -/** - * Generates SQL to add an index to a table - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, addIndex); - -/** - * Generates SQL to add the primary key to a table - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, addPrimaryKey); - -/** - * Generate SQL to create a new savepoint - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, createSavepoint); - -/** - * Generates SQL to create a table - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, createTable); - -/** - * Generates SQL to create a view - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, createView); - -/** - * Generates SQL to describe a table - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, describeColumns); - -/** - * Generates SQL to query indexes on a table - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, describeIndexes); - -/** - * Generates SQL to query foreign keys on a table - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, describeReferences); - -/** - * Generates SQL to delete a column from a table - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropColumn); - -/** - * Generates SQL to delete a foreign key from a table - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropForeignKey); - -/** - * Generates SQL to delete an index from a table - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropIndex); - -/** - * Generates SQL to delete primary key from a table - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropPrimaryKey); - -/** - * Generates SQL to drop a table - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropTable); - -/** - * Generates SQL to drop a view - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropView); - -/** - * Returns a SQL modified with a FOR UPDATE clause - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, forUpdate); - -/** - * Gets the column name in RDBMS - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, getColumnDefinition); - -/** - * Gets a list of columns - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, getColumnList); - -/** - * Returns registered functions - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, getCustomFunctions); - -/** - * Transforms an intermediate representation for an expression into a - * database system valid expression - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, getSqlExpression); - -/** - * Generates the SQL for LIMIT clause - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, limit); - -/** - * List all tables in database - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, listTables); - -/** - * Generates SQL to modify a column in a table - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, modifyColumn); - -/** - * Registers custom SQL functions - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, registerCustomFunction); - -/** - * Generate SQL to release a savepoint - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, releaseSavepoint); - -/** - * Generate SQL to rollback a savepoint - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, rollbackSavepoint); - -/** - * Builds a SELECT statement - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, select); - -/** - * Returns a SQL modified with a LOCK IN SHARE MODE clause - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, sharedLock); - -/** - * Checks whether the platform supports releasing savepoints. - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, supportsReleaseSavepoints); - -/** - * Checks whether the platform supports savepoints - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, supportsSavepoints); - -/** - * Generates SQL checking for the existence of a schema.table - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, tableExists); - -/** - * Generates the SQL to describe the table creation options - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, tableOptions); - -/** - * Generates SQL checking for the existence of a schema.view - */ -ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, viewExists); - diff --git a/ext/phalcon/db/dialectinterface.zep.h b/ext/phalcon/db/dialectinterface.zep.h deleted file mode 100644 index 429be36602e..00000000000 --- a/ext/phalcon/db/dialectinterface.zep.h +++ /dev/null @@ -1,550 +0,0 @@ - -extern zend_class_entry *phalcon_db_dialectinterface_ce; - -ZEPHIR_INIT_CLASS(Phalcon_Db_DialectInterface); - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_addcolumn, 0, 3, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_addcolumn, 0, 3, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, tableName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, schemaName) -#endif - ZEND_ARG_OBJ_INFO(0, column, Phalcon\\Db\\ColumnInterface, 0) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_addforeignkey, 0, 3, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_addforeignkey, 0, 3, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, tableName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, schemaName) -#endif - ZEND_ARG_OBJ_INFO(0, reference, Phalcon\\Db\\ReferenceInterface, 0) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_addindex, 0, 3, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_addindex, 0, 3, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, tableName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, schemaName) -#endif - ZEND_ARG_OBJ_INFO(0, index, Phalcon\\Db\\IndexInterface, 0) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_addprimarykey, 0, 3, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_addprimarykey, 0, 3, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, tableName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, schemaName) -#endif - ZEND_ARG_OBJ_INFO(0, index, Phalcon\\Db\\IndexInterface, 0) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_createsavepoint, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_createsavepoint, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, name) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_createtable, 0, 3, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_createtable, 0, 3, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, tableName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, schemaName) -#endif - ZEND_ARG_ARRAY_INFO(0, definition, 0) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_createview, 0, 2, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_createview, 0, 2, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, viewName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, viewName) -#endif - ZEND_ARG_ARRAY_INFO(0, definition, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, schemaName) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_describecolumns, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_describecolumns, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, table) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schema, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, schema) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_describeindexes, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_describeindexes, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, table) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schema, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, schema) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_describereferences, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_describereferences, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, table) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schema, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, schema) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_dropcolumn, 0, 3, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_dropcolumn, 0, 3, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, tableName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, schemaName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, columnName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, columnName) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_dropforeignkey, 0, 3, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_dropforeignkey, 0, 3, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, tableName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, schemaName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, referenceName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, referenceName) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_dropindex, 0, 3, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_dropindex, 0, 3, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, tableName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, schemaName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, indexName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, indexName) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_dropprimarykey, 0, 2, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_dropprimarykey, 0, 2, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, tableName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, schemaName) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_droptable, 0, 2, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_droptable, 0, 2, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, tableName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, schemaName) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_dropview, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_dropview, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, viewName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, viewName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, schemaName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, ifExists, _IS_BOOL, 0) -#else - ZEND_ARG_INFO(0, ifExists) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_forupdate, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_forupdate, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, sqlQuery, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, sqlQuery) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_getcolumndefinition, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_getcolumndefinition, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_OBJ_INFO(0, column, Phalcon\\Db\\ColumnInterface, 0) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_getcolumnlist, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_getcolumnlist, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, columnList, 0) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_getcustomfunctions, 0, 0, IS_ARRAY, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_getcustomfunctions, 0, 0, IS_ARRAY, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_getsqlexpression, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_getsqlexpression, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, expression, 0) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, escapeChar, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, escapeChar) -#endif - ZEND_ARG_INFO(0, bindCounts) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_limit, 0, 2, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_limit, 0, 2, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, sqlQuery, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, sqlQuery) -#endif - ZEND_ARG_INFO(0, number) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_listtables, 0, 0, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_listtables, 0, 0, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, schemaName) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_modifycolumn, 0, 3, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_modifycolumn, 0, 3, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, tableName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, schemaName) -#endif - ZEND_ARG_OBJ_INFO(0, column, Phalcon\\Db\\ColumnInterface, 0) - ZEND_ARG_OBJ_INFO(0, currentColumn, Phalcon\\Db\\ColumnInterface, 1) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_db_dialectinterface_registercustomfunction, 0, 2, Phalcon\\Db\\Dialect, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_registercustomfunction, 0, 2, IS_OBJECT, "Phalcon\\Db\\Dialect", 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, name) -#endif - ZEND_ARG_INFO(0, customFunction) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_releasesavepoint, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_releasesavepoint, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, name) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_rollbacksavepoint, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_rollbacksavepoint, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, name) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_select, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_select, 0, 1, IS_STRING, NULL, 0) -#endif - ZEND_ARG_ARRAY_INFO(0, definition, 0) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_sharedlock, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_sharedlock, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, sqlQuery, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, sqlQuery) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_supportsreleasesavepoints, 0, 0, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_supportsreleasesavepoints, 0, 0, _IS_BOOL, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_supportssavepoints, 0, 0, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_supportssavepoints, 0, 0, _IS_BOOL, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_tableexists, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_tableexists, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, tableName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, tableName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, schemaName) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_tableoptions, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_tableoptions, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, table) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schema, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, schema) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_viewexists, 0, 1, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_db_dialectinterface_viewexists, 0, 1, IS_STRING, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, viewName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, viewName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, schemaName, IS_STRING, 1) -#else - ZEND_ARG_INFO(0, schemaName) -#endif -ZEND_END_ARG_INFO() - -ZEPHIR_INIT_FUNCS(phalcon_db_dialectinterface_method_entry) { - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, addColumn, arginfo_phalcon_db_dialectinterface_addcolumn) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, addForeignKey, arginfo_phalcon_db_dialectinterface_addforeignkey) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, addIndex, arginfo_phalcon_db_dialectinterface_addindex) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, addPrimaryKey, arginfo_phalcon_db_dialectinterface_addprimarykey) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, createSavepoint, arginfo_phalcon_db_dialectinterface_createsavepoint) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, createTable, arginfo_phalcon_db_dialectinterface_createtable) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, createView, arginfo_phalcon_db_dialectinterface_createview) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, describeColumns, arginfo_phalcon_db_dialectinterface_describecolumns) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, describeIndexes, arginfo_phalcon_db_dialectinterface_describeindexes) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, describeReferences, arginfo_phalcon_db_dialectinterface_describereferences) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, dropColumn, arginfo_phalcon_db_dialectinterface_dropcolumn) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, dropForeignKey, arginfo_phalcon_db_dialectinterface_dropforeignkey) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, dropIndex, arginfo_phalcon_db_dialectinterface_dropindex) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, dropPrimaryKey, arginfo_phalcon_db_dialectinterface_dropprimarykey) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, dropTable, arginfo_phalcon_db_dialectinterface_droptable) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, dropView, arginfo_phalcon_db_dialectinterface_dropview) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, forUpdate, arginfo_phalcon_db_dialectinterface_forupdate) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, getColumnDefinition, arginfo_phalcon_db_dialectinterface_getcolumndefinition) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, getColumnList, arginfo_phalcon_db_dialectinterface_getcolumnlist) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, getCustomFunctions, arginfo_phalcon_db_dialectinterface_getcustomfunctions) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, getSqlExpression, arginfo_phalcon_db_dialectinterface_getsqlexpression) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, limit, arginfo_phalcon_db_dialectinterface_limit) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, listTables, arginfo_phalcon_db_dialectinterface_listtables) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, modifyColumn, arginfo_phalcon_db_dialectinterface_modifycolumn) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, registerCustomFunction, arginfo_phalcon_db_dialectinterface_registercustomfunction) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, releaseSavepoint, arginfo_phalcon_db_dialectinterface_releasesavepoint) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, rollbackSavepoint, arginfo_phalcon_db_dialectinterface_rollbacksavepoint) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, select, arginfo_phalcon_db_dialectinterface_select) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, sharedLock, arginfo_phalcon_db_dialectinterface_sharedlock) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, supportsReleaseSavepoints, arginfo_phalcon_db_dialectinterface_supportsreleasesavepoints) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, supportsSavepoints, arginfo_phalcon_db_dialectinterface_supportssavepoints) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, tableExists, arginfo_phalcon_db_dialectinterface_tableexists) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, tableOptions, arginfo_phalcon_db_dialectinterface_tableoptions) - PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, viewExists, arginfo_phalcon_db_dialectinterface_viewexists) - PHP_FE_END -}; diff --git a/phalcon/Db/Adapter/Pdo.zep b/phalcon/Db/Adapter/Pdo/AbstractPdo.zep similarity index 99% rename from phalcon/Db/Adapter/Pdo.zep rename to phalcon/Db/Adapter/Pdo/AbstractPdo.zep index 78817f2101f..668621fcb1d 100644 --- a/phalcon/Db/Adapter/Pdo.zep +++ b/phalcon/Db/Adapter/Pdo/AbstractPdo.zep @@ -8,7 +8,7 @@ * file that was distributed with this source code. */ -namespace Phalcon\Db\Adapter; +namespace Phalcon\Db\Adapter\Pdo; use Phalcon\Db\Adapter\AbstractAdapter; use Phalcon\Db\Column; @@ -35,7 +35,7 @@ use Phalcon\Events\ManagerInterface; * $connection = new Mysql($config); *``` */ -abstract class Pdo extends AbstractAdapter +abstract class AbstractPdo extends AbstractAdapter { /** * Last affected rows diff --git a/phalcon/Db/Adapter/Pdo/Mysql.zep b/phalcon/Db/Adapter/Pdo/Mysql.zep index 21bf9ba608f..ffecae8a9af 100644 --- a/phalcon/Db/Adapter/Pdo/Mysql.zep +++ b/phalcon/Db/Adapter/Pdo/Mysql.zep @@ -10,7 +10,7 @@ namespace Phalcon\Db\Adapter\Pdo; -use Phalcon\Db\Adapter\Pdo as PdoAdapter; +use Phalcon\Db\Adapter\Pdo\AbstractPdo as PdoAdapter; use Phalcon\Db\Column; use Phalcon\Db\ColumnInterface; use Phalcon\Db\Enum; diff --git a/phalcon/Db/Adapter/Pdo/Postgresql.zep b/phalcon/Db/Adapter/Pdo/Postgresql.zep index 6510ce48982..1eeb731a918 100644 --- a/phalcon/Db/Adapter/Pdo/Postgresql.zep +++ b/phalcon/Db/Adapter/Pdo/Postgresql.zep @@ -10,7 +10,7 @@ namespace Phalcon\Db\Adapter\Pdo; -use Phalcon\Db\Adapter\Pdo as PdoAdapter; +use Phalcon\Db\Adapter\Pdo\AbstractPdo as PdoAdapter; use Phalcon\Db\Column; use Phalcon\Db\ColumnInterface; use Phalcon\Db\Enum; diff --git a/phalcon/Db/Adapter/Pdo/Sqlite.zep b/phalcon/Db/Adapter/Pdo/Sqlite.zep index ff92fd7c56a..b00ac84748c 100644 --- a/phalcon/Db/Adapter/Pdo/Sqlite.zep +++ b/phalcon/Db/Adapter/Pdo/Sqlite.zep @@ -10,7 +10,7 @@ namespace Phalcon\Db\Adapter\Pdo; -use Phalcon\Db\Adapter\Pdo as PdoAdapter; +use Phalcon\Db\Adapter\Pdo\AbstractPdo as PdoAdapter; use Phalcon\Db\Column; use Phalcon\Db\ColumnInterface; use Phalcon\Db\Enum; diff --git a/phalcon/Db/Dialect.zep b/phalcon/Db/Dialect/AbstractDialect.zep similarity index 99% rename from phalcon/Db/Dialect.zep rename to phalcon/Db/Dialect/AbstractDialect.zep index 90a8470f554..b6579e10628 100644 --- a/phalcon/Db/Dialect.zep +++ b/phalcon/Db/Dialect/AbstractDialect.zep @@ -8,13 +8,16 @@ * file that was distributed with this source code. */ -namespace Phalcon\Db; +namespace Phalcon\Db\Dialect; + +use Phalcon\Db\ColumnInterface; +use Phalcon\Db\Exception; /** * This is the base class to each database dialect. This implements * common methods to transform intermediate code into its RDBMS related syntax */ -abstract class Dialect implements DialectInterface +abstract class AbstractDialect implements DialectInterface { protected escapeChar; diff --git a/phalcon/Db/DialectInterface.zep b/phalcon/Db/Dialect/DialectInterface.zep similarity index 99% rename from phalcon/Db/DialectInterface.zep rename to phalcon/Db/Dialect/DialectInterface.zep index 7a3f7c64932..f5b70c31ce8 100644 --- a/phalcon/Db/DialectInterface.zep +++ b/phalcon/Db/Dialect/DialectInterface.zep @@ -8,7 +8,7 @@ * file that was distributed with this source code. */ -namespace Phalcon\Db; +namespace Phalcon\Db\Dialect; use Phalcon\Db\ColumnInterface; use Phalcon\Db\ReferenceInterface; diff --git a/phalcon/Db/Dialect/Mysql.zep b/phalcon/Db/Dialect/Mysql.zep index ceb28a705f5..6bf5133c613 100644 --- a/phalcon/Db/Dialect/Mysql.zep +++ b/phalcon/Db/Dialect/Mysql.zep @@ -10,18 +10,18 @@ namespace Phalcon\Db\Dialect; -use Phalcon\Db\Dialect; use Phalcon\Db\Column; +use Phalcon\Db\ColumnInterface; +use Phalcon\Db\Dialect\AbstractDialect; +use Phalcon\Db\DialectInterface; use Phalcon\Db\Exception; use Phalcon\Db\IndexInterface; -use Phalcon\Db\ColumnInterface; use Phalcon\Db\ReferenceInterface; -use Phalcon\Db\DialectInterface; /** * Generates database specific SQL for the MySQL RDBMS */ -class Mysql extends Dialect +class Mysql extends AbstractDialect { /** * @var string diff --git a/phalcon/Db/Dialect/Postgresql.zep b/phalcon/Db/Dialect/Postgresql.zep index d636ff9cafd..21a6ff2b323 100644 --- a/phalcon/Db/Dialect/Postgresql.zep +++ b/phalcon/Db/Dialect/Postgresql.zep @@ -10,18 +10,18 @@ namespace Phalcon\Db\Dialect; -use Phalcon\Db\Dialect; use Phalcon\Db\Column; +use Phalcon\Db\ColumnInterface; +use Phalcon\Db\Dialect\AbstractDialect; +use Phalcon\Db\DialectInterface; use Phalcon\Db\Exception; use Phalcon\Db\IndexInterface; -use Phalcon\Db\ColumnInterface; use Phalcon\Db\ReferenceInterface; -use Phalcon\Db\DialectInterface; /** * Generates database specific SQL for the PostgreSQL RDBMS */ -class Postgresql extends Dialect +class Postgresql extends AbstractDialect { /** * @var string diff --git a/phalcon/Db/Dialect/Sqlite.zep b/phalcon/Db/Dialect/Sqlite.zep index 8793b47cc60..47b3ce24c88 100644 --- a/phalcon/Db/Dialect/Sqlite.zep +++ b/phalcon/Db/Dialect/Sqlite.zep @@ -11,17 +11,17 @@ namespace Phalcon\Db\Dialect; use Phalcon\Db\Column; +use Phalcon\Db\ColumnInterface; +use Phalcon\Db\Dialect\AbstractDialect; +use Phalcon\Db\DialectInterface; use Phalcon\Db\Exception; use Phalcon\Db\IndexInterface; -use Phalcon\Db\Dialect; -use Phalcon\Db\DialectInterface; -use Phalcon\Db\ColumnInterface; use Phalcon\Db\ReferenceInterface; /** * Generates database specific SQL for the SQLite RDBMS */ -class Sqlite extends Dialect +class Sqlite extends AbstractDialect { /** * @var string diff --git a/phalcon/Mvc/Model.zep b/phalcon/Mvc/Model.zep index 87eeeb43652..e5aec1dfec9 100644 --- a/phalcon/Mvc/Model.zep +++ b/phalcon/Mvc/Model.zep @@ -12,7 +12,7 @@ namespace Phalcon\Mvc; use JsonSerializable; use Phalcon\Db\Adapter\AdapterInterface; use Phalcon\Db\Column; -use Phalcon\Db\DialectInterface; +use Phalcon\Db\Dialect\DialectInterface; use Phalcon\Db\Enum; use Phalcon\Db\RawValue; use Phalcon\Di\InjectionAwareInterface;