SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lack of capitalization in mySQL?

    I have noticed that mySQL for Windows does not preserve the capitalization format for tables. For instance, I have a table named in the query to build it: tblUsers

    Under phpMyAdmin it shows up as, tblusers

    However, the fields have their capitalization preserved. So a field I name: fldUserName remains just that.

    Is there a setting that preserves the capitalization for the tables like it does the fields, or can someone explain why this happens?
    John

  2. #2
    SitePoint Zealot
    Join Date
    Mar 2002
    Location
    Vancouver, USA
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    After a quick look at my local MySQL folders, it's because the database names are folders & the tables are files. Since windows is Case insensitive, there's no way to preserve capitalization.

  3. #3
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah! That would explain it!
    Thanks!
    John

  4. #4
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright, this is getting old.

    If I want my table names following the convention of tblUserName instead of tblusername, how can I do this in Windows?

    Is there a setting in MySQL that will preserve the case in the table names when they are created or modified? In my searches, I have not yet found one, and it's getting frustrating when I move the database from my Windows development environment to the Unix production environment.
    John

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by PHP John View Post
    Alright, this is getting old.
    it took you six years to notice???

    my advice goes as follows: if you find that you are spitting (euphemism) into the wind, turn around

    adopt as your coding convention a style that allows all table and column names to be lowercase

    i mean, i like CamelCase, too, but it's not as easy to type, is it

    as for your table name, "tblUserName" -- the first thing you need to do is remove the "tbl" (as a convention, ~this~ is getting old)

    and then consider just calling it Users... in which case you might as well call it users

    or what is the difference between UserNames and Users? the only possible reason would be that there are several user tables, with UserNames being the one that stores, um, names, and the only reason it would be named so specifically is because there are other, um, user tables... i think i need to go lie down for a while

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

  6. #6
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    *sigh*

    I know, I know... it's been a while.

    I was hoping for an easier solution, you know, like in the my.cnf or .ini file, the "don't_change_the_damn_case_windows!=1" setting.
    John

  7. #7
    SitePoint Member
    Join Date
    Mar 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think what you are looking for is lower_case_table_names under server variables.

    More details in following chapters of MySQL 5.0 Reference Manual (CHM) -
    8.2.2. Identifier Case Sensitivity & 5.1.3. Server System Variables

    Maybe I got your question wrong?

    regards
    K


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
  •