Commit Graph

270 Commits

Author SHA1 Message Date
Johannes Meyer 119b2fdddb DbQuery: Allow to join additional tables
This should just be the beginning of such additions, there is still a group(),
distinct(), etc missing..
2015-05-28 13:52:00 +02:00
Johannes Meyer 58d78f59f3 DbQuery: Initialize self::$select as early as possible
I'd like to use Zend's implementation instead of re-inventing the wheel just
because someone decided to only work with a copy of it in the frameworks
query but do exactly the opposite in the monitoring module's IDO query...
2015-05-28 13:49:36 +02:00
Johannes Meyer ec556edc65 Merge branch 'master' into feature/user-and-group-management-8826 2015-05-26 09:28:35 +02:00
Johannes Meyer 54354b17bf DbConnection: Replicate the fix for #9211 2015-05-26 09:26:55 +02:00
Eric Lippmann 83a6e85b5d lib: Don't render empty filters to SQL
Else we are presented with syntax errors.

fixes #9211
2015-05-22 13:53:57 +02:00
Johannes Meyer 093857641a DbConnection: Cast a queries count to integer forcefully 2015-05-20 09:30:23 +02:00
Johannes Meyer fb07f0b94c Merge branch 'master' into feature/user-and-group-management-8826
Conflicts:
	library/Icinga/Authentication/Backend/LdapUserBackend.php
	library/Icinga/Protocol/Ldap/Query.php
2015-05-19 14:14:03 +02:00
Johannes Meyer f305a334d5 DbConnection: Drop param $columnIndex in fetchColumn(), it's unused 2015-05-19 09:48:20 +02:00
Johannes Meyer cf989a0f7f SimpleQuery: Implement interface Iterator to benchmark result iteration 2015-05-19 09:41:55 +02:00
Johannes Meyer a1276fd709 Benchmark all queries by default, not only db queries 2015-05-19 09:41:18 +02:00
Johannes Meyer 7b6ca0826b DbQuery: Let the DbConnection do the count query 2015-05-19 09:34:22 +02:00
Johannes Meyer 0e0341f78a It's the connection which provides a cursor, not the query 2015-05-18 16:01:58 +02:00
Johannes Meyer 742dfcaf41 Revert "Fetchable: Add method fetch() which returns an iterator"
This reverts commit 7a6837de0e.
2015-05-18 15:17:22 +02:00
Johannes Meyer 7a6837de0e Fetchable: Add method fetch() which returns an iterator 2015-05-18 13:59:16 +02:00
Eric Lippmann 82ee1d6e60 Merge branch 'master' into bugfix/significant-whitespaces-8777
Conflicts:
	library/Icinga/Web/Widget/FilterEditor.php
2015-05-18 13:35:28 +02:00
Johannes Meyer 524c449649 Merge branch 'master' into feature/user-and-group-management-8826 2015-05-18 11:28:07 +02:00
Johannes Meyer 130fea3146 Revert "Merge Queryable into QueryInterface"
This reverts commit ca5ef2da2b.
A perfect example of a change as a result of being mentally deranged.
2015-05-18 11:25:02 +02:00
Johannes Meyer fbf0ad4339 Drop interface Browsable
We're not required to handle objects of Zend_Paginator in any way, so
creating such as part of a query is not necessary since QueryAdapter
accepts any instance of QueryInterface. (gets enforced in the near future)

refs #8339
2015-05-15 14:37:41 +02:00
Johannes Meyer ed5f646b6f SimpleQuery: Implement interface IteratorAggregate
I'd like to foreach such.
2015-05-15 14:37:41 +02:00
Johannes Meyer 7d08dd2765 DbConnection: Adjust insert and update to support custom type definitions
This strips the custom insert and update implementataions in
DbUserBackend down so that it does not need to do such low level stuff...

