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

Case Sensitivity Issue with Alias Names

ymps3502 opened this issue · comments

commented

Summary of problem or feature request

The default PDO::ATTR_CASE in this project is set to CASE_LOWER. However, for the requirements of my project, I need to change it to CASE_NATURAL.

When it's set to CASE_NATURAL, I noticed that all alias names are converted to uppercase. This behavior originates from OracleGrammar@wrapValue , which converts all alias names to uppercase.

protected function wrapValue($value)
{
if ($value === '*') {
return $value;
}
$value = Str::upper($value);
return '"'.str_replace('"', '""', $value).'"';
}

> App\Models\User::select('id as user_id')->where('id', 1)->toSql()
= "select "ID" as "USER_ID" from "USERS" where "ID" = ?"

This becomes problematic when using the belongsToMany relationship in models, as Laravel appends a pivot column (see this code). This interferes with the ability to match two models when using the with method.

Is this conversion to uppercase necessary?

System details

  • Operating System: Ubuntu 22.04.3 LTS
  • PHP Version: 8.0.2
  • Laravel Version: 9.x
  • Laravel-OCI8 Version: v9.5.0

This issue is stale because it has been open for 30 days with no activity.

This issue was closed because it has been inactive for 7 days since being marked as stale.