Skip to content

Could you add TYPE_VARCHAR #1392

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

Closed
SKovbel opened this issue Jun 19, 2015 · 9 comments
Closed

Could you add TYPE_VARCHAR #1392

SKovbel opened this issue Jun 19, 2015 · 9 comments

Comments

@SKovbel
Copy link

SKovbel commented Jun 19, 2015

Could you add new type
\Magento\Framework\DB\Ddl\Table::TYPE_VARCHAR

@SKovbel
Copy link
Author

SKovbel commented Jun 19, 2015

So is varchar type deprecated in Magento2?
Or what the reason why i must use text instead of varchar

@nevvermind
Copy link
Contributor

@Mackovey - have you clicked the links? varchar will be used if the specified col length is <= 255.

@orlangur
Copy link
Contributor

So is varchar type deprecated in Magento2?

No, just one TYPE_TEXT constant is used to represent all following types:

            case 'tinytext':
            case 'char':
            case 'varchar':
            case 'text':
            case 'mediumtext':
            case 'longtext':
                return Table::TYPE_TEXT;

and the most suitable type of the DB engine will be used automatically.

@SKovbel
Copy link
Author

SKovbel commented Jun 19, 2015

No, just one TYPE_TEXT constant is used to represent all following types:

ok, understood, thanx

@vpelipenko
Copy link
Contributor

@Mackovey, can we close this issue?

@SKovbel
Copy link
Author

SKovbel commented Jun 22, 2015

You can.
But i didn't receive answer for my question.
What i must to do if i want to use VARCHAR or what the idea of using TEXT instead of VARCHAR.
Or just forget about class \Magento\Framework\DB\Ddl\Table as it doesn't provide all DDL instruction.

3013

@orlangur
Copy link
Contributor

Ok, now I understood you request.

https://github.com/magento/magento2/blob/develop/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php#L2277 seems to be from ages when VARCHAR could not be longer than 255 characters.

After reading this thread I'm not sure whether there is a practical reason to have VARCHAR column longer than 255 characters:

Both VARCHAR and BLOB/TEXT are stored inline with other columns if the value on a given row fits in the page size

Thoughts?

@akaplya
Copy link
Contributor

akaplya commented Jun 23, 2015

The reason to keep varchar size less than 256 symbols -- give an ability to create index for single varchar field. http://dev.mysql.com/doc/refman/5.6/en/column-count-limit.html

@daim2k5 daim2k5 closed this as completed Nov 10, 2015
magento-team pushed a commit that referenced this issue Aug 8, 2017
MAGETWO-71402: Add community contributions list to the changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants