The behavior caches parameters by name and makes calls to Mysql stored procedures in a clean and more readable way.
Cache parameters to call Mysql stored procedures., (*1)
The behavior caches parameters by name and makes calls to Mysql stored procedures in a clean and more readable way., (*2)
Many calls to stored procedures are dirty and confusing, so I tried to put this in a better, hope you enjoy it and contribute if you think something could be better, I know I have to write some testing., (*3)
Load it in your table., (*4)
Call your procedure:, (*6)
$this->callSP('party_roles_relate', ['partyId'=>$partyId, 'roleName'=>User::$rolCode]);, (*7)
Call it with expressions:, (*8)
Create the query object.
$query = $this->find();, (*9)
Create the expression and pass it.
$this->callSP('party_roles_last_request', ['partyId'=>$partyId, 'updateTime'=>$query->func()->now(), 'roleName'=>User::$rolCode]);, (*10)
This will generate a query like this:, (*11)
CALL party_roles_relate('USER', '1'), (*12)
Called with expressions:, (*13)
CALL party_roles_relate_record ('Generator', NOW()), (*14)
A description of my procedure., (*15)
CREATE PROCEDURE party_roles_relate (IN roleName varchar (45), IN partyId int(11)), (*16)
NOTE: As you can see, order doesn't matter anymore :), (*17)
The MIT License (MIT), (*18)
Copyright (c) 2015 Geneller Naranjo, (*19)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:, (*20)
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software., (*21)
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE., (*22)