laravel-oci8 icon indicating copy to clipboard operation
laravel-oci8 copied to clipboard

Creating a sequence options

Open nikklass opened this issue 8 years ago • 3 comments

Hi,

Thanks for the package. I wud like to create a sequence with more options than the example given. Is it possible to create a sequence

create sequence MY_TEST_SEQ
minvalue -2147483648
maxvalue -00001
start with -00001
increment by -1
nocache;

I have tried the following, but it seems some options dont exist:

$sequence->create('MY_TEST_SEQ', $start = -00001, $min = -2147483648, $max = -00001, $increment = -1, $nocache = true);

System details

  • Operating System - macos Sierra
  • PHP Version - PHP 7.0.22
  • Laravel Version - 5.4
  • Laravel-OCI8 Version - 5.4.*

Thanks.

nikklass avatar Sep 24 '17 12:09 nikklass

Why dont you offer some of these functions like create() in sequence as traits so that we can easily override/ customize them if needed?

nikklass avatar Sep 24 '17 12:09 nikklass

You cud add the option i suppose like you currently do in Sequence.php:

public function create($name, $start = 1, $nocache = false, $min = 1, $max = 10000, $increment = 1)
    {
        if (! $name) {
            return false;
        }

        $nocache = $nocache ? 'nocache' : '';

        $sequence_stmt = "create sequence {$name} minvalue {$min} maxvalue {$max} start with {$start} increment by {$increment} {$nocache}";

        return $this->connection->statement($sequence_stmt);

    }

Rgds.

nikklass avatar Sep 24 '17 13:09 nikklass

@nikklass we are open for pull-requests :+1:

mstaack avatar Sep 25 '17 15:09 mstaack