yajra / laravel-oci8

Oracle DB driver for Laravel via OCI8
https://yajrabox.com/docs/laravel-oci8
MIT License
830 stars 237 forks source link

[HELP ME] Problem when Eloquent save a integer to number(10) column #552

Closed khactrung0902 closed 4 years ago

khactrung0902 commented 4 years ago

I have problem when save a integer to number column

When i use model eloquent to save values into data, all numeric variables are encrypted

Example as USER_ID has value 1 after save into database it become 2727304232961

Code snippet of problem

Activity::create( [ 'text' => 'Login', 'user_id' => 1, 'ip_address' => '::1', ] );

System details

Jon4t4n commented 4 years ago

It is almost impossible to say what may be causing your problems without some more information.

Can you post the code of the Activity model and also some information about the database table itself.

It sounds like you have some trigger/sequence that sets the value. But this is just a guess.

khactrung0902 commented 4 years ago

@Jon4t4n thank sir!

I think the problem is here: vendor/yajra/laravel-oci8/src/Oci8/Query/Processors/OracleProcessor.php

/**

When i put Value: (string)1: it's ok but (int)1 it saved as 2727304232961 so funny @@. Is there any encryption mechanism here?

I changed PDO::PARAM_INT to PDO::PARAM_STR, It works fine.

This is bad solution cuz i have to edit in vendor

All Buider Query + Call store proc OK except Eloquent. May be laravel 5.4 with laravel-oci8 was too old.