Commit graph

58 commits

Author SHA1 Message Date
zotlabs
83a4999dbe issue #606, postgres binary data handling under PDO and HHVM when passed null 2016-11-30 19:45:46 -08:00
zotlabs
793047919d missed this from the earlier checkin 2016-11-29 02:57:29 -08:00
zotlabs
3b6248cb64 dba_pdo: return false on q() DB error like the old driver did 2016-11-17 15:15:34 -08:00
zotlabs
b5c72611b4 change log string on pdo log messages 2016-10-27 15:21:40 -07:00
zotlabs
88a68b941f put all dns checking into one function, allow it to be ignored 2016-10-25 18:27:32 -07:00
zotlabs
084b41fc2c first cut at edit activities 2016-10-25 16:21:56 -07:00
zotlabs
7b713e2576 pdo - fetch assoc only 2016-10-25 16:15:39 -07:00
zotlabs
25982f0475 set port if non-zero (instead of non-null) 2016-10-24 18:55:11 -07:00
zotlabs
20194bed42 this seems to work, but there are unanswered questions and is still undergoing investigation. It appears that the data stored with os_content = 1 is not being escaped in all circumstances or the scaled image data is being escaped twice. 2016-10-23 21:27:10 -07:00
zotlabs
39f0707201 fetch bytea as stream 2016-10-23 17:53:34 -07:00
zotlabs
d30892ea60 pdo hacks 2016-10-23 17:05:08 -07:00
zotlabs
04ac04e0ad allow a dsn override to the database via the server argument. This could be used to allow unix domain sockets and other unusual configurations. 2016-10-20 17:04:43 -07:00
zotlabs
29340152b6 pdo - cleanup 2016-10-20 16:21:15 -07:00
zotlabs
e2e3b81f32 more pdo tweaks 2016-10-20 16:13:06 -07:00
zotlabs
b4b5eb5bab pdo testing 2016-10-20 15:45:48 -07:00
zotlabs
3726b546d5 use pdo for postgres also 2016-10-19 19:24:12 -07:00
zotlabs
2702b82bc3 pdo fixes 2016-10-19 17:23:06 -07:00
zotlabs
aee4f8d2fe pdo changes first cut 2016-10-19 16:58:26 -07:00
zotlabs
716a83d1f7 some pdo work 2016-10-17 16:12:32 -07:00
zotlabs
6532972e61 additional array checking 2016-10-13 00:30:41 -07:00
zotlabs
9bb847bb07 remove the rest of the backticks from sql queries; replace with TQUOT const which is driver dependent 2016-10-12 18:15:12 -07:00
Mario Vavti
ffee413d2d fix dbescdate() 2016-09-28 12:43:02 +02:00
redmatrix
44a2cc872c apply the same fix to our own DB as we did for hubzilla master and redmatrix. 2016-09-26 19:28:04 -07:00
redmatrix
cacdac16aa next wave of nulldate fixes 2016-09-26 18:16:43 -07:00
redmatrix
d3369384d1 include port in pdo url when host is 'localhost' 2016-08-23 18:18:05 -07:00
redmatrix
1267d995ef db statement debugging 2016-06-22 19:08:59 -07:00
redmatrix
00b4843425 provide a sort of mutex lock around db logging so it can't possibly recurse. Previous attempts to do something similar using other methods haven't worked out satisfactorily. 2016-05-31 16:16:54 -07:00
redmatrix
516c43ba15 more work associated with DBA and index.php shuffle 2016-05-24 17:54:45 -07:00
redmatrix
84ba6393ad relocate index and db 2016-05-24 16:36:55 -07:00
redmatrix
3355210878 explain what we're doing and where we're going with this. 2016-05-18 22:03:43 -07:00
redmatrix
16f79b70e4 experimental PDO DBA driver 2016-05-17 22:32:49 -07:00
redmatrix
217db8f9b2 provide tools to extract a pdo constructor 2016-05-15 19:16:55 -07:00
redmatrix
6f486a3393 prevent recursion in the database driver when debugging is enabled and the system config is not yet loaded - caused by calling get_config and making db calls within the logger function; which we then attempt to log... 2016-05-09 01:12:24 -07:00
redmatrix
2e7028c976 some cleanup on the mysqli driver 2016-04-25 22:03:02 -07:00
redmatrix
d62f490814 Setup was horked after this commit and I couldn't easily make it right so reverting - will try again at a future date
Revert "remove global db variable"

This reverts commit c3b0c0f32a.
2016-04-25 20:12:36 -07:00
redmatrix
c3b0c0f32a remove global db variable 2016-04-25 16:55:33 -07:00
redmatrix
9debfa348a add syslog loglevels to dba functions 2016-03-07 20:43:52 -08:00
redmatrix
91801d2e2c rev update 2016-02-10 13:55:51 -08:00
redmatrix
167e754a1b issue #184 2015-11-23 15:17:38 -08:00
Klaus Weidenbach
124b17dcf4 Some cleanups.
Fixed dbesc_identifier(), but it is not used yet.
Corrected some other variable names and variable initialization before
using them.
2015-03-13 00:36:32 +01:00
Habeas Codice
8ac3b938fd added dbdriver to siteinfo json to better track affected sites 2014-11-22 13:27:52 -08:00
Habeas Codice
ecb86dd6b2 somehow missed this one
was causing problems with pickup messages originating from postgres servers
2014-11-22 09:26:46 -08:00
friendica
1c249a5b06 some poller optimisations and a fix for undefined (empty) dbtype which shows up as a mysql error that 'rand' isn't found. 2014-11-16 15:51:42 -08:00
RedMatrix
f864e3d7d8 Merge pull request #693 from habeascodice/master
Add bitwise xor to db_getfunc()
2014-11-14 13:06:07 +11:00
Habeas Codice
ee38bebbd6 Add bitwise xor to db_getfunc() 2014-11-13 17:57:21 -08:00
friendica
edda931197 mysql driver - in debug mode for statements that return true/false report the sql along with the result so we can match it to an offending statement. This has bugged me for some time but never got around to fixing it until now. 2014-11-13 16:34:36 -08:00
Habeas Codice
ac27db22c1 Merge remote-tracking branch 'upstream/master'
Conflicts:
	boot.php
	include/dba/dba_driver.php
	include/diaspora.php
	include/follow.php
	include/session.php
	include/zot.php
	mod/photos.php
	mod/ping.php
2014-11-13 13:06:31 -08:00
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
Klaus Weidenbach
fc2bf4c29b Some Doxygen documentation.
Add some more Doxygen formating for boot.php and dba_driver.php.
Cleaning a bit up, too.
2014-11-13 00:00:50 +01:00
friendica
386156138f syntax error in dba driver, document z_post_url 2014-09-09 02:42:07 -07:00