refs #8826
2015-05-13 09:15:18 +02:00
Johannes Meyer 3aaa6d39a1 DbConnection: Make it possible to insert, update and delete table rows
refs #8826
2015-05-11 13:25:50 +02:00
Johannes Meyer 8690056e1c Introduce interface Updatable
refs #8826
2015-05-08 15:18:56 +02:00
Johannes Meyer 2c1fac9da8 Introduce interface Reducible
refs #8826
2015-05-08 15:18:42 +02:00
Johannes Meyer 84f20ecb5f Introduce interface Extensible
refs #8826
2015-05-08 15:18:28 +02:00
Johannes Meyer 16a7b010bc SimpleQuery: Ignore limit and offset when counting 2015-05-06 10:41:39 +02:00
Johannes Meyer cfa9176192 ArrayDatasource: use array_shift in fetchRow() instead of index access
Since associative arrays are supported, the numeric index 0 might not be
the first entry in the result.
2015-05-06 10:10:29 +02:00
Johannes Meyer 7b2ed3bef7 ArrayDatasource: Create a new result when counting
There is usually no limit and offset when a query is going to be counted
so the cached result must not be used.
2015-05-06 10:08:07 +02:00
Johannes Meyer f2ad2838f4 ArrayDatasource: Apply a query's limit and offset when creating the result 2015-05-06 09:39:43 +02:00
Johannes Meyer d63381c002 ArrayDatasource: Add missing and fix existing documentation 2015-05-06 09:12:48 +02:00
Johannes Meyer b1cbc1422b ArrayDatasource: Add support for associative arrays
Keys are now preserved in case a non-numeric one is found. By using
setKeyColumn() it is now also possible to map such a key to a specific
column of a row generated by createResult().
2015-05-06 08:40:02 +02:00
Johannes Meyer 5cc7f26728 ConfigObject: Extend ArrayDatasource
This makes it possible to use a ini file as repository!!!1
One thing is missing: Section names are currently ignored and should be
mapped to a virtual column.

refs #8826
2015-05-05 15:21:34 +02:00
Johannes Meyer bd136d39f4 SimpleQuery: Make compare() alias aware
refs #8826
refs #7693
2015-05-05 07:31:50 +02:00
Johannes Meyer d71df6a9b8 Revert "SimpleQuery: Make compare() alias aware"
This reverts commit 6612e4c1ae.
2015-05-05 07:30:42 +02:00
Johannes Meyer 6612e4c1ae SimpleQuery: Make compare() alias aware
refs #8826
refs #7693
2015-05-04 11:34:39 +02:00
Johannes Meyer ecd059dec5 DbConnection: select() returns a DbQuery, not a Query 2015-05-04 11:13:38 +02:00
Johannes Meyer e7789ed640 SimpleQuery: Rename unused property `table' to `target'
`target' is already in use, but was not declared. `table' was declared but not
used anywhere. So `table' is now `target'.
2015-05-04 11:12:43 +02:00
Johannes Meyer ca5ef2da2b Merge Queryable into QueryInterface
A *Query*Interface describes an object as being queryable, now.

refs #8826
2015-05-04 11:07:50 +02:00
Johannes Meyer 97caeb27f7 UserBackend: Add missing and fix existing method documentation
refs #8826
2015-04-21 13:59:35 +02:00
Eric Lippmann 45d1230b28 Merge branch 'master' into bugfix/significant-whitespaces-8777 2015-04-08 10:19:53 +02:00
Eric Lippmann 6e6aabedf2 Don't trim filter expressions
Leading and trailing whitespaces may be significant for comparison.

refs #8777
2015-04-08 09:31:11 +02:00
Alexander Klimov 967a2e82dc Use (only) "@return $this" in fluent interfaces' documentation 2015-04-07 14:24:11 +02:00
Eric Lippmann 949438d753 lib: Add SimpleQuery::splitOrder() ...
... for supporting specifying the sort direction next to the column, e.g.
'service_display_name ASC'

refs #8716
2015-03-13 17:09:32 +01:00
Eric Lippmann 8563d5ed3f PHPDoc: Use @var instead of @type
Becasue of too many kittens PSR-5 backed off of deprecating @var.
So that's the way we go too.
2015-03-12 16:08:47 +01:00
Eric Lippmann 760819f239 lib: Remove TreeNode::getIterator()
Its the tree who has the iterator.

refs #6630
2015-02-10 17:01:32 +01:00
Eric Lippmann b18405e99f lib: Add SimpleTree
Simple tree implementation for TreeNodes.

refs #6630
2015-02-10 17:00:47 +01:00
Eric Lippmann fd38e5b2e1 lib: Use @inheritdoc in the TreeNodeIterator
refs #6630
2015-02-10 16:59:43 +01:00
Eric Lippmann 3a4c6e45b8 Fix Fatal error: Interface 'Identifiable' not found
refs #6630
2015-02-06 17:32:51 +01:00
Eric Lippmann 0d63e14baf lib: Rename Node to TreeNode
refs #6630
2015-02-06 17:27:14 +01:00
Eric Lippmann 828cb8d23a lib: Add iterator over a tree node's children
refs #6630
2015-02-06 17:23:07 +01:00
Eric Lippmann f331c03f63 lib/tree: Save child nodes into an array instead of using SplDoublyLinkedList
refs #6630
2015-02-06 17:20:23 +01:00
Eric Lippmann c8da05d0a7 lib: Remove NodeInterface
I'll create an iterator for nodes and drop that every node is a SplDoublyLinkedList.

