pdo-via-oci8 icon indicating copy to clipboard operation
pdo-via-oci8 copied to clipboard

Laravel push queue fail

Open holyblue opened this issue 8 years ago • 7 comments

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 ?

holyblue avatar Aug 05 '16 03:08 holyblue

@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

yajra avatar Aug 05 '16 04:08 yajra

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

holyblue avatar Aug 05 '16 05:08 holyblue

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.

plip14 avatar Jan 18 '17 10:01 plip14

@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!

yajra avatar Jan 19 '17 00:01 yajra

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.

plip14 avatar Jan 19 '17 01:01 plip14

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 avatar Oct 14 '17 18:10 YohanYsturiz

Quisiera saber porque ocurre ese error?

YohanYsturiz avatar Oct 14 '17 19:10 YohanYsturiz