Commit graph

39 commits

Author SHA1 Message Date
Robin Appelman
778d8dbafd Add tableExists to public db api 2014-12-09 17:26:53 +01:00
Robin Appelman
8af3991d0c Add dropTable to IDBConnection 2014-12-09 17:26:53 +01:00
Joas Schilling
e1f3abf7a5 Correctly namespace and autoload DatabaseException 2014-11-27 11:10:04 +01:00
Dan Bartram
9c1015b790 Add missing DB rollback functionality 2014-10-24 17:44:06 +01:00
Robin Appelman
e6f6cdd19f Bit more cleanup 2014-10-22 12:29:53 +02:00
Robin Appelman
2ae6a0d96d Move creating the database connection to the server container 2014-10-22 12:29:53 +02:00
Robin Appelman
d4e929c37a Remove implicit prepared statement cache and get the connection from the server container in \OC_DB 2014-10-22 12:26:43 +02:00
Robin Appelman
2790bda4f8 Activate the query logger on connect 2014-10-20 13:38:37 +02:00
Duane Johnson
ccf440495e Ensure db connection before changing cache state
When trying to upgrade from 7.0.0 to 7.0.2, the manual upgrade path
(e.g. ` sudo -u www-data /usr/bin/php5 ./occ upgrade`) exits with the
following fatal error:

```
/var/www/owncloud# php occ upgrade
PHP Fatal error:  Call to a member function
  disableQueryStatementCaching() on a non-object in
  /var/www/owncloud/lib/private/db.php on line 423
```

This is caused by the self::$connection static variable having not
been initialized at the point of call. Adding a self::connect() fixes
the issue.

See https://forum.owncloud.org/viewtopic.php?f=29&t=23398&p=68556#p68556
2014-08-30 15:46:56 -06:00
Vincent Petry
10a29556b0 - Added test to trigger index id error
- re-enable encryption migration tests
- sqlite requires reconnect after schema changes
2014-07-14 16:20:09 +02:00
Andreas Fischer
9db0a82a26 We obviously have to pass the hostname as is when there is no ':' in the hostname.
This reverts commit 73062040e6.
2014-06-17 14:48:32 +02:00
Frank Karlitschek
87101e6638 Merge pull request #9018 from owncloud/dbms-socket-support
Refactor OC_DB::connect() to properly support sockets.
2014-06-13 18:09:51 +02:00
Andreas Fischer
73062040e6 Don't specify host when using a socket. 2014-06-12 20:22:45 +02:00
Andreas Fischer
0932760304 Rename variable to indicate that it can be port and socket. 2014-06-12 20:18:38 +02:00
Andreas Fischer
3d8eabedbd No need to check the port number as this will fail anyway. 2014-06-12 20:17:30 +02:00
Andreas Fischer
4ca1e3cc02 Move getValue() to where required. This actually is not required "global data". 2014-06-12 19:59:40 +02:00
Andreas Fischer
17c2e63449 Move check for : to where it belongs, getting rid of $socket = false; 2014-06-12 19:56:51 +02:00
Andreas Fischer
4b87586487 Extract common variables of $connectionParams. 2014-06-12 19:53:33 +02:00
Andreas Fischer
6da2beeaff Inline $port expression, getting rid of $port variable. 2014-06-12 19:48:37 +02:00
josh4trunks
1b02991a1d Fixes based on suggestions
I use the term socket for any extension, either unix socket, or internet socket (port).

I check if the socket is all digits
* only integers 0 and larger would pass this test.
I then check if the string is less than or equal to the maximum port number.

By using "if($socket)" I make sure socket isn't false, empty, or the string '0'.

I don't believe I need to initialize $port because $port will always be set if $socket is true. Please show me if I am wrong here. Thanks
2014-06-11 21:47:45 -07:00
josh4trunks
ea162c8a39 Fix variable not always being defined. 2014-06-04 23:03:13 -07:00
josh4trunks
e77c9bb97e Work with MySQL Sockets
This passes anything that is not a valid port (0<int<65535) as a unix socket.
I tested this with unix sockets; this needs to be tested with a non-standard mysql port as well but I don't foresee any issues.

