yajra / laravel-oci8

Oracle DB driver for Laravel via OCI8

Home Page:https://yajrabox.com/docs/laravel-oci8

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Updating model with multiple blob columns fails

daniel-werner opened this issue · comments

Summary of problem or feature request

When updating laravel model with 2 or more blob columns, the package generates invalid sql statement.

  1. Yajra\Oci8\Tests\Functional\ModelTest::it_can_update_model_with_mutliple_blob_columns
    Yajra\Pdo\Oci8\Exceptions\Oci8Exception: Error Code : 927
    Error Message : ORA-00927: missing equal sign
    Position : 49
    Statement : update "MULTI_BLOBS" set "STATUS" = :p0, "BLOB_1", "BLOB_2" = EMPTY_BLOB() where "ID" = :p1 returning "BLOB_1", "BLOB_2", "ID" into :p2, :p3, :p4
    Bindings : [1,1,OCILob,OCILob,0]

Code snippet of problem

use Yajra\Oci8\Eloquent\OracleEloquent;

/**
 * @property int id
 * @property array blob_1
 * @property array blob_2
 * @property int status
 */
class MultiBlob extends OracleEloquent
{
    protected $guarded = [];

    protected $binaries = ['blob_1', 'blob_2'];

    protected $casts = [
        'blob_1'    => 'array',
        'blob_2'    => 'array'
    ];
}
        $multiBlob          = MultiBlob::create();
        $multiBlob->blob_1 = ['test'];
        $multiBlob->blob_2 = ['test2'];
        $multiBlob->status = 1;
        $multiBlob->save();

System details

  • Operating System ubuntu-latest
  • PHP Version 8.1, 8.2
  • Laravel Version 9, 10
  • Laravel-OCI8 Version 9, 10