Skip to content

Commit

Permalink
Merge pull request #66 from mjrider/mysqlworkspaces-find-fix
Browse files Browse the repository at this point in the history
Mysqlworkspaces store find result fix
  • Loading branch information
mjrider committed Sep 18, 2015
2 parents 56f1ef2 + 94640fe commit 30f355b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/stores/modules/mysql_workspaces_compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ protected function priv_sql_compile($tree) {
}

$select_query = "select distinct($nodes.path), $nodes.id as nodeId, $nodes.layer as nodeLayer, $nodes.parent, $nodes.priority, ";
$select_query .= " $objects.object, $objects.id, $objects.type, $objects.vtype ";
$select_query .= " from $tables $join $query ";
$select_query .= "$objects.object, $objects.id, $objects.type, $objects.vtype, ";
$select_query .= "UNIX_TIMESTAMP($objects.lastchanged) as lastchanged ";
$select_query .= "from ($tables) $join $query ";
$select_query .= $orderby." ".$this->limit_s;

$count_query = "select count(distinct($objects.id)) as count from $tables ".$query;
Expand Down
15 changes: 14 additions & 1 deletion tests/unit/store/MysqlStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static function setUpBeforeClass()
protected function setUp()
{
global $store_config;
if( $store_config["dbms"] !== 'mysql' ) {
if( strpos($store_config["dbms"],'mysql') !== 0 ){
$this->marktestskipped(
'Skipping mysql tests, current config uses: '.$store_config["dbms"]
);
Expand All @@ -25,5 +25,18 @@ public function test_format_for_fti(){
$res = $store->format_for_fti('abcü_-');
$this->assertEquals($prep,$res);
}

public function test(){
global $store;
$res = $store->find('/','object.id = 1');
$row = $res['list']->fetch_array(MYSQLI_ASSOC);
$this->assertArrayHasKey('id', $row);
$this->assertArrayHasKey('path', $row);
$this->assertArrayHasKey('parent', $row);
$this->assertArrayHasKey('lastchanged', $row);
$this->assertArrayHasKey('priority', $row);
$this->assertArrayHasKey('type', $row);
$this->assertArrayHasKey('vtype', $row);
}
}
?>

0 comments on commit 30f355b

Please sign in to comment.