Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert: Getting the Sequence Number #586

Open
johnwswar opened this issue Sep 10, 2020 · 2 comments
Open

Insert: Getting the Sequence Number #586

johnwswar opened this issue Sep 10, 2020 · 2 comments
Labels

Comments

@johnwswar
Copy link

I am using Laravel 7.x query builder to perform an insert statement, however, the Oracle database trigger automatically creates a sequence number. I want to do two things:

  1. get the sequence number that the database created.
  2. pass that sequence number via Ajax so I can perform a refresh.

public function store(Request $request)

{
   if ($request->ajax()) {

$insert = DB::table('test_table')->insert([

                'column1'=>$column1,
                'column2'=>$colum2
        ]);

return response()->json(array('message'=> $insert), 200);
}
}

  • Centos 7
  • PHP Version: 7.3.16
  • Laravel Version: 7.x
  • Laravel-OCI8 Version: 7
@yajra
Copy link
Owner

yajra commented Sep 11, 2020

Just fetch the next sequence value. See https://yajrabox.com/docs/laravel-oci8/master/sequence for ref.

@yajra yajra added the question label Sep 11, 2020
@yajra
Copy link
Owner

yajra commented Dec 8, 2020

Just found out while working on #615 that there is a failing test for this scenario. Will try to fix on future release. Thanks!

@yajra yajra added bug and removed question labels Dec 8, 2020
yajra added a commit that referenced this issue Dec 8, 2020
yajra added a commit that referenced this issue Dec 8, 2020
* 8.x:
  Bump v8.2.2 🚀
  Fix github action error on clone? BadMethodCallException: Call to undefined method Yajra\Oci8\Query\OracleBuilder::clone()
  Fix crossJoinSubs query.
  Apply fixes from StyleCI
  Use protected on unsupported upsert tests.
  Apply fixes from StyleCI
  Add failing test link to issue #586.
  Add all builder possible tests from framework. Add TODO notes on failing tests.
  Fix aggregate tests.
  Fix compileUnionAggregate and update tests.
  Remove unused var.
  Fix from query with alias.
  Fix fromSub query. Add tests.
  Add test for having sql.
  Remove table alias in run pagination count query with group. 8.x version of #614 with tests added.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants