mysql 字段类型对应的 数字编号, (转摘)
MYSQL_TYPE_BIT 16
MYSQL_TYPE_BLOB 252
MYSQL_TYPE_DATE 10
MYSQL_TYPE_DATETIME 12
MYSQL_TYPE_DECIMAL 0
MYSQL_TYPE_DOUBLE 5
MYSQL_TYPE_ENUM 247
MYSQL_TYPE_FLOAT 4
MYSQL_TYPE_GEOMETRY 255
MYSQL_TYPE_INT24 9
MYSQL_TYPE_LONG 3
MYSQL_TYPE_LONGLONG 8
MYSQL_TYPE_LONG_BLOB 251
MYSQL_TYPE_MEDIUM_BLOB 250
MYSQL_TYPE_NEWDATE 14
MYSQL_TYPE_NEWDECIMAL 246
MYSQL_TYPE_NULL 6
MYSQL_TYPE_SET 248
MYSQL_TYPE_SHORT 2
MYSQL_TYPE_STRING 254
MYSQL_TYPE_TIME 11
MYSQL_TYPE_TIMESTAMP 7
MYSQL_TYPE_TINY 1
MYSQL_TYPE_TINY_BLOB 249
MYSQL_TYPE_VARCHAR 15
MYSQL_TYPE_VAR_STRING 253
MYSQL_TYPE_YEAR 13
在使用 MySQLdb 时:
The only other method you are very likely to use is when you have to do a multi-row insert:
c.executemany(
"""INSERT INTO breakfast (name, spam, eggs, sausage, price)
VALUES (%s, %s, %s, %s, %s)""",
[
("Spam and Sausage Lover's Plate", 5, 1, 8, 7.95 ),
("Not So Much Spam Plate", 3, 2, 0, 3.95 ),
("Don't Wany ANY SPAM! Plate", 0, 4, 3, 5.95 )
] )
Here we are inserting three rows of five values. Notice that there is a mix of types (strings, ints, floats) though we still only use %s. And also note that we only included format strings for one row. MySQLdb picks those out and duplicates them for each row.
MySQLdb会自动适应类型,实际上可以不必在乎类型了?
但是其他数据库包会么?
mysql 字段部类对应的 数字编号, (转摘)
mysql 字段类型对应的 数字编号, (转摘)MYSQL_TYPE_BIT16MYSQL_TYPE_BLOB252MYSQL_TYPE_DATE10MYSQL_TYPE_
