core icon indicating copy to clipboard operation
core copied to clipboard

[DB] - OC_DB::rollback() seems to be missing

Open pf18387 opened this issue 12 years ago • 7 comments

There is a \OCP\DB::beginTransaction() There is a \OCP\DB::commit() But there is no \OCP\DB::rollback() :collision: the database may be left in an unstable state, hard to recover.

https://github.com/owncloud/core/blob/master/lib/public/db.php https://github.com/owncloud/documentation/blob/2ec72ebbb28c7bd0b9f41bbf088c1ee53953eaca/developer_manual/app/app/database.rst

ownCloud 6.0.4 (stable)
php 5.4.4-14+deb7u12
MySQL 5.5.37-0+wheezy1
debian 7.6 (wheezy) 32 bits

pf18387 avatar Jul 23 '14 15:07 pf18387

Thanks a lot for your report! - Should be an easy job -> assigning junior label

DeepDiver1975 avatar Jul 23 '14 15:07 DeepDiver1975

I'm not 100% sure this is the correct fix, but I've committed a fix in my own fork to add the missing rollback method.

However, I'm not sure on the correct naming to use and whether this is the full fix or only a part fix.

Naming Confusion

There is an interface named IDBConnection [code] which uses the name rollBack (using camelCase) instead of the name rollback as it appears in other classes. However, I cannot see a relationship between the OC_DB class and the IDBConnection class, but I may just have made a mistake or missed it somewhere.

The class \OC\DB\Connection [code] extends \Doctrine\DBAL\Connection. The Doctrine docs for this class use the method name rollback (not in camelCase).

What should the correct name for the rollback method be? rollback or rollBack?


I just wanted to check whether this commit is correct and:

  • uses the correct naming standards
  • fully implements the missing method everywhere in all the relevant classes

before I submit a PR with half-ready code.

danbartram avatar Oct 18 '14 13:10 danbartram

@MorrisJobke please could you check if my thinking in the above comment is correct?

danbartram avatar Oct 23 '14 22:10 danbartram

@DeepDiver1975 Can you check that? I'm confused by all those static classes and inheritance stuff. Also it seems that the interface (IDBConnection) is partly covered by our code and partly covered by doctrine code. Is this correct?

MorrisJobke avatar Oct 23 '14 23:10 MorrisJobke

@danbartram please submit your change as pull request - we will review the change then. from the first look it seems to be the way to go. THX

DeepDiver1975 avatar Oct 24 '14 08:10 DeepDiver1975

@DeepDiver1975 Will do, just wanted to check if there was an obvious missed function declaration. I've submitted a PR now, we'll see how it goes. Thank you (and @MorrisJobke too)!

danbartram avatar Oct 24 '14 16:10 danbartram

fixed in #11767

MorrisJobke avatar Oct 24 '14 17:10 MorrisJobke