Commit Graph

99 Commits

Author SHA1 Message Date
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
Ralf Becker
83a250e085 php5 __construct plus old old class-name method calling the new constructor, added non_db_cols to __get() and __set() 2008-05-26 08:27:24 +00:00
Ralf Becker
b69b8085e6 Fixed some problems with the etag handling, causing an SQL error on
merging contacts, as reported by Johannes Gorschlüter from Stylite
2008-05-17 06:44:17 +00:00
Ralf Becker
d58ddd9999 "allow to insert rows with the auto-id specified" 2008-04-27 20:05:04 +00:00
Ralf Becker
163b795d45 "extra where condition, eg. to check etag on writing" 2008-04-26 07:49:01 +00:00
Ralf Becker
5fd2d8def8 removed unnecessary instancations and using static methods of html and egw_link class 2008-03-25 16:42:23 +00:00
Ralf Becker
ef43425f7f allow to use global db-object (and no clone&set_app), if told so via a separate parameter to the constructor (not by default as the app using so_sql might not be ready for it) 2008-03-13 11:08:54 +00:00
Ralf Becker
33b2504316 "Added code to convert timestamps to so_sql.
If you want to use it, you only need to set the timestamps to be converted from user to servertime in so_sql::timestamps AND dont reimplemnt db2data/data2db (or call the default implementation)"
2007-12-04 01:13:53 +00:00
Ralf Becker
fb9d6db5be "fixed so_sql::get_rows to return an empty array() instead of array(false) if nothing found" 2007-11-27 21:24:50 +00:00
Ralf Becker
336784d74e fixed only partcial csv export in timesheet, get_rows was not using the num_rows parameter 2007-10-07 13:29:24 +00:00
Ralf Becker
f21e357253 fixed not working direct sql-updates (eg. 'etag=etag+1') via so_sql::save's parameter 2007-09-06 11:56:37 +00:00
Ralf Becker
c5ac764580 "- bugfix: data_merge was not merging null values (isset instead of array_key_exists)
- new update function, which write just the given cols and not the whole row"
2007-07-05 04:46:49 +00:00
Ralf Becker
94dced8024 "fix for bug #747: Postgres SQL error searching tracker items" 2007-05-21 04:49:57 +00:00
Ralf Becker
e11b8e5e32 worked around stupid php5.2 empty haystack warnings 2007-04-29 14:25:19 +00:00