-
Notifications
You must be signed in to change notification settings - Fork 891
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
[Sql Server] Add support for different integer sizes #1250
Conversation
@@ -44,6 +44,12 @@ class SqlServerAdapter extends PdoAdapter implements AdapterInterface | |||
|
|||
protected $signedColumnTypes = ['integer' => true, 'biginteger' => true, 'float' => true, 'decimal' => true]; | |||
|
|||
const INT_TINY = 255; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double space found
@@ -44,6 +44,12 @@ class SqlServerAdapter extends PdoAdapter implements AdapterInterface | |||
|
|||
protected $signedColumnTypes = ['integer' => true, 'biginteger' => true, 'float' => true, 'decimal' => true]; | |||
|
|||
const INT_TINY = 255; | |||
const INT_SMALL = 65535; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double space found
@@ -44,6 +44,12 @@ class SqlServerAdapter extends PdoAdapter implements AdapterInterface | |||
|
|||
protected $signedColumnTypes = ['integer' => true, 'biginteger' => true, 'float' => true, 'decimal' => true]; | |||
|
|||
const INT_TINY = 255; | |||
const INT_SMALL = 65535; | |||
const INT_MEDIUM = 16777215; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double space found
const INT_SMALL = 65535; | ||
const INT_MEDIUM = 16777215; | ||
const INT_REGULAR = 4294967295; | ||
const INT_BIG = 18446744073709551615; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double space found
if ($limit && $limit >= static::INT_TINY) { | ||
$sizes = [ | ||
// Order matters! Size must always be tested from longest to shortest! | ||
'bigint' => static::INT_BIG, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double space found
$sizes = [ | ||
// Order matters! Size must always be tested from longest to shortest! | ||
'bigint' => static::INT_BIG, | ||
'int' => static::INT_REGULAR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double space found
'bigint' => static::INT_BIG, | ||
'int' => static::INT_REGULAR, | ||
'mediumint' => static::INT_MEDIUM, | ||
'smallint' => static::INT_SMALL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double space found
'int' => static::INT_REGULAR, | ||
'mediumint' => static::INT_MEDIUM, | ||
'smallint' => static::INT_SMALL, | ||
'tinyint' => static::INT_TINY, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double space found
7258b3a
to
4f18644
Compare
@@ -44,6 +44,12 @@ class SqlServerAdapter extends PdoAdapter implements AdapterInterface | |||
|
|||
protected $signedColumnTypes = ['integer' => true, 'biginteger' => true, 'float' => true, 'decimal' => true]; | |||
|
|||
const INT_TINY = 255; | |||
const INT_SMALL = 65535; | |||
const INT_MEDIUM = 16777215; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double space found
4f18644
to
1668ce1
Compare
Codecov Report
@@ Coverage Diff @@
## master #1250 +/- ##
==========================================
+ Coverage 72.32% 74.38% +2.05%
==========================================
Files 35 35
Lines 5551 4744 -807
==========================================
- Hits 4015 3529 -486
+ Misses 1536 1215 -321
Continue to review full report at Codecov.
|
Why does this happen? Is the |
Thank you for your contribution. That aside, I tested your patch on my local computer with sqllocaldb, but it didn't pass. Would it pass on your environment?
|
@chinpei215 Thank you for testing! Yeah I was hoping that I could use the CI process and wouldn't have to set it up myself locally. I'll look at the issues and report back. |
const INT_SMALL = 65535; | ||
const INT_MEDIUM = 16777215; | ||
const INT_REGULAR = 4294967295; | ||
const INT_BIG = 18446744073709551615; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is is possible to declare those constants as strings? Sorry if I am wrong, but I guess INT_BIG would overflow in 32bit PHP, and if you want to use unsigned bigint, it would overflow even in 64bit PHP.
@chinpei215 I took this from the MysqlAdapter which does it in the same way. |
Oh I didn't know that. Sorry. Then I don't request changes in this PR. |
@chinpei215 Oh that's fine 😄 We had several other issues and decided to write native queries in the migrations which is suboptimal but easier in our situation. Thus I'll have to fix these issues in my free time. I'll look at them as soon as possible. |
Thanks. |
@iluuu1994 Do you still want to add those? |
Nope, I'm not using this library anymore. You're free to take over. |
No description provided.