Skip to content

Commit

Permalink
Merge pull request #10506 from mattvb91/2.0.x
Browse files Browse the repository at this point in the history
adding blob data types to mysql
  • Loading branch information
andresgutierrez committed Jun 16, 2015
2 parents b4e959b + 388c225 commit e2c3928
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
32 changes: 32 additions & 0 deletions phalcon/db/adapter/pdo/mysql.zep
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
26 changes: 26 additions & 0 deletions phalcon/db/column.zep
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
24 changes: 24 additions & 0 deletions phalcon/db/dialect/mysql.zep
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit e2c3928

Please sign in to comment.