Skip to content

Conversation

@tobiastom
Copy link
Contributor

Describe the PR

I did implement a Postgresql Adapter for Kirby. PostgreSQL does not seem to like when the last insert ID is requested, but it was for example a SELECT query.

This PULL request changes the call to lastInsertId on INSERT queries.

I'm aware that this is not a nice solution, but based on the context that is available at that given point, it seems to be the only one.

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Fixed code style issues with CS fixer and composer fix
  • Added in-code documentation (if needed)

@lukasbestle
Copy link
Member

Thanks for the PR. I actually think that the solution is fine if it’s necessary. However we should probably use case-insensitive matching with Str::startsWith($query, 'insert ', true).

Out of interest: Which kind of error did you get?

We’d also be happy to include the Postgres adapter in the core if you don’t mind sharing it.

@lukasbestle lukasbestle self-assigned this Dec 12, 2019
@lukasbestle lukasbestle added this to the 3.4.0 milestone Dec 12, 2019
@tobiastom
Copy link
Contributor Author

@lukasbestle I'll get back to you as soon as possible. I'm quite busy right now, sorry. :)

@lukasbestle
Copy link
Member

As we are refactoring the Database classes right now, I have added this fix to the current refactoring state as well. The refactored version will hopefully be in v3.4.0.

Thanks again for your PR! 👍

@tobiastom
Copy link
Contributor Author

Thanks for integrating it and sorry that I did not find the time to report back the error. We switched to the native PDO classes inside the project where I needed this fix.

@tobiastom tobiastom deleted the bugfix/last-insert-id branch February 24, 2020 16:42
@distantnative distantnative removed this from the 3.4.0 milestone Mar 6, 2020
@lukasbestle lukasbestle added this to the 3.4.0 milestone Apr 25, 2020
lukasbestle added a commit that referenced this pull request Apr 28, 2020
bastianallgeier pushed a commit that referenced this pull request May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants