-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add native_type to pdo_firebird::getColumnMeta() #6682
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
base: master
Are you sure you want to change the base?
Add native_type to pdo_firebird::getColumnMeta() #6682
Conversation
- Verify column number so a bad column doesn't generate a SIG_SEGV. - Ensure the statement has been prepared. - Return native_type.
@sim1984, you might be interested in this. :) |
This is a job well done. Thanks. |
Could it be merged before 8.1.0alpha1? |
@diegosardina Out of curiosity why do you need this? To the author: why did you add |
Some ORM require |
As far as I know, there's no consensus on what this experimental method should do. There's definitely no consensus on what |
Being experimental At least there is a sort of unanimity in this (and at this point why put delay on the Firebird driver?) What @nikic thinks about it? Since he wrote the whole of |
I'm not against that function in general, and in fact I was thinking of improving it, but I'd prefer to remove |
Removing it is not a wise decision since it would break lot of applications. Changing the documentation at this point is better, or rename it to
Agreed that name is confusing, but it seems that Mysql, Pgsql and Sqlite drivers implemented it by returning sql types |
Yes. We can merge it in time for 8.1. However, it sounds like @kamil-tekiela has concerns, so I'd like to make sure everyone is okay with this change before merging.
Should we have a wider discussion about |
I thought this sounded familiar. 😄 @kamil-tekiela is working on #6930, which is related to this. |
Sorry, I missed this was directed at me. Q: Why did you add. What's the purpose? A: I don't like being tied to one SQL engine, and unfortunately the various SQL DB engines make that difficult. So I wrote a translation layer that sits on top of native drivers (like Sqlite) and PDO. It translates between syntax like 'limits' and 'rows' (both select the rows to return, some DB's use 'limits' and some user 'ROWS'). It also handles types. Date and Timestamp are by far the worst - it seems every SQL DB has their own way of representing them. My translation layer turns them all into PHP datetime objects. But you have to know when to do that, and one way of knowing is looking at the underlying column type. There are other types too - like 'bigint' that have similar problems. Most SQL DB's have a way of extracting the underlying type - but if often requires additional SQL select's to do it, which can easily create a 2 or 3 fold read amplification, and it doesn't work for computed columns. The underlying C interface on the other hand must always return the type of each column in a query result because as is no other way to know it for for computed columns. All getColumnMeta() real does is expose this in a standardised way to PHP code. Q: Where do these values come from?
One win for the translation layer is I tend to use SQLite for Unit tests because it's in-memory databases are so convenient, but then switch to something heavier for production. |
Work done on pdo_firebird::getColumnMeta():
I was advised no RFC was needed:
https://marc.info/?l=php-internals&m=161305450505181&w=2