mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-30 08:39:58 +09:00
Issue 359 - Secret documents's status changed to public.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9498 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
c0da2956cb
commit
8cf88300db
3 changed files with 33 additions and 2 deletions
|
|
@ -67,7 +67,7 @@
|
||||||
return $dbParser->parseExpression($value);
|
return $dbParser->parseExpression($value);
|
||||||
}
|
}
|
||||||
if(!isset($value)) return null;
|
if(!isset($value)) return null;
|
||||||
if(in_array($this->type, array('date', 'varchar', 'char','text', 'bigtext'))){
|
if(in_array($this->getType(), array('date', 'varchar', 'char','text', 'bigtext'))){
|
||||||
if(!is_array($value))
|
if(!is_array($value))
|
||||||
$value = $this->_escapeStringValue ($value);
|
$value = $this->_escapeStringValue ($value);
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,19 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since ConditionArgument is used in WHERE clause,
|
||||||
|
* where the argument value is compared to a table column,
|
||||||
|
* it is assumed that all arguments have type. There are cases though
|
||||||
|
* where the column does not have any type - if it was removed from
|
||||||
|
* the XML schema for example - see the is_secret column in xe_documents table.
|
||||||
|
* In this case, the column type is retrieved according to argument
|
||||||
|
* value type (using the PHP function is_numeric).
|
||||||
|
*
|
||||||
|
* @return type string
|
||||||
|
*/
|
||||||
function getType(){
|
function getType(){
|
||||||
return $this->type;
|
return $this->type ? $this->type : (!is_numeric($this->value) ? "varchar" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
function setColumnType($column_type){
|
function setColumnType($column_type){
|
||||||
|
|
|
||||||
20
test-phpUnit/db/xml_query/mysql/MysqlUpdateTest.php
Normal file
20
test-phpUnit/db/xml_query/mysql/MysqlUpdateTest.php
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
require(_XE_PATH_ . 'test-phpUnit/config/config.inc.php');
|
||||||
|
|
||||||
|
class MysqlUpdateTest extends MysqlTest {
|
||||||
|
|
||||||
|
function _test($xml_file, $argsString, $expected, $columnList = null){
|
||||||
|
$this->_testQuery($xml_file, $argsString, $expected, 'getUpdateSql', $columnList);
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_document_updateDocumentStatus(){
|
||||||
|
$xml_file = _XE_PATH_ . "modules/document/queries/updateDocumentStatus.xml";
|
||||||
|
$argsString = '$args->is_secret = \'Y\';
|
||||||
|
$args->status = \'SECRET\';
|
||||||
|
';
|
||||||
|
$expected = 'update `xe_documents` set `status` = \'secret\' where `is_secret` = \'y\'';
|
||||||
|
$this->_test($xml_file, $argsString, $expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue