merge from branch 1.5.3.1 (r11063-r11081)

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.3.2@11096 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2012-08-27 07:02:59 +00:00
commit 90dbcd491a
4 changed files with 80 additions and 1 deletions

View file

@ -57,6 +57,7 @@
// If default value is column name, it should be escaped
if($isColumnName = (strpos($condition->attrs->default, '.') !== false
&& strpos($condition->attrs->default, '.') !== 0
&& strpos($condition->attrs->default, '%') === false ))
{
$condition->attrs->default = $dbParser->parseExpression($condition->attrs->default);

View file

@ -37,7 +37,7 @@
}
// Get terms of user
$config->agreement = self::_getAgreement();
$config->agreement = memberModel::_getAgreement();
if(!$config->webmaster_name) $config->webmaster_name = 'webmaster';
if(!$config->image_name_max_width) $config->image_name_max_width = 90;

View file

@ -357,4 +357,27 @@ class MysqlSelectTest extends MysqlTest {
) AS `A`';
$this->_test($xml_file, $argsString, $expected);
}
/**
* Like with image extension
*/
function testLikeImageExtension()
{
$xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/like_image_extension.xml";
$argsString = '';
$expected = "select `files`.`upload_target_srl` as `document_srl`
from `xe_files` as `files`
, `xe_documents` as `documents`
where (
`files`.`upload_target_srl` = `documents`.`document_srl`
and (`files`.`source_filename` like '%.jpg'
or `files`.`source_filename` like '%.gif'
or `files`.`source_filename` like '%.png'))
and `documents`.`list_order` <= 2100000000
group by `files`.`upload_target_srl`
order by `documents`.`list_order` asc
limit 5";
$this->_test($xml_file, $argsString, $expected);
}
}

View file

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<query id="getImages" action="select">
<tables>
<table name="files" alias="files"/>
<table name="documents" alias="documents"/>
</tables>
<columns>
<column name="files.upload_target_srl" alias="document_srl"/>
</columns>
<conditions>
<condition operation="in" column="files.module_srl" var="module_srls" filter="number" />
<condition operation="equal" column="files.direct_download" var="direct_download" pipe="and" />
<condition operation="equal" column="files.isvalid" var="isvalid" pipe="and" />
<condition operation="equal" column="files.upload_target_srl" var="documents.document_srl" pipe="and" />
<group pipe="and">
<condition operation="like_tail" column="files.source_filename" var="s_filename1" default=".jpg" pipe="or" />
<condition operation="like_tail" column="files.source_filename" var="s_filename2" default=".gif" pipe="or" />
<condition operation="like_tail" column="files.source_filename" var="s_filename3" default=".png" pipe="or" />
</group>
</conditions>
<groups>
<group column="files.upload_target_srl" />
</groups>
<navigation>
<index var="list_order" default="documents.list_order" order="asc" />
<list_count var="list_count" default="5" />
</navigation>
</query>