mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 11:44:10 +09:00
Fixed insert bug - nextSequnce was not properly retrieved.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8608 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
0c63c32b10
commit
98a85cdaa9
5 changed files with 49 additions and 19 deletions
|
|
@ -3,19 +3,25 @@
|
|||
class DefaultValue {
|
||||
var $column_name;
|
||||
var $value;
|
||||
|
||||
var $is_sequence = false;
|
||||
|
||||
function DefaultValue($column_name, $value){
|
||||
$this->column_name = $column_name;
|
||||
$this->value = $value;
|
||||
$this->value = $this->_setValue();
|
||||
}
|
||||
|
||||
function isString(){
|
||||
$str_pos = strpos($this->value, '(');
|
||||
if($str_pos===false) return true;
|
||||
return false;
|
||||
if($str_pos===false) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function toString(){
|
||||
function isSequence(){
|
||||
return $this->is_sequence;
|
||||
}
|
||||
|
||||
function _setValue(){
|
||||
if(!isset($this->value)) return;
|
||||
|
||||
// If value contains comma separated values and does not contain paranthesis
|
||||
|
|
@ -24,13 +30,13 @@
|
|||
return sprintf('array(%s)', $this->value);
|
||||
}
|
||||
|
||||
$str_pos = strpos($this->value, '(');
|
||||
// // TODO Replace this with parseExpression
|
||||
if($str_pos===false) return '\''.$this->value.'\'';
|
||||
//if($str_pos===false) return $this->value;
|
||||
|
||||
$func_name = substr($this->value, 0, $str_pos);
|
||||
$args = substr($this->value, $str_pos+1, strlen($value)-1);
|
||||
$str_pos = strpos($this->value, '(');
|
||||
// // TODO Replace this with parseExpression
|
||||
if($str_pos===false) return '\''.$this->value.'\'';
|
||||
//if($str_pos===false) return $this->value;
|
||||
|
||||
$func_name = substr($this->value, 0, $str_pos);
|
||||
$args = substr($this->value, $str_pos+1, strlen($value)-1);
|
||||
|
||||
switch($func_name) {
|
||||
case 'ipaddress' :
|
||||
|
|
@ -43,7 +49,8 @@
|
|||
$val = 'date("YmdHis")';
|
||||
break;
|
||||
case 'sequence' :
|
||||
$val = '$this->getNextSequence()';
|
||||
$this->is_sequence = true;
|
||||
$val = '$sequence';
|
||||
break;
|
||||
case 'plus' :
|
||||
$args = abs($args);
|
||||
|
|
@ -63,7 +70,11 @@
|
|||
//$val = $this->value;
|
||||
}
|
||||
|
||||
return $val;
|
||||
return $val;
|
||||
}
|
||||
|
||||
function toString(){
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
$validator = '';
|
||||
if(isset($this->default_value)){
|
||||
$this->default_value = new DefaultValue($this->argument_name, $this->default_value);
|
||||
if($this->default_value->isSequence())
|
||||
$validator .= '$db = &DB::getInstance(); $sequence = $db->getNextSequence(); ';
|
||||
$validator .= sprintf("$%s_argument->ensureDefaultValue(%s);\n"
|
||||
, $this->argument_name
|
||||
, $this->default_value->toString()
|
||||
|
|
|
|||
|
|
@ -24,7 +24,15 @@
|
|||
$db_info->db_database = 'xe15QA';
|
||||
$db_info->db_table_prefix = 'xe';
|
||||
|
||||
$oContext->setDbInfo($db_info);
|
||||
$oContext->setDbInfo($db_info);
|
||||
|
||||
// remove cache dir
|
||||
$tmp_cache_list = FileHandler::readDir('./files','/(^cache_[0-9]+)/');
|
||||
if($tmp_cache_list){
|
||||
foreach($tmp_cache_list as $tmp_dir){
|
||||
if($tmp_dir) FileHandler::removeDir('./files/'.$tmp_dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -48,22 +48,31 @@
|
|||
$args->lang_code;
|
||||
$output = executeQuery('document.insertDocument', $args);
|
||||
|
||||
$this->assertNotEquals(-225, $args->error);
|
||||
$this->assertNotEquals(-225, $output->error);
|
||||
$this->assertNotEquals('Missing value for attribute "homepage" with the NOT NULL constraint.', $output->message);
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
|
||||
|
||||
function test_communication_addFriendGroup(){
|
||||
$args->member_srl = 202;
|
||||
$args->title = "Grup";
|
||||
|
||||
$output = executeQuery("communication.addFriendGroup", $args);
|
||||
$this->assertEquals(0, $output->error, $output->message);
|
||||
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
$db = &DB::getInstance();
|
||||
$db->_query("DELETE FROM xe_modules WHERE module_srl = 47374");
|
||||
$db->_query("DELETE FROM xe_documents WHERE document_srl = 9200");
|
||||
$db->_query("DELETE FROM xe_member_friend_group WHERE member_srl = 202");
|
||||
$db->close();
|
||||
|
||||
parent::tearDown();
|
||||
// TODO Delete inserted value
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -123,6 +123,6 @@
|
|||
VALUES (202, \'_filter\', \'insert_page\')
|
||||
';
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue