uepg / laravel-sybase

Connection and Laravel Eloquent driver for Sybase
GNU General Public License v2.0
33 stars 16 forks source link

Missing of Wherein and whereNotIn query handling #70

Open khleung opened 3 years ago

khleung commented 3 years ago

I found the latest version never handled the Wherein and whereNotIn clause in the coding the "values" of $wheres was overlooked. Bindings values were being omitted and caused errors:

To make my Wherein and whereNotIn clauses works, I added the followings missing coding into if statement of private function compileForSelect(Builder $builder, $bindings) :

 } else if (
                isset($wheres[$ind]['values']) &&
                isset($tipos[strtolower($wheres[$ind]['column'])])
            ) {
                if (is_array($wheres[$ind]['values'])) {

                    foreach ($wheres[$ind]['values'] as $value) {
                        if (
                            in_array(
                                strtolower($tipos[
                                    strtolower($wheres[$ind]['column'])
                                ]),
                                $this->withoutQuotes
                            )
                        ) {
                            if (!is_null($bindings[$i])) {
                                $newBinds[$i] = $bindings[$i] / 1;
                            } else {
                                $newBinds[$i] = null;
                            }
                        } else {
                            $newBinds[$i] = (string) $bindings[$i];
                        }
                        $i++;
                    }
                }
            }
        }
nunomazer commented 3 years ago

Thanks @khleung, I'll analyse it next week

murbagus commented 3 years ago

hello, have you fix it?

jcrodriguezt commented 2 years ago

Thanks @khleung your proposal worked for me.