doctrine / dbal

Doctrine Database Abstraction Layer
https://www.doctrine-project.org/projects/dbal.html
MIT License
9.44k stars 1.33k forks source link

SQL Anywhere host parameter is optional #2780

Closed cfreear closed 3 years ago

cfreear commented 7 years ago

Currently in Doctrine/DBAL/Driver/SQLAnywhere/Driver.php the host parameter is set by default to localhost:2638 which is great for servers listening on tcpip however for local development machines the host isn't needed sap docs and because of the default values dbal actually fails to connect.

Could this parameter be made optional? Happy to submit a PR but wanted feedback first.

Ocramius commented 7 years ago

the default values dbal actually fails to connect.

Could you clarify this? What are the defaults? A host name is required in order to connect somewhere, or else it must be a socket.

cfreear commented 7 years ago

In Doctrine/DBAL/Driver/SQLAnywhere/Driver.php lines 84 and 85 the HOST parameter in the DSN is set to localhost:2638 if the host and port config items aren't set.

When running on a local machine SQL Anywhere can start listening only for shared memory connections using the -x none server option. In this mode SQL Anywhere doesn't listen on tcpip so attempting to connect via host fails, only the ServerName and DBN are needed.

Ocramius commented 7 years ago

Ah, I see, so the PHP and SQL Anywhere processes share some memory as I/O swap - that's interesting.

@cfreear changing the defaults is a BC break, but you can send a patch to allow using shared (local) memory

cfreear commented 7 years ago

To avoid BC would it be more prudent to add a memory connection parameter similar to the one in pdo_sqlite? It could default to false in which case the HOST=localhost:2638 would still be prepended to the DSN and prevent BC, setting it to true would then ignore anything in host and port and skip the HOST= line. Thoughts?

Ocramius commented 7 years ago

Seems like a solid approach. Call it "shared_memory" or pick the terminology from the SQLAnywhere docs

On 19 Jul 2017 12:11 PM, "Christian Freear" notifications@github.com wrote:

To avoid BC would it be more prudent to add a memory connection parameter similar to the one in pdo_sqlite https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php#L82-L86? It could default to false in which case the HOST=localhost:2638 would still be prepended to the DSN and prevent BC, setting it to true would then ignore anything in host and port and skip the HOST= line. Thoughts?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/doctrine/dbal/issues/2780#issuecomment-316338696, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJakOjZKrmHk_R8obkATlcsgu2tM_djks5sPdY6gaJpZM4ObJYE .

morozov commented 3 years ago

Closing as SQLAnywhere is no longer supported.

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.