Skip to content

Commit

Permalink
adding blob data types to mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
mattvb91 committed Jun 12, 2015
1 parent 2f79923 commit bf421a7
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
*/

This comment has been minimized.

Copy link
@andresgutierrez

andresgutierrez Jun 12, 2015

Contributor

Could you please remove the extra parentheses, they aren't needed

This comment has been minimized.

Copy link
@mattvb91

mattvb91 Jun 12, 2015

Author Contributor

Of course. Should I rebase and create a new PR or just push commit ontop of this?

This comment has been minimized.

Copy link
@andresgutierrez

andresgutierrez Jun 12, 2015

Contributor

A new commit on top of this is fine, thanks

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 bf421a7

Please sign in to comment.