-
Notifications
You must be signed in to change notification settings - Fork 174
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
Draft: SQL Server support #414
Conversation
Thanks for submitting a PR! Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
Since SQL Server uses merge instead of insert, we have to filter for this to satisfy the expectations. Also, since sqlsrv has one more physical column like sqlite, adjust the expectations here.
This should make all tests pass nonetheless which Storage driver is being used
Interested in this. In case of acceptance, I would like to submit a PR for Oracle support. |
I don't think that I'll continue working on this for now, since the requirements to make it work aren't worth it at the moment. If someone is still interested in adding SQL Server support, this PR might help a bit. |
That's the very same solution I adopted too.
Il lun 4 nov 2024, 07:48 Stephano Vogel ***@***.***> ha
scritto:
… Interested in this. In case of acceptance, I would like to submit a PR for
Oracle support.
I don't think that I'll continue working on this for now, since the
requirements to make it work aren't worth it at the moment.
It is way easier to setup a small MySQL/MariaDB instance and let that
exclusively do the work for Pulse.
—
Reply to this email directly, view it on GitHub
<#414 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEUDEDQT7SCQCBAFKY42P7DZ64KFDAVCNFSM6AAAAABQNCBSCSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJTHEZTCMBRHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@stevenobird, if you aren't going to keep working on this one, I'll close it for now. |
This one still needs a bit of work to do.
Since SQL Server upsert works with the
merge
statement in Laravel, we need to rely on a physical key_hash column with pre-generated hashes like in sqlite and cannot go the mysql, mariadb and postgres way by using a virtual column - even if SQL Server supports this by using computed columns. A quick example on that:This issue lies in
laravel_source
(the source table to be compared in the merge statement) not having thekey_hash
column- this makes the join condition
[laravel_source].[key_hash] = [pulse_values].[key_hash]
invalid.We could create computed columns for the
key_hash
...:... but doing that, we will get a SQL Error because the
merge
query will try to insert or update thekey_hash
column - which isnot possible, because this one is a non-writable, computed value. That's why I went with creating a string with the length of
32, which is the md5 string representation.
I am using
[laravel_source]
as hard coded alias for the upserts, since the current implementation in Laravel also does that. See as seen in SqlGrammar::compileUpsert()This one still needs a bit of work with some digging being involved. Another issue that I've been facing is the problem of the sqlsrv driver returning values as a string - that results in failing test with messages like...
and
or
As you can see, the values match, but the types don't.
The official SQL Server PHP Driver gives us the
PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE
attribute which should give us numeric casts. I just don't know how to enable them during testing and casting the expected values explicitly to integer feels "wrong" to me.Calling
DB::connection('sqlsrv')->getPdo()->setAttribute(PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE, true)
in thebeforeEach
closure didn't help.I've also faced a weird error regarding transactions, but that might be because I'm still using msodbcsql17 instead of the current msodbcsql18.
This happened to me in the
one or more aggregates for a single type
test:At least it is something in the current state: