Commit Graph

374 Commits

Author SHA1 Message Date
Johannes Meyer 947aa91c48 DbQuery: Don't call `timestampForSql()` in `valueToTimestamp()`
We can't call it implicitly, not all filter columns support
date time strings, especially in postgresql..
2022-07-05 09:55:32 +02:00
Johannes Meyer 95ea071a89 DbQuery: Accept any type in method `valueToTimestamp()` 2022-06-30 08:37:14 +02:00
Johannes Meyer 46a21d9709 Drop method `DbQuery::whereToSql()`
It's been used by `DbQuery::renderFilter()` rather
exclusively. So if removing one, both need to go.
2022-06-14 14:24:30 +02:00
Sukhwinder Dhillon 846a90301d DbQuery: Replace deprecated method `renderFilter()` and remove it 2022-06-14 14:24:30 +02:00
Sukhwinder Dhillon b47298fffe SimpleQuery: Remove deprecated method `paginate()` 2022-06-14 14:24:30 +02:00
Sukhwinder Dhillon aded6a055e DbConnection: Remove deprecated method `getConnection()` 2022-06-14 14:24:30 +02:00
Johannes Meyer d663fe84c3 DbConnection: Fix that unequal is handled as equal...
refs #4814
2022-06-13 15:05:24 +02:00
Johannes Meyer 1bee2db583 DbConnection: Only ignore the `*` for equal/unequal conditions
fixes #4813
2022-06-13 14:38:51 +02:00
Johannes Meyer 644d5eaba7 DbConnection: Ensure compat with PHP 8.1 in `renderFilterExpression` 2022-05-13 16:54:19 +02:00
Johannes Meyer 03e7041ccb DbConnection: Support wildcards in arrays in `renderFilterExpression` 2022-05-13 16:54:19 +02:00
raviks789 8898ed85ab Change FilterMatch to FilterEqual class for single object filter on object name.
Correspondingly the DbConnection::renderFilter() (as DbQuery::renderFilter() is deprecated and will be removed, hence no modifications here)
is also modified to render accordingly.
This correctly selects the host, service or contact in case the object name contains wild card characters like "\*".
2022-05-12 16:28:35 +02:00
raviks789 199ea6f965 Prevent use of empty filters in FilterChain::toQueryString()
Due to instantiation of filters using Filter::matchAll() in ObjectList::getFilter(), we get an empty FilterAnd instance when
$this->filter is null. This prepends unnecessary separator '&' to the query string during conversion of filter to querystring.
This breaks the state badge links for host and service lists.
2022-04-29 10:38:26 +02:00
Alexander Aleksandrovič Klimov 2fcee6a073 ConfigObject#get(): reduce code complexity
and save a few CPU cycles.
2022-04-11 13:31:16 +02:00
Johannes Meyer 9225462262 Fix that false values in dropdowns get ignored
plus some more fixes in the same area
2022-04-06 16:34:34 +02:00
Thomas Gelf 83567ebad2 Avoid passing `null` to non-nullable arguments 2022-03-24 12:29:06 +01:00
Johannes Meyer 3dc384fb58 Avoid passing `null` to non-nullable arguments 2022-03-24 12:29:06 +01:00
Johannes Meyer c038e84fc2 Ensure Return Type Compatibility with Internal Classes 2022-03-24 12:29:06 +01:00
Johannes Meyer f16a54242a DbQuery: Account for daylight savings in `timestampForSql()`
fixes #4568
2022-02-10 16:48:36 +01:00
Ravi Kumar Kempapura Srinivasa bbd36d5f83 Check if the column in the row is set for filters
When the column is not set for the filters undefined property exception is thrown in icinga-director. This is a quick fix to solve the issue.
2021-08-24 09:34:26 +02:00
Johannes Meyer 384d9535a9 ArrayDatasource: Sort result first and then apply limit+offset 2021-04-12 15:42:20 +02:00
Johannes Meyer 0fc06d7795 Transform `*` equal/unequal comparisons to NULL checks
This comes from https://github.com/Icinga/ipl-sql/pull/31
2021-03-12 09:50:59 +01:00
Johannes Meyer b288d86e91 DbQuery: Return non-string args as is in `valueToTimestamp()`
fixes #4182
2020-06-24 14:09:13 +02:00
Johannes Meyer 3a66b0a950 FilterExpression: Pass used delimiter to `preg_quote`
fixes #4090
2020-03-02 08:39:46 +01:00
Johannes Meyer e6d9819adb FilterQueryString: Parse numbers as floats in range conditions 2019-12-09 09:39:50 +01:00
Johannes Meyer d0857345d0 DbConnection: Set `COLLATE 'latin1_general_ci'` for `latin1` charsets
MySQL 8+ seems a bit more strict now.
2019-12-05 14:18:17 +01:00
Johannes Meyer 8e5380220c SimpleQuery: Cache count query result and use it in `hasResult()`
Does not affect views which do not run a count query. (e.g. dashlets)
Though, this is a quick win for all other views with which the user
interacts directly and gets the desired result quicker than before.

refs #3905
refs #3836
2019-10-11 10:27:43 +02:00
Eric Lippmann c8ed889114 Fix operator in wildcard filter chains 2019-08-13 17:19:45 +02:00
Eric Lippmann 31d3153d2b Support wildcard filters in chains (#3903) 2019-08-12 13:41:38 +02:00
Eric Lippmann 666bdfb4c4 Revert "Fix double query execution"
This reverts PR 6ea012af7e, reversing
changes made to be5b9f870b.

The reverted commit fixed a double query execution bug by only executing
the query once in either SimpleQuery::hasResult() or upon iteration.

But the fix (b20291a60) introduced two problems:

* Default sort rules no longer work
* Show more links missing

We work with DataView objects in our controllers and views. When
iterating over a DataView, it applies its default sort rules and then
returns the underlying query, see DataView::getIterator().

DataView::hasResult() on the other hand does not apply the default sort
rules. So, if hasResult() is called first, the default sort rules are no
longer applied because the query will be executed only once.
The fix would be as easy as to apply sorting in DataView::hasResult() as
well.

But now the show more part kicks in. We know whether there are more
results because we execute queries with $limit + 1. This is enabled via
SimpleQuery::peekAhead(). Unfortunately, we call
SimpleQuery::peekAhead() ALWAYS after SimpleQuery::hasResult(). And
that's why the show more links are missing because the query is executed
only once with the "wrong" limit.

For now, we just revert the commit in question and postpone a proper fix
for the double execution.
2019-08-07 13:29:57 +02:00
Eric Lippmann b8fb193bdd Add FilterChain::setFilters() 2019-07-30 09:17:25 +02:00
Eric Lippmann b20291a606 Fix double query execution
Our monitoring list views call SimpleQuery::hasResult() first in
order to determine whether there are results to display. This calls
fetchRow() which executes the underlying query the first time. If there
are resulsts, the query is iterated which executes the query again.
With this patch, SimpleQuery::hasResult() makes use of the inner
iterator instead of calling fetchRow(). The query is now executed only
once.
2019-06-27 15:11:45 +02:00
Johannes Meyer 0be1053197
Merge pull request #3748 from Icinga/feature/sortable-announcements-page-3414
Sortable announcements page
2019-04-18 14:51:16 +02:00
Johannes Meyer 4d0a9fb289 DbConnection: Rename getTimezoneOffset() to defaultTimezoneOffset()
refs Icinga/icingaweb2-module-director#1837
2019-04-17 12:30:33 +02:00
Johannes Meyer 14b6e40562 DbConnection: Set current user's timezone on the connection
resolves #3525
2019-04-16 15:57:27 +02:00
Johannes Meyer db3cc699f7 ArrayDatasource: Store any type of key as a key column's value
fixes #3510
2019-04-16 13:26:48 +02:00
Johannes Meyer 032ca7ae50 SimpleQuery: Fail in case of missing order columns
refs #3414
2019-04-16 12:01:49 +02:00
Johannes Meyer e22d7daab6 SimpleQuery: Don't fail to order results based on sequenced column arrays
refs #3414
2019-04-16 12:00:55 +02:00
Eric Lippmann 403c2d3495
Merge pull request #3481 from marianrh/feature/optionally-disable-mysql-server-certificate-validation
Allow disabling MySQL server certificate validation by setting ssl_do_not_verify_server_cert
2019-02-26 10:39:21 +01:00
Markus Frosch 2df8132c46 DbConnection: Make host optional for Oracle connections 2018-12-04 15:50:53 +01:00
Thomas Gelf b4afdf4115 DbConnection: do not fail for MySQL 8
fixes #3611
2018-11-08 11:11:37 +01:00
Marian Rainer-Harbach 5e40405a12 Allow disabling MySQL server certificate validation by setting ssl_do_not_verify_server_cert
Signed-off-by: Eric Lippmann <eric.lippmann@icinga.com>
2018-07-16 11:41:13 +02:00
Uwe Ebel 4b5cf47cce Introduce SQLite resource type
refs #3381

Signed-off-by: Eric Lippmann <eric.lippmann@icinga.com>
2018-06-27 09:40:22 +02:00
Eric Lippmann 4d42c043e4 Remove traces of persistent db connections 2018-06-22 15:36:46 +02:00
Eric Lippmann af35794006 Revert "lib/db: Allow to configure persistent connections"
This reverts commit 4763b6b20a.
2018-06-22 14:43:32 +02:00
Alexander A. Klimov fc1f6e13ab Drop PHP 5.3 support 2018-05-07 11:36:54 +02:00
Johannes Meyer c3b19996f8 DbConnection: Introduce method getConfig()
refs #2508
2018-04-27 15:30:04 +02:00
Johannes Meyer 24128e0cc3 DbConnection: Automatically choose sqlsrv as driver..
..if available and none is explicitly set.

refs #3320
2018-04-24 15:50:12 +02:00
Alexander A. Klimov 7f5962dfae FilterQueryString: fix typo 2018-01-24 10:31:57 +01:00
Thomas Gelf ccd31f6438 Filter: new abstract methode and better IDE hints
fixes #3111
2017-11-21 12:29:02 +01:00
Michael Friedrich ab364e0fc7 Remove unsupported livestatus functionality
Signed-off-by: Eric Lippmann <eric.lippmann@icinga.com>
2017-09-29 10:33:55 +02:00