Skip to content

Commit

Permalink
Replace boolean with integer in queries
Browse files Browse the repository at this point in the history
Better sqlite compatibility
  • Loading branch information
annda committed Sep 28, 2022
1 parent 659863b commit 0062407
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion _test/AccessTableDataReplacement.test.php
Expand Up @@ -187,7 +187,7 @@ public function test_DataFiltersAsSubQuery($inputFilterLines, $expectedFilterWhe
)
AND (
(IS_PUBLISHER(data_bar.pid) AND data_bar.latest = 1)
OR (IS_PUBLISHER(data_bar.pid) IS FALSE AND data_bar.published = 1)
OR (IS_PUBLISHER(data_bar.pid) !=1 AND data_bar.published = 1)
)";

$expected_where = $baseWhere . $expectedFilterWhere . " )";
Expand Down
2 changes: 1 addition & 1 deletion _test/mock/helper_plugin_struct_db.php
Expand Up @@ -6,6 +6,6 @@ class helper_plugin_struct_db extends \helper_plugin_struct_db {

public function IS_PUBLISHER() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
{
return false;
return 0;
}
}
4 changes: 2 additions & 2 deletions helper/db.php
Expand Up @@ -121,11 +121,11 @@ public function STRUCT_JSON() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.N
/**
* This dummy implementation can be overwritten by a plugin
*
* @return bool
* @return int
*/
public function IS_PUBLISHER() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
{
return true;
return 1;
}
}

Expand Down
2 changes: 1 addition & 1 deletion meta/Search.php
Expand Up @@ -476,7 +476,7 @@ public function getSQL()
$first_table = $datatable;
}
// phpcs:ignore
$QB->filters()->whereAnd("( (IS_PUBLISHER($datatable.pid) AND $datatable.latest = 1) OR (IS_PUBLISHER($datatable.pid) IS FALSE AND $datatable.published = 1) )");
$QB->filters()->whereAnd("( (IS_PUBLISHER($datatable.pid) AND $datatable.latest = 1) OR (IS_PUBLISHER($datatable.pid) !=1 AND $datatable.published = 1) )");
}

// columns to select, handling multis
Expand Down
2 changes: 1 addition & 1 deletion plugin.info.txt
@@ -1,7 +1,7 @@
base struct
author Andreas Gohr, Michael Große, Anna Dabrowska
email dokuwiki@cosmocode.de
date 2022-09-27
date 2022-09-28
name struct plugin
desc Add and query additional structured page data
url https://www.dokuwiki.org/plugin:struct

0 comments on commit 0062407

Please sign in to comment.