To use a unix socket, even one different than PHP's mysql.default_socket..
* Database Host = localhost:/path/to/socket
2014-06-04 22:50:23 -07:00
Vincent Petry
d4ffafe467 Removed simulate db update flag and split into separate methods 2014-06-04 18:17:46 +02:00
Vincent Petry
5b97369b00 Simulate apps database schema update on upgrade
When upgrade, also simulate the database schema update for apps before
doing the actual upgrade.
2014-06-04 17:16:44 +02:00
Thomas Müller
999f6216dc - fix dropTable() and introduce tableExists()
- kill replaceDB() - this function is unused and it's implementation obviously wrong
- add method annotation OC_DB_StatementWrapper::fetchAll
- remove duplicate code in Test_DBSchema and reuse OC_DB::tableExists
- remove unused variables
2014-05-30 23:34:42 +02:00
Thomas Müller
b6d2d6329d Merge pull request #8639 from owncloud/drop-brief
Remove all occurences of @brief and @returns from PHPDoc
2014-05-19 20:18:32 +02:00
Morris Jobke
dc36d30953 Remove all occurences of @brief and @returns from PHPDoc
* test case added to avoid adding them later
2014-05-19 17:50:53 +02:00
Frank Karlitschek
090d127050 Merge pull request #6457 from owncloud/db-convert-tool
Command line tool to convert current database to others, except sqlite
2014-05-19 16:41:31 +01:00
Robin McCorkell
87b548ed91 Fix all PHPDoc types and variable names, in /lib 2014-05-13 19:08:14 +01:00
Andreas Fischer
78ee4c1327 Merge remote-tracking branch 'owncloud/master' into db-convert-tool
* owncloud/master: (137 commits)
  add comment to clearify when a skip in the foreach happens
  remove obsolete code
  Always define sendmail_is_available
  [tx-robot] updated from transifex
  Make hardcoded exception messages translatable
  Disable sharing in trashbin app
  class Test_Config is already declared
  [tx-robot] updated from transifex
  using array_key_exists() instead of isset() - required because in case the value is null isset is returning false
  fixing undefined exception classes
  unit test testSetAppValueIfSetToNull() added
  unit tests for dynamic backend registration
  ignore underscore.js in scrutinizer.yml
  adding ownCloud globals to jshintrc: OC, t, n
  Use git checkout on directory as some files may not be in git resulting in, e.g.:
  adding underscore.js
  reduce code duplication, fix parse error, prevent page reload on hitting enter while changing the display name - refs #8085
  translations for oc-dialogs reside in code
  Fix copy conflict dialog translation
  [tx-robot] updated from transifex
  ...
2014-04-09 15:20:18 +02:00
Andreas Fischer
f9853b253c Deduplicate connection handling code into \OC\DB\ConnectionFactory 2014-03-31 20:09:07 +02:00
Bart Visscher
35a8dfb2fa More PHPDoc fixes, using scrutinizer patches as hints 2014-02-28 13:53:41 +01:00
Scrutinizer Auto-Fixer
adaee6a5a1 Scrutinizer Auto-Fixes
This patch was automatically generated as part of the following inspection:
https://scrutinizer-ci.com/g/owncloud/core/inspections/cdfecc4e-a37e-4233-8025-f0d7252a8720

Enabled analysis tools:
 - PHP Analyzer
 - JSHint
 - PHP Copy/Paste Detector
 - PHP PDepend
2014-02-19 09:31:54 +01:00
Thomas Müller
c6f4f85e27 Merge branch 'master' into scrutinizer_documentation_patches
Conflicts:
	lib/private/migration/content.php
2014-02-18 18:31:33 +01:00
Jörn Friedrich Dreyer
2a6a9a8cef polish documentation based on scrutinizer patches 2014-02-06 17:02:21 +01:00
Bart Visscher
8f0c56c1b2 Merge branch 'master' into fix-5388-master 2013-12-16 22:38:22 +01:00
Andreas Fischer
cdd182ce35 Send "SET NAMES utf8" to MySQL for PHP below 5.3.6 2013-12-11 00:19:51 +01:00
Bart Visscher
9adff4f7f5 Change OC_Migrate from MDB2 to Doctrine 2013-11-22 15:53:56 +01:00
Thomas Müller
9c9dc276b7 move the private namespace OC into lib/private - OCP will stay in lib/public
Conflicts:
	lib/private/vcategories.php
2013-09-30 16:36:59 +02:00
Renamed from lib/db.php (Browse further)