refs #6630
2015-02-06 17:17:41 +01:00
Eric Lippmann 6bae2e0a53 Note that our license is GPL v2 or any later version in our license header instead of pointing to the license's URL 2015-02-04 10:52:27 +01:00
Eric Lippmann 5b4fab0750 Add license header
This time without syntax errors hopefully :)
2015-02-03 16:27:59 +01:00
Eric Lippmann 5fa2e3cfdc Revert "Add license header"
This reverts commit 338d067aba.
2015-02-03 16:16:26 +01:00
Eric Lippmann 338d067aba Add license header
fixes #7788
2015-02-03 15:51:04 +01:00
Eric Lippmann 52c40bdc5b lib/SimpleQuery: Increase default limit to 25
Please follow the referenced issues.

fixes #8337
refs #8339
2015-02-02 14:16:27 +01:00
Eric Lippmann c53b1d27e9 lib: Deprecate Data\Filterable because of ...
addFilter and applyFilter do the same in all usages.
addFilter could be replaced w/ getFilter()->add().
We must no require classes implementing this interface to implement redundant methods over and over again.
The interface must be moved to the namespace Icinga\Data\Filter.
It lacks documentation.
2015-01-27 14:33:46 +01:00
Johannes Meyer 38957e340b Fix that DbQuery::renderFilter produces invalid filters
fixes #7749
2014-11-20 11:58:22 +01:00
Johannes Meyer 7621f6642d Adjust usages of Icinga\Application\Config
refs #7147
2014-11-18 13:11:52 +01:00
Johannes Meyer 0c84bf614d Split config functionality into two classes
There is now Icinga\Application\Config as our ini configuration handler and
Icinga\Data\ConfigObject as our general configuration container.

refs #7147
2014-11-18 13:02:56 +01:00
Thomas Gelf 40c4562fe4 Data\SimpleQuery: don't fail on missing columns...
...for now
2014-11-16 18:24:16 +01:00
Thomas Gelf b2a55f0998 Db\DbQuery: do not expose applyFilterSql 2014-11-16 17:09:51 +01:00
Thomas Gelf 5ea2f33efb Db\DbQuery: add NOT LIKE support 2014-11-16 17:08:50 +01:00
Thomas Gelf 90f1ab06b4 Db\DbQuery: add "deep" clone support
Still far from being complete, Zend_Db_Select makes life really hard for
us. More to come...
2014-11-16 17:06:26 +01:00
Thomas Gelf e89d4642e3 Merge remote-tracking branch 'origin/master' into feature/livestatus-playground-4787 2014-11-16 10:12:34 +01:00
Thomas Gelf 9e0e3f12e3 FilterChain: addFilter should return itself 2014-11-16 02:49:33 +01:00
Thomas Gelf 44c96f0410 FilterOr: override operator change for NOT
Replacing an OR filter with a NOT operator should return a NOT OR
when the OR contains more than one entry
2014-11-15 22:37:12 +01:00
Thomas Gelf 1f74c462d4 FilterChain: add and use count() function 2014-11-15 22:34:18 +01:00
Thomas Gelf 925348d171 Data\Filter: add or/andFilter implementations
Those shortcuts make it easy to correctly add or/and conditions
regardless of the original filter type
2014-11-14 23:06:20 +01:00
Thomas Gelf 6aefc4b491 Data\Filter: fix $self VS $this 2014-11-14 22:53:46 +01:00
Thomas Gelf 178ddaade7 Data\Filter: add missing abstract function type 2014-11-14 22:44:04 +01:00
Thomas Gelf 53bca911fb Data\Filter: enforce isEmpty() implementation 2014-11-14 22:43:30 +01:00
Thomas Gelf ce7aea5df7 Data\Filter: add isChain() and isExpression()
This makes node type distiction easier
2014-11-14 22:41:30 +01:00
Eric Lippmann 94f8597271 Add existing GROUPBYs to count queries 2014-11-13 16:42:11 +01:00
Eric Lippmann 0e34001568 Use automatically a subquery when counting with groups 2014-11-13 16:42:11 +01:00
Johannes Meyer 77f5bc3932 Use GROUPBY instead of DISTINCT and subqueries when counting 2014-11-13 16:42:11 +01:00
Thomas Gelf f0ca81d7af Data\Filter: SORT_NATURAL only for PHP >= 5.4 2014-11-12 11:47:42 +01:00
Thomas Gelf 0d4d4930a9 Db\DbConnection: benchmark single row fetches 2014-11-11 21:07:02 +01:00
Thomas Gelf 6d705721e3 Filters: try to give meaningful results for...
...missing columns

