本文整理汇总了C++中PHALCON_CONCAT_VSV函数的典型用法代码示例。如果您正苦于以下问题:C++ PHALCON_CONCAT_VSV函数的具体用法?C++ PHALCON_CONCAT_VSV怎么用?C++ PHALCON_CONCAT_VSV使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PHALCON_CONCAT_VSV函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Removes an access from a resource
*
* @param string $resourceName
* @param mixed $accessList
*/
PHP_METHOD(Phalcon_Acl_Adapter_Memory, dropResourceAccess){
zval *resource_name, *access_list, *access_name = NULL;
zval *access_key = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 2, 0, &resource_name, &access_list);
if (Z_TYPE_P(access_list) == IS_ARRAY) {
phalcon_is_iterable(access_list, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HVALUE(access_name);
PHALCON_INIT_NVAR(access_key);
PHALCON_CONCAT_VSV(access_key, resource_name, "!", access_name);
phalcon_unset_property_array(this_ptr, SL("_accessList"), access_key TSRMLS_CC);
zend_hash_move_forward_ex(ah0, &hp0);
}
} else {
PHALCON_INIT_NVAR(access_key);
PHALCON_CONCAT_VSV(access_key, resource_name, "!", access_name);
phalcon_unset_property_array(this_ptr, SL("_accessList"), access_key TSRMLS_CC);
}
PHALCON_MM_RESTORE();
}
示例2: PHP_METHOD
/**
* Generates SQL to drop a table
*
* @param string $tableName
* @param string $schemaName
* @param boolean $ifExists
* @return boolean
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropTable){
zval *table_name = NULL, *schema_name = NULL, *if_exists = NULL, *table = NULL;
zval *sql = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|z", &table_name, &schema_name, &if_exists) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!if_exists) {
PHALCON_ALLOC_ZVAL_MM(if_exists);
ZVAL_BOOL(if_exists, 1);
}
if (zend_is_true(schema_name)) {
PHALCON_INIT_VAR(table);
PHALCON_CONCAT_VSV(table, schema_name, ".", table_name);
} else {
PHALCON_CPY_WRT(table, table_name);
}
if (zend_is_true(if_exists)) {
PHALCON_INIT_VAR(sql);
PHALCON_CONCAT_SV(sql, "DROP TABLE IF EXISTS ", table);
} else {
PHALCON_INIT_VAR(sql);
PHALCON_CONCAT_SV(sql, "DROP TABLE ", table);
}
RETURN_CTOR(sql);
}
示例3: PHP_METHOD
/**
* Generates SQL to drop a view
*
* @param string $viewName
* @param string $schemaName
* @param boolean $ifExists
* @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropView){
zval *view_name, *schema_name, *if_exists = NULL, *view = NULL;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 2, 1, &view_name, &schema_name, &if_exists);
if (!if_exists) {
if_exists = &PHALCON_GLOBAL(z_true);
}
if (zend_is_true(schema_name)) {
PHALCON_INIT_VAR(view);
PHALCON_CONCAT_VSV(view, schema_name, "\".\"", view_name);
} else {
PHALCON_CPY_WRT(view, view_name);
}
if (zend_is_true(if_exists)) {
PHALCON_CONCAT_SVS(return_value, "DROP VIEW IF EXISTS \"", view, "\"");
} else {
PHALCON_CONCAT_SVS(return_value, "DROP VIEW \"", view, "\"");
}
PHALCON_MM_RESTORE();
}
示例4: PHP_METHOD
/**
* Generates SQL to drop a table
*
* @param string $tableName
* @param string $schemaName
* @param boolean $ifExists
* @return boolean
*/
PHP_METHOD(Phalcon_Db_Dialect_Oracle, dropTable){
zval *table_name, *schema_name, *if_exists = NULL, *table = NULL;
zval *sql = NULL;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 2, 1, &table_name, &schema_name, &if_exists);
if (!if_exists) {
PHALCON_INIT_VAR(if_exists);
ZVAL_BOOL(if_exists, 1);
}
if (zend_is_true(schema_name)) {
PHALCON_INIT_VAR(table);
PHALCON_CONCAT_VSV(table, schema_name, ".", table_name);
} else {
PHALCON_CPY_WRT(table, table_name);
}
if (zend_is_true(if_exists)) {
PHALCON_INIT_VAR(sql);
PHALCON_CONCAT_SV(sql, "DROP TABLE IF EXISTS ", table);
} else {
PHALCON_INIT_NVAR(sql);
PHALCON_CONCAT_SV(sql, "DROP TABLE ", table);
}
RETURN_CTOR(sql);
}
示例5: PHP_METHOD
/**
* Escapes a column/table/schema name
*
* @param string $identifier
* @return string
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, escapeIdentifier){
zval *identifier, *domain, *name;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &identifier);
if (Z_TYPE_P(identifier) == IS_ARRAY) {
PHALCON_OBS_VAR(domain);
phalcon_array_fetch_long(&domain, identifier, 0, PH_NOISY);
PHALCON_OBS_VAR(name);
phalcon_array_fetch_long(&name, identifier, 1, PH_NOISY);
if (PHALCON_GLOBAL(db).escape_identifiers) {
PHALCON_CONCAT_SVSVS(return_value, "`", domain, "`.`", name, "`");
RETURN_MM();
}
PHALCON_CONCAT_VSV(return_value, domain, ".", name);
RETURN_MM();
}
if (PHALCON_GLOBAL(db).escape_identifiers) {
PHALCON_CONCAT_SVS(return_value, "`", identifier, "`");
RETURN_MM();
}
RETURN_CCTOR(identifier);
}
示例6: PHP_METHOD
/**
* Sets the response content-type mime, optionally the charset
*
*<code>
* $response->setContentType('application/pdf');
* $response->setContentType('text/plain', 'UTF-8');
*</code>
*
* @param string $contentType
* @param string $charset
* @return Phalcon\Http\ResponseInterface
*/
PHP_METHOD(Phalcon_Http_Response, setContentType){
zval *content_type, *charset = NULL, *headers, *name, *header_value;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 1, &content_type, &charset);
if (!charset) {
PHALCON_INIT_VAR(charset);
}
PHALCON_INIT_VAR(headers);
phalcon_call_method(headers, this_ptr, "getheaders");
PHALCON_INIT_VAR(name);
ZVAL_STRING(name, "Content-Type", 1);
if (Z_TYPE_P(charset) == IS_NULL) {
phalcon_call_method_p2_noret(headers, "set", name, content_type);
} else {
PHALCON_INIT_VAR(header_value);
PHALCON_CONCAT_VSV(header_value, content_type, "; charset=", charset);
phalcon_call_method_p2_noret(headers, "set", name, header_value);
}
RETURN_THIS();
}
示例7: PHP_METHOD
/**
* Generates the SQL for LIMIT clause
*
* @param string $sqlQuery
* @param int $number
* @return string
*/
PHP_METHOD(Phalcon_Db_Dialect, limit){
zval *sql_query = NULL, *number = NULL, *is_numeric = NULL, *limit = NULL, *sql_limit = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &sql_query, &number) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_INIT_VAR(is_numeric);
PHALCON_CALL_FUNC_PARAMS_1(is_numeric, "is_numeric", number);
if (Z_TYPE_P(is_numeric) == IS_BOOL && Z_BVAL_P(is_numeric)) {
PHALCON_INIT_VAR(limit);
PHALCON_CALL_FUNC_PARAMS_1(limit, "intval", number);
PHALCON_INIT_VAR(sql_limit);
PHALCON_CONCAT_VSV(sql_limit, sql_query, " LIMIT ", limit);
RETURN_CTOR(sql_limit);
}
RETURN_CCTOR(sql_query);
}
示例8: PHP_METHOD
/**
* Sets the HTTP response code
*
*<code>
* $response->setStatusCode(404, "Not Found");
*</code>
*
* @param int $code
* @param string $message
* @return Phalcon\Http\ResponseInterface
*/
PHP_METHOD(Phalcon_Http_Response, setStatusCode){
zval *code, *message, *headers, *header_value, *status_value;
zval *status_header;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &code, &message) == FAILURE) {
RETURN_MM_NULL();
}
PHALCON_INIT_VAR(headers);
PHALCON_CALL_METHOD(headers, this_ptr, "getheaders");
/**
* We use HTTP/1.1 instead of HTTP/1.0
*/
PHALCON_INIT_VAR(header_value);
PHALCON_CONCAT_SVSV(header_value, "HTTP/1.1 ", code, " ", message);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(headers, "setraw", header_value);
/**
* We also define a 'Status' header with the HTTP status
*/
PHALCON_INIT_VAR(status_value);
PHALCON_CONCAT_VSV(status_value, code, " ", message);
PHALCON_INIT_VAR(status_header);
ZVAL_STRING(status_header, "Status", 1);
PHALCON_CALL_METHOD_PARAMS_2_NORETURN(headers, "set", status_header, status_value);
phalcon_update_property_zval(this_ptr, SL("_headers"), headers TSRMLS_CC);
RETURN_THIS();
}
示例9: PHP_METHOD
/**
* Generates SQL to drop a table
*
* @param string $tableName
* @param string $schemaName
* @param boolean $ifExists
* @return boolean
*/
PHP_METHOD(Phalcon_Db_Dialect_Oracle, dropTable){
zval *table_name, *schema_name, *if_exists = NULL, *table = NULL;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 2, 1, &table_name, &schema_name, &if_exists);
if (!if_exists) {
if_exists = PHALCON_GLOBAL(z_true);
}
if (zend_is_true(schema_name)) {
PHALCON_INIT_VAR(table);
PHALCON_CONCAT_VSV(table, schema_name, ".", table_name);
} else {
PHALCON_CPY_WRT(table, table_name);
}
if (zend_is_true(if_exists)) {
PHALCON_CONCAT_SV(return_value, "DROP TABLE IF EXISTS ", table);
} else {
PHALCON_CONCAT_SV(return_value, "DROP TABLE ", table);
}
PHALCON_MM_RESTORE();
}
示例10: PHP_METHOD
/**
* Generates the SQL for a MySQL LIMIT clause
*
* @param string $sqlQuery
* @param int $number
* @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Mysql, limit){
zval *sql_query = NULL, *number = NULL, *limit = NULL;
zval *r0 = NULL, *r1 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &sql_query, &number) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_CALL_FUNC_PARAMS_1(r0, "is_numeric", number);
if (zend_is_true(r0)) {
PHALCON_INIT_VAR(limit);
PHALCON_CALL_FUNC_PARAMS_1(limit, "intval", number);
PHALCON_ALLOC_ZVAL_MM(r1);
PHALCON_CONCAT_VSV(r1, sql_query, " LIMIT ", limit);
RETURN_CTOR(r1);
} else {
RETURN_CCTOR(sql_query);
}
PHALCON_MM_RESTORE();
}
示例11: PHP_METHOD
/**
* Sends the headers to the client
*
* @return boolean
*/
PHP_METHOD(Phalcon_Http_Response_Headers, send){
zval *headers_was_sent, *t, *headers, *value = NULL, *header = NULL;
zval *http_header = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
char *hash_index;
uint hash_index_len;
ulong hash_num;
int hash_type;
PHALCON_MM_GROW();
PHALCON_INIT_VAR(headers_was_sent);
PHALCON_CALL_FUNC(headers_was_sent, "headers_sent");
if (!zend_is_true(headers_was_sent)) {
PHALCON_INIT_VAR(t);
ZVAL_BOOL(t, 1);
PHALCON_INIT_VAR(headers);
phalcon_read_property(&headers, this_ptr, SL("_headers"), PH_NOISY_CC);
if (!phalcon_valid_foreach(headers TSRMLS_CC)) {
return;
}
ah0 = Z_ARRVAL_P(headers);
zend_hash_internal_pointer_reset_ex(ah0, &hp0);
ph_cycle_start_0:
if (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS) {
goto ph_cycle_end_0;
}
PHALCON_GET_FOREACH_KEY(header, ah0, hp0);
PHALCON_GET_FOREACH_VALUE(value);
if (zend_is_true(value)) {
PHALCON_INIT_NVAR(http_header);
PHALCON_CONCAT_VSV(http_header, header, ": ", value);
PHALCON_CALL_FUNC_PARAMS_2_NORETURN("header", http_header, t);
} else {
PHALCON_CALL_FUNC_PARAMS_2_NORETURN("header", header, t);
}
zend_hash_move_forward_ex(ah0, &hp0);
goto ph_cycle_start_0;
ph_cycle_end_0:
PHALCON_MM_RESTORE();
RETURN_TRUE;
}
PHALCON_MM_RESTORE();
RETURN_FALSE;
}
示例12: PHP_METHOD
/**
* Sends the headers to the client
*
* @return boolean
*/
PHP_METHOD(Phalcon_Http_Response_Headers, send){
zval *headers, *value = NULL, *header = NULL;
zval *http_header = NULL;
zval copy;
int use_copy;
HashTable *ah0;
HashPosition hp0;
zval **hd;
sapi_header_line ctr = { NULL, 0, 0 };
PHALCON_MM_GROW();
if (!SG(headers_sent)) {
PHALCON_OBS_VAR(headers);
phalcon_read_property_this(&headers, this_ptr, SL("_headers"), PH_NOISY_CC);
phalcon_is_iterable(headers, &ah0, &hp0, 0, 0);
while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
PHALCON_GET_HKEY(header, ah0, hp0);
PHALCON_GET_HVALUE(value);
if (PHALCON_IS_NOT_EMPTY(value)) {
PHALCON_INIT_NVAR(http_header);
PHALCON_CONCAT_VSV(http_header, header, ": ", value);
ctr.line = Z_STRVAL_P(http_header);
ctr.line_len = Z_STRLEN_P(http_header);
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
} else {
zend_make_printable_zval(header, ©, &use_copy);
if (unlikely(use_copy)) {
header = ©
}
ctr.line = Z_STRVAL_P(header);
ctr.line_len = Z_STRLEN_P(header);
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
if (unlikely(use_copy)) {
zval_dtor(©);
}
}
zend_hash_move_forward_ex(ah0, &hp0);
}
RETURN_MM_TRUE;
}
RETURN_MM_FALSE;
}
示例13: PHP_METHOD
/**
* Returns uri
*
* @return string
*/
PHP_METHOD(Phalcon_Http_Uri, build){
zval *parts, *uri, *scheme, *host, *user, *pass, *port, *path, *query, *fragment, *tmp = NULL;
PHALCON_MM_GROW();
parts = phalcon_read_property(getThis(), SL("_parts"), PH_NOISY);
PHALCON_INIT_VAR(uri);
if (phalcon_array_isset_str_fetch(&scheme, parts, SL("scheme")) && PHALCON_IS_NOT_EMPTY(scheme)) {
if (phalcon_array_isset_str_fetch(&host, parts, SL("host")) && PHALCON_IS_NOT_EMPTY(host)) {
if (phalcon_array_isset_str_fetch(&user, parts, SL("user")) && PHALCON_IS_NOT_EMPTY(user)) {
if (phalcon_array_isset_str_fetch(&pass, parts, SL("pass")) && PHALCON_IS_NOT_EMPTY(pass)) {
PHALCON_CONCAT_VSVSVSV(uri, scheme, "://", user, ":", pass, "@", host);
} else {
PHALCON_CONCAT_VSVSV(uri, scheme, "://", user, "@", host);
}
} else {
PHALCON_CONCAT_VSV(uri, scheme, "://", host);
}
} else {
PHALCON_CONCAT_VS(uri, scheme, ":");
}
}
if (phalcon_array_isset_str_fetch(&port, parts, SL("port")) && PHALCON_IS_NOT_EMPTY(port)) {
PHALCON_SCONCAT_SV(uri, ":", port);
}
if (phalcon_array_isset_str_fetch(&path, parts, SL("path")) && PHALCON_IS_NOT_EMPTY(path)) {
if (!phalcon_start_with_str(path, SL("/"))) {
PHALCON_SCONCAT_SV(uri, "/", path);
} else {
PHALCON_INIT_NVAR(tmp);
PHALCON_CONCAT_VV(tmp, uri, path);
PHALCON_CPY_WRT(uri, tmp);
}
}
if (phalcon_array_isset_str_fetch(&query, parts, SL("query")) && PHALCON_IS_NOT_EMPTY(query)) {
PHALCON_INIT_NVAR(tmp);
phalcon_http_build_query(tmp, query, "&");
PHALCON_SCONCAT_SV(uri, "?", tmp);
}
if (phalcon_array_isset_str_fetch(&fragment, parts, SL("fragment")) && PHALCON_IS_NOT_EMPTY(fragment)) {
PHALCON_SCONCAT_SV(uri, "#", fragment);
}
RETURN_CTOR(uri);
}
示例14: PHP_METHOD
/**
* Generates the SQL for LIMIT clause
*
*<code>
* $sql = $dialect->limit('SELECT * FROM robots', 10);
* echo $sql; // SELECT * FROM robots LIMIT 10
*</code>
*
* @param string $sqlQuery
* @param int $number
* @return string
*/
PHP_METHOD(Phalcon_Db_Dialect, limit){
zval *sql_query, *number, limit = {};
phalcon_fetch_params(0, 2, 0, &sql_query, &number);
if (phalcon_is_numeric(number)) {
ZVAL_LONG(&limit, phalcon_get_intval(number));
PHALCON_CONCAT_VSV(return_value, sql_query, " LIMIT ", &limit);
return;
}
RETURN_CTORW(sql_query);
}
示例15: PHP_METHOD
/**
* Generates the SQL for LIMIT clause
*
*<code>
* $sql = $dialect->limit('SELECT * FROM robots', 10);
* echo $sql; // SELECT * FROM robots LIMIT 10
*</code>
*
* @param string $sqlQuery
* @param int $number
* @return string
*/
PHP_METHOD(Phalcon_Db_Dialect, limit){
zval *sql_query, *number, *limit;
phalcon_fetch_params(1, 2, 0, &sql_query, &number);
if (phalcon_is_numeric(number)) {
PHALCON_MM_GROW();
PHALCON_INIT_VAR(limit);
ZVAL_LONG(limit, phalcon_get_intval(number));
PHALCON_CONCAT_VSV(return_value, sql_query, " LIMIT ", limit);
RETURN_MM();
}
RETURN_ZVAL(sql_query, 1, 0);
}