[Gravity]: Add options setter

Review Request #534 — Created Oct. 30, 2017 and submitted

p.valk
Lunr
Gravity_options
535
d6cbfeb...
lunr
Gravity: Add options setter

unittests.

  • 0
  • 0
  • 16
  • 0
  • 16
Description From Last Updated
tardypad
  1. LGTM

  2. 
      
p.valk
smillernl
  1. 
      
  2. What does 1 mean here?

    1. set setting true, can also replace it with true if better readable?

  3. Might be better to report a status here.

    1. ok, so something as in report false when already connected?

  4. 
      
pprkut
  1. 
      
  2. Did you actually test that this is working?

    1. yes, tested in a prototype and it works.
      will also write unittests for this.

    2. Hint: The code as is doesn't work

    3. ah i see it.

    4. nope, still broken

    5. nope, still broken

    6. what is still broken about it now?

  3. 
      
p.valk
p.valk
smillernl
  1. 
      
  2. This would suggest [MYSQLI_OPT_INT_AND_FLOAT_NATIVE, MYSQLI_OPT_INT_AND_FLOAT_NATIVE] is a correct usage of the function but the code suggests it isn't.

    1. do we have a way to tell its a key value array or should i just add an example in commemt?

    2. You could use more words to describe the type of array.

  3. 
      
p.valk
p.valk
smillernl
  1. 
      
  2. Besides your choice in programming language for TRUE and False, this is wrong.

  3. 
      
pprkut
  1. 
      
  2. we still need a way to opt out though

    1. well just call $this->set_options([MYSQLI_OPT_INT_AND_FLOAT_NATIVE => FALSE]);

    2. sure, that's fine. But we need to be able to do that from the locator recipe

  3. 
      
p.valk
p.valk
p.valk
p.valk
pprkut
  1. 
      
  2. Set the value in the constructor please

  3. Revert the formatting

  4. I'd just make it set_option() and make it take key and value. That way we know it's always gonna be an array

  5. 
      
p.valk
smillernl
  1. 
      
  2. why not check strictly?

  3. This would just set a singular option right?

    which is it?
    - "Set options for the current connection"
    - "array $options"
    - "set_option($options)"

  4. 
      
p.valk
p.valk
pprkut
  1. 
      
  2. why not set_option($key, $value)?

  3. 
      
p.valk
pprkut
  1. 
      
  2. src/Lunr/Gravity/Database/MySQL/MySQLConnection.php (Diff revision 14)
     
     
     
     
     

    what are you trying to accomplish here?

    1. protection to see if the values are set/not empty.
      and can't use empty() check because the value could be false. (key could be checked with empty())

    2. Well, the values are set, because if they are not, PHP errors with a missing argument error.
      Which leaves invalid values. The key check can be simplified is !is_int(). The value check IMHO isn't really necessary, but if you insist you should just only do a NULL check.

  3. 
      
p.valk
pprkut
p.valk
p.valk
smillernl
  1. Ship It!
  2. 
      
p.valk
Review request changed

Status: Closed (submitted)

Change Summary:

Merged into master

Loading...