A simple Propel query to fetch a result 100
from a column with type VARCHAR
returns a string. This is expected behaviour. I am working with a legacy system and know I need to cast these values to a php integer
type in order to sort them programatically or perform arithmetic etc.
Does the Database explicitly return a VARCHAR
and if so how does this work for a weakly typed language?
Alternatively, does the DBAL look at the column type and perform an implicit cast on that basis?
To put it another way: Is the column type in SQL just a 'tag' or 'label' which is interpreted by the DBAL which then casts appropriately based on language?
To keep the question specific, I'd like an answer with regards to: Propel
, php
and MySQL
.
If I am understanding you properly, you are asking if the database uses a binary format to store the data. Yes it does. The layer(s) between the database and the application is what determines what format is returned to the application.
It is actually just the opposite of your question - the DBAL receives typed information, which is then translated to whatever the application can handle.