Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding blob data types to mysql #10506

Merged
merged 2 commits into from
Jun 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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