Commit graph

534 commits

Author SHA1 Message Date
José Lorenzo Rodríguez
df5fc2304a Merge pull request #2289 from bar/2.5-optimize-dbosource
First part of the DboSource cleanup.
2013-11-21 01:02:36 -08:00
imsamurai
f817beb8b6 change method public unsigned to protected _unsigned 2013-11-19 10:55:44 +02:00
ADmad
dda6080579 Merge branch 'master' into 2.5 2013-11-19 00:27:12 +05:30
imsamurai
8bcfe452da not add unsigned to not numeric fields, fix broken test, add new test 2013-11-17 23:10:53 +02:00
imsamurai
2f6122cb01 add unsigned property in Model::describe 2013-11-17 22:37:01 +02:00
imsamurai
00fb663f90 remove numeric from unsigned config 2013-11-17 21:23:13 +02:00
imsamurai
1d9ecc6c94 Merge upstream/2.5 into 2.5 2013-11-17 21:13:25 +02:00
mark_story
b6b8d83980 Remove non-portable data type from MySQL.
'numeric' is a non-portable type that is not supported by any other
database driver. Removing it now will prevent future problems.
2013-11-14 10:28:09 -05:00
imsamurai
f1a2c1a75c add decimal type for unsigned 2013-11-14 10:56:51 +02:00
imsamurai
7bc8dac453 fix phpcs errors 2013-11-14 02:19:41 +02:00
imsamurai
fd64d952b5 change position from afterDefault to beforeDefault during to wrong order, add test 2013-11-14 01:36:27 +02:00
imsamurai
e35823e72a fix tests, add numeric type for unsigned 2013-11-14 01:33:11 +02:00
imsamurai
2fcb4c3c6c - change check to strict for options of $fieldParameters
- add `types` parameter and strict check if it present in `$fieldParameters` (if it present and not contain column type field parameter will be skipped)
- add `noVal` parameter to `$fieldParameters` if it present and not empty value of this parameter from column will be ignored
- add `unsigned` column type for integer, float and biginteger. If it set to `true` an 'UNSIGNED' will be add in sql column part, if not set or set not to `true` this parameter will be skipped
2013-11-14 01:11:30 +02:00
Marc Würth
7cfa0116f4 Removed "PHP 5" from file header DocBlocks
This statement does not serve a purpose anymore.
In a long forgotten world it indicated the main version number of PHP which the code in the file was compatible to.
http://pear.php.net/manual/en/standards.sample.php
But since PHP 5.1 and later this is only marginally true.
Thus I propose to remove it from CakePHP.
2013-11-13 22:58:39 +01:00
Ber Clausen
ed142d8c89 Add missing type hints. 2013-11-13 00:09:45 -03:00
Ber Clausen
0e74a0757a Keep insertQueryData() DRY, issue less lookups. Remove unused $assocData
and $LinkModel from the signature.
Model objects should be CamelCase.
2013-11-13 00:09:39 -03:00
Ber Clausen
52d425737a Call getDataSource() instead of the directly calling
ConnectionManager::getDataSource().
2013-11-12 03:38:47 -03:00
Ber Clausen
c1f3d9c274 Model objects should be in CamelCase. 2013-11-12 01:37:38 -03:00
Ber Clausen
014d2dd2d9 Remove 'self' key from getConstraint() calculations because it is not necessary anymore. 2013-11-12 01:30:57 -03:00
Ber Clausen
e658e071d1 Remove unused variable from the signature. 2013-11-12 01:17:11 -03:00
Ber Clausen
67a65663a7 Assign before actually using it. 2013-11-12 01:13:55 -03:00
Ber Clausen
026565033b Model objects variables should be CamelCase. 2013-11-12 00:49:06 -03:00
Ber Clausen
6b8a79be6d Remove reference from the signature. 2013-11-12 00:29:36 -03:00
Ber Clausen
cb42b056ac Remove the 'Line indented incorrectly' PHPCS error. 2013-11-12 00:08:39 -03:00
Ber Clausen
7f570f33e4 Unindent, and remove unnecessary getDataSource() call.
Also, objects should be CamelCase.
2013-11-12 00:01:18 -03:00
Ber Clausen
b35c9671ad Explicitly build SQL statements, calling buildAssociationQuery(). 2013-11-11 23:27:50 -03:00
Ber Clausen
f0fcaa1305 Improve generateAssociationQuery():
* bail early when $linkModel is Null (BC for now).
* move SQL fields warmup and SQL statement building to its own functions
 (it will payoff later improving self documentation and readability).