refs #4787
2014-11-11 19:26:37 +01:00
Thomas Gelf 8987b69d55 Filter: allow to list all filtered columns
This is important for backends that need to know which additional columns
to fetch.

refs #4787
2014-11-11 19:09:59 +01:00
Johannes Meyer 7b99b74ae1 Prefer Icinga\Application\Config instead of Zend_Config
refs #7147
2014-11-07 13:53:03 +01:00
Eric Lippmann 2b67683e00 DbConnection::__construct(): Set prefix if configured 2014-10-20 13:43:03 +02:00
Eric Lippmann 79ade944de Resources: Support type 'ini' yet only in the resources.ini
Configuring the resource type 'ini' via the web interface is not yet possible.
2014-10-20 13:40:35 +02:00
Alexander Fuhr 4c23d98575 Merge branch 'master' into bugfix/monitoring-list-dup-entries-7057 2014-10-08 12:45:14 +02:00
Alexander Fuhr afc97b1cac Fix the duplicate entries in monitoring list shows
refs #7057
refs #7344
fixes #7057
2014-10-08 12:30:08 +02:00
Eric Lippmann 1b23fd7fbe monitoring: Don't support status.dat as backend
Icinga Web 2 will not support status.dat for now and maybe forever.
2014-10-07 13:22:07 +02:00
Eric Lippmann 865ef76cb8 filter: Fix whitespace sanitizing 2014-10-06 13:19:25 +02:00
Alexander Fuhr 97d2a920db Implement GROUP BY clause functionality 2014-10-06 11:34:04 +02:00
Eric Lippmann 64d41ac5a3 filter: Make `DbQuery::applyFilterSql()' public
I want to use that function in a module :)
2014-10-01 12:51:28 +02:00
Eric Lippmann ebde422824 filter: Fix whitepsace sanitation when expression is an array 2014-10-01 04:00:43 +02:00
Eric Lippmann 46078f50db filter: Fix that leading and trailing whitespaces for columns and expressions let filters fail
Before, filtering for "host = localhost" issued "got invalid column host".
2014-10-01 03:13:27 +02:00
Eric Lippmann 90dbcdbbfb The stupid `DbQuery::isTimestamp()' hack must return false
This a fix for modules using our query / filter combination since `return $this;' renders all columns as timestamps.
2014-09-19 14:29:29 +02:00
Alexander Klimov 36a3c36c1b Rename Icinga\Protocol\File\Reader to ...\File\FileReader 2014-09-04 16:37:24 +02:00
Thomas Gelf 3d352ba446 Filter: add FilterNotEqual and FilterMatch
fixes #6557
2014-09-02 19:51:56 +02:00
Marius Hein 30f391035c Postgres/DbQuery: Add orderfields to select
refs #6896
2014-09-01 10:00:04 +02:00
Marius Hein 9d0037a53a ResourceFactory: Add function create(<name>)
The ConfigAwareFactory is an interface forcing "backend-type" classes to call
ResourceFactory::createResource() passing a config they got in the constructor.

That's kind of overdesigned, if the ResourceFactory wants to be something like
a service locator it's responsabilities should include object instantiation.

refs #5514
2014-08-28 12:14:54 +02:00
Marius Hein 9b83074cc9 Class doc for ResourceFactory
refs #5514
2014-08-28 12:14:54 +02:00
Marius Hein 22e17e9901 ResourceFactory: Move available function to platform
refs #5514
2014-08-28 12:14:54 +02:00
Alexander Klimov e6612fefe7 FilterParseException: extend IcingaException
refs #6931
2014-08-27 16:26:43 +02:00
Alexander Klimov afd0c20c42 FilterException: extend IcingaException
refs #6931
2014-08-27 16:23:44 +02:00