Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up AppFramework database layer #14467

Closed
BernhardPosselt opened this issue Feb 24, 2015 · 2 comments
Closed

Clean up AppFramework database layer #14467

BernhardPosselt opened this issue Feb 24, 2015 · 2 comments

Comments

@BernhardPosselt
Copy link
Contributor

The current approach adds more abstraction that is currently needed which makes it harder to debug database related issues. Furthermore there are problems with our internal API (Statement Wrapper) whose multiple return types (bool, Statement) cause some headaches when trying to close cursors properly for the most common cases, see #14459

Current status

Currently the classes that you typically use are called in the following order when running a method on the mapper class

  • Mapper
  • IDb
  • Db
  • StatementWrapper
  • IDBConnection
  • Connection

The goal is to get it down to this:

  • Mapper
  • IDBConnection
  • Connection

How can we do this?

Instead of requiring an instance of IDb for the Mapper, we are going to require an IDBConnection. In order to stay compatible until this can be removed after deprecation, we are going to do the following:

  • Deprecate IDb and Db
  • IDb inherits from IDBConnection
  • Db will forward calls to IDBConnection using the __call method (much like this here: https://github.com/owncloud/core/blob/master/lib/private/db/statementwrapper.php#L47) or just proxy it if required by the interface. Previous methods on the class itself will keep working, but will be deprecated
  • Mapper class will be adjusted to use IDBConnection and the methods on that class
  • Statementwrapper will be removed from Db

At some point we will be able to return an instance of IDBConnection from the ServerContainer instead of IDb to finish the migration and finally remove the code.

@DeepDiver1975 @MorrisJobke @PVince81 @LukasReschke @butonic @icewind1991 @georgehrke @jbtbnl

@BernhardPosselt
Copy link
Contributor Author

PS: as for the statement wrapper class:

@BernhardPosselt
Copy link
Contributor Author

Hm, migration is even easier, just use OCP\IDBConnection in the mapper constructor instead of OCP\IDb ^^

@MorrisJobke MorrisJobke added this to the 8.1-next milestone Feb 26, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Aug 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants