ho questa query in CodeIgniter:CodeIgniter restituisce tutti i campi come stringhe
$query = $this->db->query("
SELECT u.id
, u.first_name, u.last_name
, u.email_address
, g.id AS group_id
, g.name AS group_name
, g.human_readable_name AS human_readable_group_name
FROM users AS u
JOIN groups AS g
ON u.group_id = g.id
ORDER BY u.last_name
");
return $query->result();
Quando ho var_dump
di fila, ottengo questo:
object(stdClass)#22 (4) {
["id"]=>
string(2) "19"
["first_name"]=>
string(9) "rightfold"
// etc
}
id
e group_id
sono entrambi integer
s in PostgreSQL, ma $query->result()
li restituisce come stringhe. Come posso dire a CodeIgniter di restituire i campi usando i tipi di dati corretti (text
s come stringhe, integer
s come numeri interi, timestamp
s come DateTime
oggetti, ecc ...)?
Sto usando CodeIgniter 2.1.4 su PHP 5.3.15.
-1: questo è il comportamento previsto. Qual è l'errore ** ** causato da questa forma di dati restituiti? –
@ tereško che non è un valido motivo per un downvote, per l'amor di dio! Se non altro, è PHP che sta di nuovo. –
@rightfold Hai avuto qualche soluzione. Si prega di aggiornare come risposta .. affrontare gli stessi problemi –