Skip to content
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

Mad::Mapper should not be tightly bound to MySQL #1

Closed
kberov opened this issue Aug 31, 2015 · 5 comments
Closed

Mad::Mapper should not be tightly bound to MySQL #1

kberov opened this issue Aug 31, 2015 · 5 comments
Assignees

Comments

@kberov
Copy link
Contributor

kberov commented Aug 31, 2015

I intend to use Mad::Mapper not only with Mojo::mysql.
Please replace all occurrences of $res->sth->mysql_insertid with something like
$self->dbh->last_insert_id(undef, undef, $self->table, $self->pk)
I know Mad::Mapper is still new, but it should not be bound to one specific database driver.
Please inform if otherwise.
Thanks.

@jhthorsen jhthorsen self-assigned this Sep 1, 2015
@jhthorsen
Copy link
Owner

The documentation states:

Currently the supported backends are Mojo::Pg or Mojo::mysql, both which are optional dependencies.

Are you going to use it with Mojo::SQLite as well...? I haven't tested it with that driver, but I would very much like to support it.

I won't implement the change, unless I know how to test it.

@kberov
Copy link
Contributor Author

kberov commented Sep 1, 2015

Mojo::SQLite,Mojo::Pg and Mojo::mysql are a good start :) and this would cover more than 90% of the use-cases. Mojo::SQLite should (must?!) not be used in asynchronous mode, but I do not know the exact technical details - the internals where the mode is switched. It should be within the the Mojo::$drivername it self so this should not be a concern of Mad::Mapper.

@jhthorsen
Copy link
Owner

Why can't Mojo::SQLite be used in async mode? I know the database is synchronous, but that doesn't mean that Mojo::SQLite shouldn't support an async API.

Actually, I got @Grinnz to support just that: https://metacpan.org/pod/Mojo::SQLite::Database#query

The "mode" you're referring to is switched inside Mojo::DRIVER::Database. Mad::Mapper does not change the internals of the $dbh. (At least not intentionally) (DRIVER = Pg, mysql, SQLite)

jhthorsen pushed a commit that referenced this issue Sep 1, 2015
 - Add support for Mojo::SQLite #1
@kberov
Copy link
Contributor Author

kberov commented Sep 1, 2015

Thanks :) 👍 !

@jhthorsen
Copy link
Owner

You're welcome 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants