mysql
mysql copied to clipboard
PHP PDO port to Deno.
Greetings. I have yet to get your library to work because it ultimately doesn't work with Digital Ocean MySQL 8 Managed databases.
I'm a PHP developer and since PHP is open source I was wondering if you could port PDO to Deno. This would greatly increase Deno popularity and the code is technically already written; PHP is open source.
The real PDO benefits are:
- security (usable prepared statements)
- usability (many helper functions to automate routine operations)
- re-usability (unified API to access multitude of databases, from SQLite to Oracle)
Ideally only the MySQL driver would be ported.
Hello, php dev here (apps, not the language).
The main issue with not working with mysql 8 is because mysql 8 has a new password encoding algorithm that broke everything, even PHP. so the issue is NOT in the library, but in the adding this missing support. There's in README.md that it's not supported yet.
PDO is nice because it offers a clean and unified API for using various drivers.
I've been toying a bit around with this library in deno, after working with mysql2 library for nodejs. here's my two cents about this issue and why this library is fine as-is:
- Deno:
db.execute()gives the results as array - Node:
db.execute()gives array of results AND packet info AND other useless info.
For node-mysql2, I was frustrated by the weird output of that method, so I made a DbResult class with following methods:
export class DbResult<T> {
constructor (private result: any) {}
fetchAll<T>(): T[] | null {}
fetchOne<T>(): T | null {}
fetchColumn<T>(name?: string): T | null {}
fetch<T>(): Generator<T> {}
which is more than enough to give you an array of results, a single result or a column value.
If you need the fetch feature, you could simply use generators to achieve the same level of energy.
if you want to prepare queries, you could leverage the decorator pattern to make your own pdo-like api and then call those methods from library.
One year has passed. No updates.
Here is a library I've found that does the job. Can you please implement this?
https://github.com/jeremiah-shaulov/office_spirit_mysql/blob/main/private/auth_plugins.ts
DO used to work for me. But after updating Deno and switching to the latest version it stopped working :(