2008-11-25 10 views
9

¿Hay una lista que describa todos los parámetros data_type que puede usar en PDOStatement::bindParam()? Si no tiene ninguno, ¿qué usa comúnmente y para qué tipo de campo?Lista de PDOStatement :: bindParam data_type parameters

Según el manual de PHP: data_type Tipo de datos explícitos para el parámetro que utiliza las constantes PDO :: PARAM_ *.

Sé acerca de la PDO::PARAM_INT y . He oído hablar de PDO::PARAM_LOB pero no estaba seguro de cómo y cuándo usar eso. (Fecha?)

Respuesta

17

De la documentación here:

PDO::PARAM_BOOL (integer) 
Represents a boolean data type. 
PDO::PARAM_NULL (integer) 
Represents the SQL NULL data type. 
PDO::PARAM_INT (integer) 
Represents the SQL INTEGER data type. 
PDO::PARAM_STR (integer) 
Represents the SQL CHAR, VARCHAR, or other string data type. 
PDO::PARAM_LOB (integer) 
Represents the SQL large object data type. 
PDO::PARAM_STMT (integer) 
Represents a recordset type. Not currently supported by any drivers. 
PDO::PARAM_INPUT_OUTPUT (integer) 
Specifies that the parameter is an INOUT parameter for a stored procedure. You must bitwise-OR this value with an explicit PDO::PARAM_* data type. 
+1

sí, mi mal, me perdí la sección de allí. Debería haber buscado constantes de PDO en lugar de declaración de PDO bindParam(). Muchas gracias tomhaigh. – andyk

+0

¿Es 'PARAM_INT' el que se usa para los tipos de datos' text'? Digamos 1000 caracteres – Dan

+1

¿Qué hay de decimales y carrozas? ¿Hay alguna forma de no convertirlos en cadenas, pero mantener los valores decimales? – Bjorn

Cuestiones relacionadas