* make assignments and function calls only when needed (depending on the
 association type).
2013-11-11 23:27:50 -03:00
Ber Clausen
dcadfcbcab Remove inline assignment. 2013-11-11 23:27:50 -03:00
Ber Clausen
53c6df554c Remove unused $resultSet argument from generateAssociationQuery(). 2013-11-11 23:27:50 -03:00
Ber Clausen
5da05d9216 Remove unneeded test inside conditional. 2013-11-11 23:27:50 -03:00
Ber Clausen
f16695db5f Move variables to logical blocks.
Unindent to ease readability, and avoid assigning variables when
unneeded.
Free a little memory before entering to recursive intensive loops.
2013-11-11 23:27:50 -03:00
Ber Clausen
fdb4b11d0b Remove unnecessary call to getDataSource(). 2013-11-11 23:27:50 -03:00
Ber Clausen
c9e0131d6a Only generate query data for hasOne and belongsTo associations.
Avoid calling generateAssociationQuery():

* when the return value will never be usefull (True in this case)
* to avoid polluting $queryData with uneeded fields

Later, the SQL statement for the primary, and 'hasOne' plus 'belongsTo'
relationships, is built.
2013-11-11 23:27:50 -03:00
Ber Clausen
2532228844 Improve readability and optimize minimizing variable lookups. 2013-11-11 23:27:49 -03:00
Kim Egede Jakobsen
18e0dc95dd Remove @return from docblock (for __construct && __destruct methods) 2013-11-11 14:54:48 +01:00
mark_story
afd182898f Merge branch 'master' into 2.5 2013-11-01 16:54:57 -04:00
mark_story
9e4ac31dc3 Correctly identifier quote column names before adding them to queries.
Closes #2248
2013-10-31 19:53:42 -04:00
mark_story
aaac360833 Merge branch 'master' into 2.5 2013-10-30 14:58:20 -04:00
Zach Gambino
927a4933d1 Fix for #2247 | Use correct column when calculating next sequence value
See #2247 for more details.
2013-10-30 11:25:06 -07:00
mark_story
16be5722ba Fix COUNT(DISTINCT x) queries from getting corrupted in Sqlserver.
Add into the tower of hacks that is the SQL generation and stop breaking
COUNT(DISTINCT foo) style queries. Previously these would be converted
into DISTINCT COUNT(foo) which will give the non-distinct results.
2013-10-29 23:01:55 -04:00
mark_story
0f8dae55c9 Add missing trim() around Sqlserver queries.
This solves issues with queries failing.

Fixes #2222
2013-10-29 23:01:49 -04:00
ADmad
d9ca148499 Merge branch 'master' into 2.5
Conflicts:
	CONTRIBUTING.md
	lib/Cake/Model/Model.php
	lib/Cake/VERSION.txt
2013-10-30 02:34:09 +05:30
mark_story
a098ff28b8 Update doc block and remove inline assignment. 2013-10-29 12:32:20 -04:00
Robert Sworder
940a51b5fa Update definition of an empty model. 2013-10-25 15:12:03 +01:00
Frank de Graaf
ab89f6ec97 Makes DboSource less string dependent. 2013-10-22 16:43:32 +02:00
Mark Story
ce74153389 Merge pull request #1691 from uzyn/2.5-decimal
Add support for decimal type in Schema.

Fixes #3171
2013-10-14 08:36:15 -07:00
Jose Lorenzo Rodriguez
9673048c30 Merge branch 'master' of github.com:k-halaburda/cakephp into k-halaburda-master 2013-10-12 01:03:20 +02:00
José Lorenzo Rodríguez
8cdbafd312 Merge pull request #1631 from ovidiupruteanu/patch-2
flushMethodCache not working if called before cacheMethod
2013-10-11 15:56:19 -07:00
José Lorenzo Rodríguez
6c2eb6e7c6 Merge pull request #1546 from rchavik/2.3-sqlite-truncate
Sqlite::truncate(): Verify `sqlite_sequence` exists before _execute()
2013-10-11 15:52:49 -07:00
U-Zyn Chua
e527506c39 MySQL: Numeric data type now supported under decimal column. #3171 2013-09-28 23:05:53 +08:00
U-Zyn Chua
73cae88a6f SQL Server support of numeric type. #3171
Float & real map to float. Numeric & decimal map to numeric.
2013-09-28 22:48:37 +08:00
U-Zyn Chua
c74c8d49a1 Decimal support for SQLite. #3171 2013-09-28 14:36:55 +08:00
U-Zyn Chua
a1a3e70039 Decimal support for PostgreSQL. #3171 2013-09-28 14:07:00 +08:00
Bryan Crowe
bb65765d70 Updated additional references of Cake to CakePHP 2013-09-27 21:31:35 -04:00
U-Zyn Chua
7fb51ab50f Decimal support for MySQL. #3171 2013-09-28 09:23:46 +08:00
Andy Hobbs
0f7d6a90a1 Ticket 4108
- Added schemaName to DboSource::fields() method cache key to fix bug with changing schema name
2013-09-26 11:56:14 +01:00
ber clausen
39bc8dff97 Wrong signature. 2013-09-25 09:12:49 -03:00
Bryan Crowe
7d7954ce18 Replaced all is_a() calls with instanceof operator 2013-09-24 21:08:06 -04:00
euromark
653aed7701 is_a() to instance of - completes PR 1669 2013-09-24 22:57:51 +02:00
euromark
382f75dbfc cs corrections, bool to boolean and int to integer. 2013-09-17 14:44:34 +02:00
ovidiupruteanu
f416a321c7 flushMethodCache not working if called before cacheMethod
When calling flushMethodCache it correctly empties self::$methodCache but if cacheMethod is called afterwards self::$methodCache gets populated with data from the Cache.
2013-09-12 22:02:39 +03:00
Marc Würth
446792987a Replaced two elseifs by if in sqlserver datasource 2013-09-11 23:15:05 +02:00
ovidiupruteanu
b58940e9b5 Fixed handling null values in Sqlserver->value
The value function quoted a null value as N'' instead of NULL.
As a result is produced queries like [name] IS N'' instead of [name] IS NULL which resulted in an SQL error.
2013-09-09 16:33:54 +03:00
euromark
959988cfa1 Remove last yoda conditions as per coding standards guidelines. 2013-09-06 18:36:57 +02:00
Mark Story
0f528c279a Merge pull request #1614 from okinaka/2.x-disused-code
Postgres::truncate(): Delete disused code.
2013-09-05 18:16:22 -07:00
mark_story
6a6371b2d4 Fix CROSS JOINs
While seldomly used, CROSS joins should not generate invalid SQL.

Fixes #4050
2013-09-05 12:45:48 -04:00
okinaka
e0f24d0ade Postgres::truncate(): Delete disused code. 2013-09-05 14:11:50 +09:00
mark_story
f18d354f55 Merge branch 'master' into 2.4 2013-08-28 12:35:07 -04:00
mark_story
c1ae41da51 Correctly generate bigint primary keys in sqlite.
generate bigint primary keys correctly. Autoincrement cannot be set as
it only works with INTEGER columns[1]. I decided to use some string
manipulations as the entire SQL generation bits are a bit janky and I've
already re-written them for 3.0.

[1] https://www.sqlite.org/autoinc.html

Closes #GH-1552
2013-08-27 18:11:04 -04:00
mark_story
53d265cfba Merge branch 'master' into 2.4 2013-08-23 12:56:43 -04:00
mark_story
faa2cbd3c3 Remove session.auto_start configuration.
It now fails in PHP >= 5.5.2 . Also it never did anything in earlier
versions as the session would have already been started if auto_start
was true.

Fixes #4010
2013-08-21 13:18:44 -04:00
Rachman Chavik
9d8bb8c047 Sqlite::truncate(): Verify sqlite_sequence exists before _execute()
`sqlite_sequence` is a dynamic table that's only available when a table in
the database use an auto increment field.  For some cases, eg: databases that
exclusively use uuid for primary keys, this table won't exist and
truncate() call will fail with:

  Error: SQLSTATE[HY000]: General error: 1 no such table: sqlite_sequence
2013-08-21 16:34:21 +07:00
mark_story
0f2d59d987 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Network/CakeResponse.php
	lib/Cake/TestSuite/CakeTestCase.php
2013-08-18 23:10:08 -04:00
euromark
6cf147e8c8 unify null checks - avoid method call in favor of strict check 2013-08-16 20:12:49 +02:00
dmromanov
7989bad5b7 Corrected codestyle 2013-08-16 14:12:27 +04:00
dmromanov
56ef44f495 Excluded method names from several tanslation strings
Removed unnecessary sprintfs
2013-08-16 13:42:28 +04:00
k-halaburda
0c1dbded67 Added some test for related model afterFind callback 2013-08-13 10:19:48 +02:00
k-halaburda
bb13af683b Added some test for related model afterFind callback 2013-08-13 10:19:20 +02:00
mark_story
26769edd04 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Utility/CakeTime.php
	lib/Cake/VERSION.txt
2013-08-12 14:39:02 -04:00
mark_story
6ce10b28c9 Update doc blocks. 2013-08-12 14:37:43 -04:00
k-halaburda
74eb32696a Some more space / tabs issues [Travis PHPCS=1 fail] 2013-08-09 11:51:19 +02:00
k-halaburda
2655d16c13 Fixed tabbing in some places 2013-08-09 11:17:12 +02:00
k-halaburda
3855c0690e Fixed tabing formating 2013-08-09 10:26:44 +02:00
k-halaburda
c033df3218 Fixed duplication of Model's afterFind callback in HABTM relation and content of array passed to that callback [ticket 3970] 2013-08-09 09:56:33 +02:00
mark_story
2d2721d2d9 Update docs for MySQL
MySQL supports a few non-standard options. Document them.
2013-07-19 23:01:16 -04:00
Mike Scarborough
c780ded512 add SSL support to MySQL PDO connections 2013-07-19 22:56:51 -04:00
euromark
7a1a3e593d Always create user agent hash in session 2013-07-18 12:02:42 +02:00
mark_story
e03d3df0fe Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Test/Case/View/HelperTest.php
	lib/Cake/VERSION.txt
2013-07-17 22:40:09 -04:00
Phally
1fe424a62b Moves code out of the try/catch blocks in the connect() methods.
That code wouldn't throw a PDOException, so having it in the
try/catch block is pointless. Moving it out makes it easier to
read.
2013-07-15 12:59:46 +02:00
ADmad
d161b21ae1 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Controller/Component/AuthComponent.php
2013-07-14 10:58:55 +05:30
euromark
a643295e4c remove @access and unnecessary $name 2013-07-08 15:50:50 +02:00
ADmad
4ded269549 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Controller/Component/Auth/BlowfishAuthenticate.php
	lib/Cake/VERSION.txt
2013-07-07 12:22:12 +05:30
euromark
e7f380d2b7 doublespace to single space 2013-07-05 14:36:40 +02:00
euromark
c989624f80 whitespace coding standards 2013-07-05 14:15:18 +02:00
mark_story
c597855fe4 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Test/Case/Network/CakeRequestTest.php
2013-07-03 14:21:09 -04:00
euromark
a90cb29c0f simplify else cases 2013-07-03 01:14:41 +02:00
euromark
7cb19b97db coding standards and simplification of else cases as well as some minor fixes 2013-07-03 00:52:48 +02:00
Jose Lorenzo Rodriguez
58149f2315 Backporting from 2.4 fix for booleans in mysql when running PHP 5.5 2013-07-02 16:51:29 -04:30
Marc Würth
ff1f80349a Removed superfluous break
In every case of the if clause it will return, so break is not needed.
2013-07-02 21:00:24 +02:00
mark_story
f09693f6e8 Merge branch 'master' into 2.4 2013-06-29 23:26:26 -04:00