# |
Dec 18th 2017, 11:10 |
hmic |
but yes, every *invocation* of a script - every request cycle, initiates (a) new connection(s) |
# |
Dec 18th 2017, 11:10 |
hmic |
makallio85: i dont get that |
# |
Dec 18th 2017, 11:09 |
makallio85 |
This causes for me over 400 connections made to mysql server, when try just run some simple scripts :) |
# |
Dec 18th 2017, 11:08 |
makallio85 |
I run just single php instance and i have 42 database in my setup. 3 connections defined and 40 of those share the same connection name. Connection is switched by dropping existing from ConnectionRegistry and setting it again with different table name. |
# |
Dec 18th 2017, 11:02 |
neon1024 |
Friday 22nd |
# |
Dec 18th 2017, 10:40 |
birdy247 |
@neon1024 when is your last day |
# |
Dec 18th 2017, 10:29 |
birdy247 |
:+1: |
# |
Dec 18th 2017, 10:28 |
neon1024 |
Happy Holidays! |
# |
Dec 18th 2017, 10:28 |
neon1024 |
Morning everyone |
# |
Dec 18th 2017, 10:22 |
hmic |
i consider that rather a hack than a solution anyways. |
# |
Dec 18th 2017, 10:21 |
hmic |
- given we are talking mysql only |
# |
Dec 18th 2017, 10:21 |
hmic |
but your user needs to be able to access all of them in this case. |
# |
Dec 18th 2017, 10:20 |
hmic |
there might be another option, which is use multiple databases by just providing the database name in the table instances tablename like: database.table |
# |
Dec 18th 2017, 10:19 |
hmic |
reduce the amount of concurrent php tasks, or up the connection limit accordingly. |
# |
Dec 18th 2017, 10:18 |
hmic |
makallio85: if you reach the maximum connection limit on any of these databases, its the same scenario as if you are talking one database. |
# |
Dec 18th 2017, 10:18 |
hmic |
so, if you are having too many connections, you need to lower the amount of php instances. thats all. |
# |
Dec 18th 2017, 10:17 |
makallio85 |
Not for multiple tables, but for multiple databases |
# |
Dec 18th 2017, 10:17 |
hmic |
that would not make much sense anyways, as you want transactions to spawn multiple tables of course and transactions are connection bound. |
# |
Dec 18th 2017, 10:17 |
hmic |
makallio85: so far i am concerned, there is only one connection per php instance/request in cake. not multiple ones for multiple tables |
# |
Dec 18th 2017, 10:16 |
makallio85 |
I am struggling currently with amount of mysql connections, that are reaching quite fast default limit, when you have sharded database. Currently I am replacing whole connection object in registry, but I was wondering, that I could keep existing connection if I just change table. |
# |
Dec 18th 2017, 10:15 |
willem |
if i do some query like this ``` ->where( [ 'OR' => [ 'description LIKE' => '%' . $search_term . '%', ``` does Cake sanitize the search term for me? |
# |
Dec 18th 2017, 10:15 |
a.francazi |
ah nice, alrdy found what I needed :slightly_smiling_face: |
# |
Dec 18th 2017, 10:15 |
qq |
File uploaded https://cakesf.slack.com/files/U1B977RSB/F8G5DTU12/hi_guys__how_to_do_a_condition_with_contain_option_in_get_function.php / https://slack-files.com/T053DPNCM-F8G5DTU12-6ffeab51e0 |
# |
Dec 18th 2017, 10:13 |
makallio85 |
Hmm. Is there any reason, why there is no way to alter database table for existing connection object in connection registry? Or is it just something that could be implemented, but is not yet done? |
# |
Dec 18th 2017, 10:11 |
a.francazi |
ah ok thx, I'll look into it |
# |
Dec 18th 2017, 10:05 |
dereuromark |
https://book.cakephp.org/3.0/en/orm/validation.html#applying-application-rules |
# |
Dec 18th 2017, 10:05 |
dereuromark |
ideally you have both, DB is the last instance failing hard, but your domain rules in the table class will prevent this hard fail :slightly_smiling_face: |
# |
Dec 18th 2017, 10:04 |
dereuromark |
domain rules |
# |
Dec 18th 2017, 09:59 |
a.francazi |
I have a db-table with composite unique index, to allow only one combination of user_id and post_id (voting-system). So when I'm running the $this->Votes->save() method I get Error: SQLSTATE[23000]: Integrity constraint violation, rather than the save-method returning false. So the SQL-Errror breaks the whole script instead of the save-method returning false and I can't do any error handling. Why's that? |
# |
Dec 18th 2017, 09:30 |
joop |
should i add additional infos? like provider? |
# |
Dec 18th 2017, 09:30 |
joop |
'rule'=>ValidCount('Tests','points'); |
# |
Dec 18th 2017, 09:29 |
joop |
but i get Call to undefined function when try to call it |
# |
Dec 18th 2017, 09:28 |
joop |
i placed my custome rule to the ORM\Rule\Rulename.php |
# |
Dec 18th 2017, 08:59 |
joop |
okey thank you hmic |
# |
Dec 18th 2017, 08:51 |
hmic |
joop: because the ownedbycurrentuser does not know where it is called from |
# |
Dec 18th 2017, 08:46 |
joop |
so if we are in the Battle model why he pass the 'Battle' |
# |
Dec 18th 2017, 08:45 |
joop |
but in this case why he use : $rule = new OwnedByCurrentUser('Battles', $userId); |
# |
Dec 18th 2017, 08:45 |
joop |
my though is in the id field of Battle table |
# |
Dec 18th 2017, 08:44 |
joop |
where he actually use this validation rule |
# |
Dec 18th 2017, 08:44 |
joop |
its not 100% clear |
# |
Dec 18th 2017, 08:44 |
joop |
can someone help me a bit in this tutorial : http://josediazgonzalez.com/2015/12/16/custom-validation-rule-classes/ |