Commit graph

18 commits

Author SHA1 Message Date
Habeas Codice
1a5a5c7edb PostgreSQL support initial commit
There were 11 main types of changes:
- UPDATE's and DELETE's sometimes had LIMIT 1 at the end of them. This is not only non-compliant but
it would certainly not do what whoever wrote it thought it would. It is likely this mistake was just
copied from Friendica. All of these instances, the LIMIT 1 was simply removed.
- Bitwise operations (and even some non-zero int checks) erroneously rely on MySQL implicit
integer-boolean conversion in the WHERE clauses. This is non-compliant (and bad programming practice
to boot). Proper explicit boolean conversions were added. New queries should use proper conventions.
- MySQL has a different operator for bitwise XOR than postgres. Rather than add yet another dba_
func, I converted them to "& ~" ("AND NOT") when turning off, and "|" ("OR") when turning on. There
were no true toggles (XOR). New queries should refrain from using XOR when not necessary.
- There are several fields which the schema has marked as NOT NULL, but the inserts don't specify
them. The reason this works is because mysql totally ignores the constraint and adds an empty text
default automatically. Again, non-compliant, obviously. In these cases a default of empty text was
added.
- Several statements rely on a non-standard MySQL feature
(http://dev.mysql.com/doc/refman/5.5/en/group-by-handling.html). These queries can all be rewritten
to be standards compliant. Interestingly enough, the newly rewritten standards compliant queries run
a zillion times faster, even on MySQL.
- A couple of function/operator name translations were needed (RAND/RANDOM, GROUP_CONCAT/STRING_AGG,
UTC_NOW, REGEXP/~, ^/#) -- assist functions added in the dba_
- INTERVALs: postgres requires quotes around the value, mysql requires that there are not quotes
around the value -- assist functions added in the dba_
- NULL_DATE's -- Postgres does not allow the invalid date '0000-00-00 00:00:00' (there is no such
thing as year 0 or month 0 or day 0). We use '0001-01-01 00:00:00' for postgres. Conversions are
handled in Zot/item packets automagically by quoting all dates with dbescdate().
- char(##) specifications in the schema creates fields with blank spaces that aren't trimmed in the
code. MySQL apparently treats char(##) as varchar(##), again, non-compliant. Since postgres works
better with text fields anyway, this ball of bugs was simply side-stepped by using 'text' datatype
for all text fields in the postgres schema. varchar was used in a couple of places where it actually
seemed appropriate (size constraint), but without rigorously vetting that all of the PHP code
actually validates data, new bugs might come out from under the rug.
- postgres doesn't store nul bytes and a few other non-printables in text fields, even when quoted.
bytea fields were used when storing binary data (photo.data, attach.data). A new dbescbin() function
was added to handle this transparently.
- postgres does not support LIMIT #,# syntax. All databases support LIMIT # OFFSET # syntax.
Statements were updated to be standard.

These changes require corresponding changes in the coding standards. Please review those before
adding any code going forward.

Still on my TODO list:
- remove quotes from non-reserved identifiers and make reserved identifiers use dba func for quoting
- Rewrite search queries for better results (both MySQL and Postgres)
2014-11-13 12:21:58 -08:00
sirius
3845e1de7d Added permission handling of profile-photos
Now we automatically set the appropiate viewing-permissions on profile edit and revert photos chosen as default profile picture bacl to public access.
2014-04-20 00:31:18 +02:00
sirius
b0dc9f13ed Merging in conflict 2014-04-16 00:40:01 +02:00
friendica
bc041bdb77 profperm: abook_profile was being handled by profile id rather than profile_guid, causing private profiles to not be activated in many cases. 2014-04-13 19:57:47 -07:00
sirius
8b8feea12f Added hackish support for permissions-sync between profile and profile-pictures 2014-04-14 00:45:24 +02:00
friendica
5e4f45c03a mod_profperm migrated 2014-01-23 14:35:59 -08:00
friendica
40e2900326 comanchify all the simple cases - those that only load a profile. Rework permission checks for the profile sidebar so that it is all done internally. Remove crepair which we aren't using. 2013-12-11 14:54:36 -08:00
friendica
f04ce3b093 more work on notification system, fix a couple of minor issues from smarty conversion 2013-01-07 13:40:58 -08:00
Zach Prezkuta
a0d19ffb72 implement Smarty3 2013-01-06 15:57:11 -07:00
friendica
80bd128425 more DB cleanup 2012-08-30 18:47:07 -07:00
friendica
eac29badb2 start on contacts/profiles 2012-08-30 18:17:38 -07:00
friendica
8c3c3d5fd7 stuff 2012-08-27 01:22:08 -07:00
Alexander Kampmann
355c42cb30 Merge branch 'master' of https://github.com/friendica/friendica
Conflicts:
	include/config.php
	update.php
2012-04-05 13:39:15 +02:00
friendica
8aa2552372 add remove_user hook (it looks like dreamhost changed all my file permissions, this will make a nasty commit) 2012-01-18 16:21:30 -08:00
Devlon Duthie
f7d055687e - moved the header for profile permissions out of the scrolling div
- tweaks to the testbubble theme's nav
2011-10-04 11:10:57 -05:00
Friendika
58d474aa2d switch to text mode group editor after 'n' contacts 2011-06-29 20:42:16 -07:00
Friendika
d4bb560e7f small wording change 2011-04-12 21:37:54 -07:00
Friendika
080efe4d1e missed file addition 2011-04-12 21:25:00 -07:00