SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,053
    Mentioned
    66 Post(s)
    Tagged
    0 Thread(s)

    Insane Idea? Using comments to hold additional meta data.

    I literally had this idea 30 seconds ago - why not use the MySQL comments to store a serialized array that contains additional meta data for the column - at the very least the name of the table the column is a foreign key for, stuff like that.

    Has this been done? What would be the ramifications, other than condensing where the meta information is stored. My own initial reaction to the idea is it's crazy - but maybe crazy enough to actually work.

    Thoughts?

    [A little further research - there's a 60 character limit]

  2. #2
    Non-Member
    Join Date
    Feb 2012
    Posts
    892
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Any database has catalogs for this type of metadata.

    I believe in MySQL information_schema covers that?

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,322
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Michael Morris View Post
    My own initial reaction to the idea is it's crazy
    mine too

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,053
    Mentioned
    66 Post(s)
    Tagged
    0 Thread(s)
    The information schema does cover that - and its where the comments are ultimately stored. But I have additional meta data in the system I'm building. One of the more critical pieces is the governing class for the table or field, which informs the primary model which class should be loaded to handle the table's data. Also, MySQL doesn't store relationships. It's possible to infer them through proper field naming, but they are explicitly named.

    The convention I'm developing has the limitation that no field and no table can share a name arbitrarily. When the system encounters a field that has the same name as a table, it presumes the field is a foreign key for that table.

    I suppose I should go back to having my own meta tables for this information.

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,322
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Michael Morris View Post
    Also, MySQL doesn't store relationships.
    o rly?

    what about the KEY_COLUMN_USAGE table?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •