From bf421a78cf94e6c45e6774af3b4f81cedad99e90 Mon Sep 17 00:00:00 2001 From: Matt von Bargen Date: Fri, 12 Jun 2015 19:24:29 +0100 Subject: [PATCH] adding blob data types to mysql --- phalcon/db/adapter/pdo/mysql.zep | 32 ++++++++++++++++++++++++++++++++ phalcon/db/column.zep | 26 ++++++++++++++++++++++++++ phalcon/db/dialect/mysql.zep | 24 ++++++++++++++++++++++++ 3 files changed, 82 insertions(+) diff --git a/phalcon/db/adapter/pdo/mysql.zep b/phalcon/db/adapter/pdo/mysql.zep index 9441c4c04a3..555ffc3d7fd 100644 --- a/phalcon/db/adapter/pdo/mysql.zep +++ b/phalcon/db/adapter/pdo/mysql.zep @@ -191,6 +191,38 @@ class Mysql extends PdoAdapter implements AdapterInterface break; } + /** + * Tinyblob + */ + if(memstr(columnType, "tinyblob")) { + let definition["type"] = Column::TYPE_TINYBLOB; + break; + } + + /** + * Mediumblob + */ + if(memstr(columnType, "mediumblob")) { + let definition["type"] = Column::TYPE_MEDIUMBLOB; + break; + } + + /** + * Longblob + */ + if(memstr(columnType, "longblob")) { + let definition["type"] = Column::TYPE_LONGBLOB; + break; + } + + /** + * Blob + */ + if(memstr(columnType, "blob")) { + let definition["type"] = Column::TYPE_BLOB; + break; + } + /** * By default is string */ diff --git a/phalcon/db/column.zep b/phalcon/db/column.zep index 5dd4d520d85..529057ac8af 100644 --- a/phalcon/db/column.zep +++ b/phalcon/db/column.zep @@ -93,6 +93,32 @@ class Column implements ColumnInterface */ const TYPE_BOOLEAN = 8; + /** + * Double abstract data type + * + */ + const TYPE_DOUBLE = 9; + + /** + * Tinyblob abstract data type + */ + const TYPE_TINYBLOB = 10; + + /** + * Blob abstract data type + */ + const TYPE_BLOB = 11; + + /** + * Mediumblob abstract data type + */ + const TYPE_MEDIUMBLOB = 12; + + /** + * Longblob abstract data type + */ + const TYPE_LONGBLOB = 13; + /** * Bind Type Null */ diff --git a/phalcon/db/dialect/mysql.zep b/phalcon/db/dialect/mysql.zep index 8b39c3a379a..2ea4441c8e1 100644 --- a/phalcon/db/dialect/mysql.zep +++ b/phalcon/db/dialect/mysql.zep @@ -131,6 +131,30 @@ class MySQL extends Dialect } break; + case Column::TYPE_TINYBLOB: + if empty columnSql { + let columnSql .= "TINYBLOB"; + } + break; + + case Column::TYPE_BLOB: + if empty columnSql { + let columnSql .= "BLOB"; + } + break; + + case Column::TYPE_MEDIUMBLOB: + if empty columnSql { + let columnSql .= "MEDIUMBLOB"; + } + break; + + case Column::TYPE_LONGBLOB: + if empty columnSql { + let columnSql .= "LONGBLOB"; + } + break; + default: if empty columnSql { throw new Exception("Unrecognized MySQL data type");