Commit Graph

112 Commits

Author SHA1 Message Date
Ralf Becker
130dded1e2 added automatic conversation of boolean columns on select (update/insert is already done by quote), get automatic enabled by setup_table or you have to set has_bools to true 2012-07-21 09:51:22 +00:00
Nathan Gray
fe7814b64c Prepend table name to avoid ambiguity 2012-05-14 18:03:42 +00:00
Frédéric Erpicum
afa20726f8 * ProjectManager - Filter elements by app 2012-02-27 20:20:42 +00:00
Ralf Becker
b34d6f9d35 automatic conversation of not set DB timestamps returned by MySQL as "0000-00-00 00:00:00" to null 2012-01-11 01:03:45 +00:00
Ralf Becker
d2adcf972d skip the empty (NULL) row 2011-09-09 19:55:22 +00:00
Ralf Becker
476deb3605 query_list(). initialize return value to array(), to allways return an array 2011-09-09 09:41:51 +00:00
Ralf Becker
f9444ae1cd added "decimal" to nummeric types, to fix PostgreSQL error (bug #2105) 2011-04-10 15:12:43 +00:00
Ralf Becker
778d03772a fixed typo CAPABILITY_CAST_AS_VA(R)CHAR 2011-03-20 12:49:22 +00:00
Ralf Becker
c492c57e2f * Addressbook: fixed PostgeSQL error when searching or showing accounts 2011-03-20 12:37:22 +00:00
Nathan Gray
e2d54119dd - Fix infinite loop bug if you use 'OR' in search
- Use case-insensitive LIKE from db capabilities
2011-01-07 21:13:40 +00:00
Nathan Gray
48ba641cb3 Avoid conflicts with other objects that have ->db defined by using the global db 2010-07-13 14:22:14 +00:00
Ralf Becker
30ce2262dd if search pattern alread contains a wildcard, do NOT add further ones automatic (eg. in extended search in addressbook) 2010-06-25 07:11:39 +00:00
Jörg Lehrke
a4b36620dd Fix excess of maximum column length issue 2010-06-18 09:33:57 +00:00
Ralf Becker
579cf86bbc fix for bug #2624: SQL error - CONCAT not supported by postgres 2010-05-26 15:44:09 +00:00
Nathan Gray
2760915be4 Always understand english search operators 2010-05-25 19:04:40 +00:00
Jörg Lehrke
334a8c6fc3 Fix addressbook_bo::find_contact() 2010-04-21 17:41:34 +00:00
Klaus Leithoff
69da1000b2 if only keys is passed to search return only the DISTINCT result-set (was not implemented when only_keys where passed as array) 2010-04-21 12:14:04 +00:00
Klaus Leithoff
7a4f191fb3 fix to provide (return) data even if a shortname is used as column name 2010-04-20 13:58:01 +00:00
Ralf Becker
423dbbc567 "an other fix: if there's already an explicit named column, just use that name" 2010-04-20 08:12:22 +00:00
Ralf Becker
f2e9a38ff4 "fixed ambiguous column sql-error by adding table-name to id over which we join" 2010-04-04 09:08:25 +00:00
Ralf Becker
a45ea03b19 "fixed ambiguous column sql-error by adding table-name to id over which we join" 2010-04-04 08:59:37 +00:00
Nathan Gray
5e23cfb764 Working on searching...
- Check default column names to avoid DB errors
- Prefix default column names with table name to avoid ambiguity
- Handle single words in quotes
2010-04-01 20:48:16 +00:00
Nathan Gray
4b134dfc9e Extra column check needs to be escaped 2010-04-01 20:19:28 +00:00
Nathan Gray
fa6c1d4a9c Need to set numeric types to check 2010-04-01 20:07:01 +00:00
Nathan Gray
d22773d04d Add extra search functionality to custom fields. 2010-04-01 19:59:50 +00:00
Nathan Gray
3d8fca332b More sensible handling of numeric columns:
- If app doesn't specify columns to search, all columns except numerics with '_id', 'modified', 'modifier', 'status', 'cat_id', 'owner' will be considered
- Numeric columns will be searched only if the search string contains a numeric token.  'maintenance 50' is ok to search for, but for numeric columns only 50 will be searched.  
- Numeric columns are searched using equality, unless user puts in a wildcard.  Searching for 50 will only match 50, not 150 or 1950/04/10, but *50 will match 150.
- Text columns are searched using LIKE, including numeric search terms, as before.
2010-04-01 17:03:51 +00:00
Nathan Gray
cc0f8f3c28 An attempt to add more functionality to searching
- All words are trimmed
- Double quotes require the exact phrase ("Nathan Gray" will not match Nathan Brown or Gray Power)
- Modifiers + and - before a word will require or exclude the word (+test -fail), otherwise word is ORed
- User language modifiers AND, OR and NOT (uppercase) will be parsed.
- Combinations: tracker entry -testing -"fatal error"
Note that "entry" will not match "entries", and the results are not sorted by match strength.

All applications that use so_sql for searching should gain these benefits.
2010-03-31 21:29:11 +00:00
Ralf Becker
ab598b8fcb fix for user changing the timezone while having an edit popup open (unfixed the timestamps would change by the differenz of the two timezones). This fix does eg. NOT fix history logging (depending on the entry read before saving it), so it is better to handle the situation in the UI code, thought this is better then not handling it at all 2010-02-17 00:55:43 +00:00
Ralf Becker
0e646e28c8 optinally return an iterator for a search 2009-11-24 10:59:19 +00:00
Ralf Becker
200a6d61d5 Reworked so_sql class to:
- use new egw_time::server2user() and egw_time::user2server() to do
  timezone conversation of registered timestamps
- added $timestamp_type parameter to constructor, to automatic convert
  all timestamps on read (or search) to given type, default NULL leaves
  them unchanged --> will allow in future to work completly with
  egw_time objects
2009-10-08 16:18:28 +00:00
Ralf Becker
ad5d2c3941 docu update and fixed so_sql_cf::delete($keys,true) to always return array 2009-09-16 10:20:34 +00:00
Ralf Becker
19086bb7b0 Some fixes and enhancments to simplify search with so_sql
- search($criteria,...) if $criteria is a string, search in all data
  columns or - if set - $this->columns_to_search
  --> that's NOT backward compatible - though a quick scan through the
      EGroupware code showed no use of $criteria as string!
- this automatic search, appends and prepends '%' only, if search
  pattern does NOT already contain wildcards (* or ?)
  --> allows to search "test*" for values starting with test
- improved handling of db timestamps (Y-m-d H:i:s), to allow to search
  for them too (eg. "2009-08-*")
- so_sql_cf::get_rows() now calls parent
- so_sql_cf::search() adds DISTINCT if query contains a join
--> ToDo: remove custom search code from apps, to give consitent search
behavior in all apps and simplify the code there
2009-08-19 12:08:52 +00:00
Ralf Becker
35626a6593 "docu update to avoid a common pitfall" 2009-08-17 12:28:30 +00:00
Ralf Becker
2a4e1a95cb "- method to automatic convert all timestamp fileds to and from usertime
- enable this->timestamps to deal with timestamp type columns (as well as integers as before)"
2009-08-10 13:48:11 +00:00
Ralf Becker
232252475f patch fixing many depricated functions (eg. posix regular expressions) and features, which fill up the error_log under php5.3 (and will no longer be available under php6).
Patch is mostly created by script in egroupware/doc/fix_depricated.php in separate commit.
I do NOT advice to apply this patch to a production system (it's commited to trunk!), as the automatic modified regular expressions have a good change to break something ...
2009-06-08 16:21:14 +00:00
Ralf Becker
95168d28bb "method to access comments in schema definition" 2009-05-13 09:58:21 +00:00
Ralf Becker
5a22640c82 - changed return value of search() to NULL instead false, if nothing
found, as this can be simply casted with (array) to work in foreach
- documentation update
2009-05-03 18:36:38 +00:00
Ralf Becker
f61ffc2e5e allow to pass $extra_cols parameter from get_rows to search 2009-03-11 12:14:15 +00:00
Ralf Becker
1b4d236d4a New class extending so_sql handing all custom fields needs: reading,
saving, searching, ordering and filtering
Makeing a full custom field implementation like in addressbook very easy
and quick
2009-01-17 03:36:58 +00:00
Stefan Becker
858485ad30 "fixed Bug #1663 'More News' not visible in sitemgr when limit is 1, -> so_sql, is now giving back the numbers of total" 2008-10-07 08:17:09 +00:00
Ralf Becker
a1a3ed0d35 "use egw_db::select instead of self::search in so_sql::not_unique() as it does NOT set this->data" 2008-09-22 16:00:45 +00:00
Ralf Becker
70052c8355 fixed SyncML and accounts problem reported by Phillip Herbert <pherbert-at-knauber.de>: update set all but the updated fields to NULL, instead of just updating the given fields 2008-07-02 15:25:54 +00:00
Ralf Becker
b3b53c2f87 "treat (space separated) words in search as or'ed search for them individually" 2008-06-26 16:08:47 +00:00
Ralf Becker
23c473690e "removed accidently commited 2. patch" 2008-06-19 16:07:57 +00:00
Ralf Becker
b89e7b46a1 "fixed not working install (segfault) caused by account creation in sitemgr's default_records and the new uid code in addressbook_sql::save() going into an invinit recureing, because so_sql::update calls $this->save() instead of self::save()" 2008-06-18 19:56:26 +00:00
Klaus Leithoff
09abb185f9 # improving of the negated search criteria behavior 2008-06-17 07:28:35 +00:00
Ralf Becker
6b74d6ad88 "switched permanent debug message off again" 2008-06-04 05:26:52 +00:00
Ralf Becker
c34dc55633 "fixing the fix: only add primary key, if it's NOT an auto id" 2008-05-30 08:20:06 +00:00
Ralf Becker
b6be2fb249 "bugfix: not_unique() method was not working with unique indexes over multiple columns and was not testing the primary keys, with is also unique" 2008-05-28 12:17:06 +00:00
Ralf Becker
78dd1cdf03 missed new $no_clone parameter 2008-05-26 08:32:27 +00:00