diff --git a/classes/xml/xmlquery/tags/column/UpdateColumnTag.class.php b/classes/xml/xmlquery/tags/column/UpdateColumnTag.class.php index f9ff54146..2152007f6 100644 --- a/classes/xml/xmlquery/tags/column/UpdateColumnTag.class.php +++ b/classes/xml/xmlquery/tags/column/UpdateColumnTag.class.php @@ -19,8 +19,12 @@ $this->name = $dbParser->parseColumnName($this->name); if($column->attrs->var) $this->argument = new QueryArgument($column); - else - $this->default_value = $dbParser->parseColumnName($column->attrs->default); + else { + $default_value = new DefaultValue($this->name, $column->attrs->default); + if($default_value->isOperation()) + $this->argument = new QueryArgument($column); + else $this->default_value = $dbParser->parseColumnName($column->attrs->default); + } } function getExpressionString(){ diff --git a/test-phpUnit/db/xml_query/cubrid/CubridUpdateTest.php b/test-phpUnit/db/xml_query/cubrid/CubridUpdateTest.php index bcbdb2216..1d475961d 100644 --- a/test-phpUnit/db/xml_query/cubrid/CubridUpdateTest.php +++ b/test-phpUnit/db/xml_query/cubrid/CubridUpdateTest.php @@ -18,18 +18,32 @@ $args->use_mobile = ""; $args->site_srl = 0; $args->module_srl = 47374;'; - $expected = 'UPDATE "xe_modules" as "modules" - SET "module" = \'page\' - , "mid" = \'test\' - , "browser_title" = \'test\' - , "description" = \'\' - , "is_default" = \'N\' - , "open_rss" = \'Y\' - , "header_text" = \'\' - , "footer_text" = \'\' - , "use_mobile" = \'n\' - WHERE "site_srl" = 0 - AND "module_srl" = 47374'; + $expected = 'update "xe_modules" as "modules" + set "module" = \'page\' + , "module_category_srl" = 0 + , "layout_srl" = 0 + , "mid" = \'test\' + , "browser_title" = \'test\' + , "description" = \'\' + , "is_default" = \'n\' + , "open_rss" = \'y\' + , "header_text" = \'\' + , "footer_text" = \'\' + , "mlayout_srl" = 0 + , "use_mobile" = \'n\' + where "site_srl" = 0 and "module_srl" = 47374'; +// $expected = 'UPDATE "xe_modules" as "modules" +// SET "module" = \'page\' +// , "mid" = \'test\' +// , "browser_title" = \'test\' +// , "description" = \'\' +// , "is_default" = \'N\' +// , "open_rss" = \'Y\' +// , "header_text" = \'\' +// , "footer_text" = \'\' +// , "use_mobile" = \'n\' +// WHERE "site_srl" = 0 +// AND "module_srl" = 47374'; $this->_test($xml_file, $argsString, $expected); } function test_member_updateLastLogin(){ @@ -52,7 +66,7 @@ $xml_file = _XE_PATH_ . "modules/counter/queries/updateCounterUnique.xml"; $argsString = '$args->regdate = 20110607; '; - $expected = 'UPDATE "xe_counter_status" SET "unique_visitor" = "unique_visitor" + 1, + $expected = 'UPDATE "xe_counter_status" as "counter_status" SET "unique_visitor" = "unique_visitor" + 1, "pageview" = "pageview" + 1 WHERE "regdate" = 20110607 '; $this->_test($xml_file, $argsString, $expected); } diff --git a/test-phpUnit/db/xml_query/mssql/MssqlUpdateTest.php b/test-phpUnit/db/xml_query/mssql/MssqlUpdateTest.php index 1f2b183a0..9f5b81aa4 100644 --- a/test-phpUnit/db/xml_query/mssql/MssqlUpdateTest.php +++ b/test-phpUnit/db/xml_query/mssql/MssqlUpdateTest.php @@ -10,7 +10,7 @@ function test_counter_updateCounterUnique(){ $xml_file = _XE_PATH_ . "modules/counter/queries/updateCounterUnique.xml"; $argsString = '$args->regdate = 25;'; - $expected = 'UPDATE [xe_counter_status] SET [unique_visitor] = [unique_visitor] + ?, [pageview] = [pageview] + ? WHERE [regdate] = ?'; + $expected = 'UPDATE [xe_counter_status] as [counter_status] SET [unique_visitor] = [unique_visitor] + ?, [pageview] = [pageview] + ? WHERE [regdate] = ?'; $this->_test($xml_file, $argsString, $expected, array("25", 1, 1)); } } diff --git a/test-phpUnit/db/xml_query/mysql/MysqlUpdateTest.php b/test-phpUnit/db/xml_query/mysql/MysqlUpdateTest.php index 406a11194..02b5d3447 100644 --- a/test-phpUnit/db/xml_query/mysql/MysqlUpdateTest.php +++ b/test-phpUnit/db/xml_query/mysql/MysqlUpdateTest.php @@ -30,5 +30,17 @@ $this->_test($xml_file, $argsString, $expected); } + function test_document_updateItemDownloadedCount(){ + $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/document.updateItemDownloadedCount.xml"; + $argsString = '$args->module_srl = 10; $args->package_srl = 11; $args->item_srl = 12;'; + $expected = 'update `xe_resource_items` as `resource_items` + set `downloaded` = `downloaded` + 1 + where `module_srl` = 10 + and `package_srl` = 11 + and `item_srl` = 12 + '; + $this->_test($xml_file, $argsString, $expected); + } + } \ No newline at end of file diff --git a/test-phpUnit/db/xml_query/mysql/data/document.updateItemDownloadedCount.xml b/test-phpUnit/db/xml_query/mysql/data/document.updateItemDownloadedCount.xml new file mode 100644 index 000000000..bebb488a1 --- /dev/null +++ b/test-phpUnit/db/xml_query/mysql/data/document.updateItemDownloadedCount.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + +