Skip to content

Conversation

trusek
Copy link

@trusek trusek commented Apr 11, 2024

fixes exists - not working properly for checking directories
fixes writeStream - updating size not working for SqlServer
fixes delete - file name was not prefixed
change exists - not working propery under SqlServer
change writeStream - on exception file name in message was prefixed

{
return (bool) $this->connection->executeQuery(<<<SQL
SELECT EXISTS (
SELECT CASE WHEN EXISTS (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EXISTS already a boolean operator in SQL.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but for mssql that is inncorect syntax. You can check this on (https://sqliteonline.com/)

SELECT EXISTS (SELECT 1)

throws: Token error: 'Incorrect syntax near the keyword 'exists'.'

When on Sqlite, PostgreSql, MariaDb, Mysql works like a charm.
Case-When syntax should work on every engine.

But on Oracle still missing from DUAL. On this could be patched with simple

$this->connection->getDatabasePlatform()->getDummySelectSQL('CASE WHEN EXISTS(...`)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getDummySelect wont work. E.g.: DB2.
Currently the bundle supports: sqlite, mysql , mariadb and pgsql.
If we need to add more platform, a refactor is needed to handle platform-specific queries i guess. Not just some if-else in the adapter.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package is great, I just miss support for SQLserver.I'm not intrested with others like Oracle or DB2.

I'm not familiar with DB2. Doctrine do sprintf('SELECT %s FROM sysibm.sysdummy1', $expression); for this platform.

@fracsi
Copy link
Member

fracsi commented Apr 12, 2024

Please create a table definition for SQLServer in the schema folder. See the existing ones for examples.

@trusek trusek force-pushed the main branch 3 times, most recently from 43cc926 to c350011 Compare April 17, 2024 06:50
fixes writeStream - updating size not working for SqlServer
fixes delete - file name was not prefixed
change exists - not working propery under SqlServer
change writeStream - on exception file name in message was prefixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants