Commit graph

27 commits

Author SHA1 Message Date
f7240301e4 Basic database maintenance
Closes #169
2019-07-26 09:37:51 -04:00
6ef13d0880 Style fixes 2019-05-01 22:52:20 -04:00
21fdd66d37 Work around limit to SQL parameter placeholders for IN() clauses
Improves #150

LIKE-based matches also need to be similarly conservative
2019-03-01 22:36:25 -05:00
570a9b171c Revert fulltext detection in driver 2019-02-22 18:49:57 -05:00
ad8057a40b Driver changes to support basic text searching 2019-02-22 11:13:13 -05:00
908e1fa310 API documentation for database driver interface 2019-02-21 15:43:19 -05:00
8fc31cfc40 Rewrite various queries to work in PostgreSQL
This involved changes to the driver interface as well as the database
schemata. The most significantly altered queries were for article
selection and marking, which relied upon unusual features of SQLite.
Overall query efficiency should not be adversely affected (it may have
even imprved) in the common case, while very rare cases (not presently
triggered by any REST handlers) require more queries.

One notable benefit of these changes is that functions which query
articles can now have complete control over which columns are returned.
This has not, however, been implemented yet: symbolic column groups are
still used for now.

Note that PostgreSQL still fails many tests, but the test suite runs to
completion. Note also that one line of the Database class is not
covered; later changes will eventually make it easier to cover the line
in question.
2018-12-04 20:41:21 -05:00
f64f0c6a22 Whitespace cleanup 2018-10-26 14:58:04 -04:00
7ca0f4e877 Make the SQLite3 driver more generic
The changes in this commit should make it more practical to:

- Allow the driver to decide for itself whether to try creating a PDO object if its own requirements are not met
- Have any driver use a generic schema update procedure
- Use the same constructor for native and PDO SQLite
2017-12-18 18:29:32 -05:00
5cd7268c0a Added incorrectDbCharset to NCNv1 server status
This has been exposed since version 11.0.3, released before our version 0.1.0, but after implementation work had begun
2017-11-29 18:14:59 -05:00
11b2066922 Added per-file legal boilerplate
Includes PHPDoc license tag in the file-level block with accompanying copyright notice.

Also added an AUTHORS file on the off chance of outside contributions
2017-11-16 20:23:18 -05:00
f7e50fe95d Passed code through linter 2017-08-29 10:50:31 -04:00
da80a8ffa6 Complete tests for database driver
- Fixes #62
2017-07-22 15:29:12 -04:00
b3f631e335 Use more reliable database locking strategy; reorganize tests
PostgreSQL and MySQL both have better locking mechanisms than what was previously implemented, as well
2017-07-07 21:06:38 -04:00
7e7b204d85 Cleanup
- Revamped design of Query class to be more consistent and predictable, and generally suck less
- Removed special case for Query class in Statement class
- Cleaned up database schema somewhat
2017-07-07 11:49:54 -04:00
c37d476ba0 Changes to Database internals
- Driver->prepare() can now take a new Database\Query object as the first parameter
- The Query class allows for building a complex query out of a main body, common table expressions, WHERE coniditions, ordering conditions, a limit, and offset
- The subscriptionList method is the prototypical example of usage
- The experimental articleList method will in time be adapted to use this as well
- A generic means of specifying a selection context is forthcoming; this would remove subscriptionList's $folder and $id parameters, for instance
2017-06-04 18:00:18 -04:00
8ebcb01cb5 Made out-of-order transaction handling more predictable 2017-05-07 18:27:16 -04:00
2083c6e397 Change transactions to auto-rollback on exceptions 2017-05-06 12:02:27 -04:00
929d763981 Simplify the creation of arbitrary UPDATEs
The type parameters of Db\Driver::prepare() and the parameters of Db\Statement::run() can now be arrays, which will be iterated over recursively to bind scalar values to the SQL statement.

This simplifies the construction of arbitrary UPDATE statements (the WHERE clause no longer needs to be taken into account) and should make it clearer what is happening in these cases.

It should also simplify the creation of IN() clauses down the road if they become necessary.
2017-04-06 11:02:47 -04:00
f902346b6c Eliminated passing of RuntimeData instances
- RuntimeData has now been replaced by a single static Data class
- The Data class has a load() method which fills the same role as the constructor of RuntimeData
- The static Lang class is now an instantiable class and is a member of Data
- All tests have been adjusted and pass
- The Exception tests no longer require convoluted workarounds: a simple mock  for Data::$l suffices; Lang tests also use a mock to prevent loops now instead of using a workaround
2017-03-28 18:50:00 -04:00
7236020b8b Changed "NewsSync" to "Arsse" 2017-03-27 23:12:12 -05:00
2b7a236147 More database fixes
Now able to add feeds to the database
2017-03-02 22:43:59 -05:00
0c410fcf50 More binding tests and related changes
- Introduced abstract Statement class to hold common methods
- Common methods currently consist of a date formatter and type caster
- Moved binding tests to a trait for reuse with future drivers
2017-03-02 18:42:19 -05:00
1529fc367a Partial proper tests for parameter bindings
Null and (>0) integer tested so far

Many related changes to accomodate the necessary type juggling (required for databases other than SQLite).
2017-03-02 14:19:16 -05:00
337b2cf90c Remove last vestiges of PDO accomodation 2017-03-02 09:04:04 -05:00
c5fac33398 Converted all hard tabs to soft tabs 2017-02-16 14:29:42 -06:00
c213b5928d move code out of vendor tree into lib 2017-02-11 14:48:48 -05:00
Renamed from vendor/JKingWeb/NewsSync/Db/Driver.php (Browse further)