yajra / pdo-via-oci8

PHP PDO_OCI functions via OCI8 extension
Other
88 stars 61 forks source link

Laravel push queue fail #33

Open holyblue opened 8 years ago

holyblue commented 8 years ago

I used the laravel function to push a database queue and got some error below. Error Code : 1438 Error Message : ORA-01438: value larger than specified precision allowed for this column Position : 109 Statement : insert into jobs ("queue", attempts, reserved, reserved_at, available_at, created_at, payload) values (:p0, :p1, :p2, :p3, :p4, :p5, :p6) returning id into :p7 Bindings : [default,0,0,,1470367614,1470367614,{"job":"Illuminate\Queue\CallQueuedHandler@call","data":{"commandName":"LendingFront\Jobs\SendSmsJob","command":"O:28:\"LendingFront\Jobs\SendSmsJob\":4:{s:10:\"connection\";N;s:5:\"queue\";N;s:5:\"delay\";N;s:6:\"\u0000*\u0000job\";N;}"}},0]

I find the error is occur in "Yajra\Pdo\Oci8\Statement" "bindParam" function, when case PDO::PARAM_INT the bind value is not the current value.

123

The second record is the after bind value and the first record is the correct value.

I change the $ociType To SQLT_CHR then every thing is correct. case PDO::PARAM_INT: $ociType = SQLT_CHR; break; I don't know this is the bug or some thing else. Could you help me ?

yajra commented 8 years ago

@holyblue what version are you using? This issue was already fixed in the framework v5.2. See this issue https://github.com/yajra/laravel-oci8/issues/170

holyblue commented 8 years ago

I think it's not the same problem. my env lsit: database: oracle 12c Laravel Framework version 5.2.39 "Yajra/laravel-oci8": "^5.2", PHP Version 7.0.4RC1 oci8 OCI8 Support enabled OCI8 DTrace Support disabled OCI8 Version 2.1.0 Revision $Id: 86f22a208f89dcd5b305e82929a7429683968b11 $ Oracle Run-time Client Library Version 12.1.0.2.0 Oracle Compile-time Instant Client Version 12.1

plip14 commented 7 years ago

I'm encountering the same problem.

Error Code : 1438
Error Message : ORA-01438: value larger than specified precision allowed for this column
Using v5.2.13 - 2016-10-12

the field is a NUM(2). I try to insert integer 1, and it gave me that error. Same solution.

On vendor\yajra\laravel-oci8\src\Oci8\Query\Processors\OracleProcessor.php
Line 102 :  if (is_int($value)) {
            return PDO::PARAM_INT;
        }

Change to return PDO::PARAM_STR;

and everything works.

yajra commented 7 years ago

@plip14 can you please submit a PR for your proposed solution? Does your solution did not affect other crud operations on your app? Maybe we can indeed remove the int check. We'll also try this when I had the chance. Thanks!

plip14 commented 7 years ago

I'm converting from another framework to laravel, but I'm still quite early on my app, so far basic CRU is ok. We only do soft delete though.

YohanYsturiz commented 6 years ago

Funciono, tenia el mismo inconveniente, modifique el parámetro return PDO::PARAM_INT; por PARAM_STR y almaceno ahora verificare que no este afectando el funcionamiento de mi CRUD

YohanYsturiz commented 6 years ago

Quisiera saber porque ocurre ese error?