Jump to content

[SOLVED] using longtext for all strings


bobbinsbro

Recommended Posts

hello.

 

i'm creating a CMS for an online store. i was required to create a mechanism that will allow the admins of the site to upload excel worksheets with product info to populate a DB. i basically create+populate tables by parsing the text in these files.

 

in order to create mysql tables from the worksheets, in need to recognize the data-types of each column in the excel files. the method i will use to do this will be to require each column-title in the excel worksheets to begin with datatype codes that i will set. i need to keep these codes simple and as few as possible but without limiting functionality and without bloating the DB size (by setting column datatypes to byte sizes much bigger than their content).

 

so i intend to divide the common mysql types into parent types that the website will need:

prices - mysql DECIMAL

date/time - mysql DATE/TIME

integers - mysql INT

boolean - mysql BIT(1) or TINYINT(1)

text - mysql LONGTEXT

 

now here is my question:

is there any problem with using LONGTEXT in all columns that store strings, regardless of actual length? i read on the mysql website that LONGTEXT is treated as a very long VARCHAR, so i was hoping that inserting the word "hello" into a LONGTEXT column wont result in lots of wasted bytes...?

 

things that will be stored as strings will include product names in different char-sets (utf-8 and latin-1), description, notes, product colors, etc.

 

i'm using mysql server v. 5.0.67 - community. i'm not sure what version the website server will end up having, but i assume it will be 5.0.X - enterprise.

 

thanx in advance.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.