For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > July 2007 > Field storage









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Field storage
mrcakey

2007-07-03, 8:01 am

Utterly perplexed by this one. I entered this into my MySQL:

create table if not exists user
(userid int not null auto_increment primary key,
email char(64) not null,
nickname char(32),
user_pass char(41),
reset_ans char(41),
block_timestamp timestamp,
blocked tinyint,
fail_cnt tinyint,
auth_pending tinyint,
default_home tinyint,
pref_email_newsletter tinyint,
pref_email_own tinyint,
polled tinyint,
nominations tinyint,
songalike_count int );

When it came out at the other end, phpMyAdmin is reporting that all the INTs
are 11 bytes long and the TINYINTs are 4 bytes long. I've no idea what's
going on here?!!!!

Also, a related issue, is it necessary to align the fields in byte pairs?
This comes from my Tandem programming background - data was stored in byte
pairs, so if you had a field that was 5 bytes long for instance, you'd try
to stick an odd-byte field next to it so that space wasn't wasted. Do I
need to do this for MySQL (just using ISAM)?

+mrcakey


Captain Paralytic

2007-07-03, 8:01 am

On 3 Jul, 10:35, "mrcakey" <nos...@spamispoo.com> wrote:
> Utterly perplexed by this one. I entered this into my MySQL:
>
> create table if not exists user
> (userid int not null auto_increment primary key,
> email char(64) not null,
> nickname char(32),
> user_pass char(41),
> reset_ans char(41),
> block_timestamp timestamp,
> blocked tinyint,
> fail_cnt tinyint,
> auth_pending tinyint,
> default_home tinyint,
> pref_email_newsletter tinyint,
> pref_email_own tinyint,
> polled tinyint,
> nominations tinyint,
> songalike_count int );
>
> When it came out at the other end, phpMyAdmin is reporting that all the INTs
> are 11 bytes long and the TINYINTs are 4 bytes long. I've no idea what's
> going on here?!!!!
>
> Also, a related issue, is it necessary to align the fields in byte pairs?
> This comes from my Tandem programming background - data was stored in byte
> pairs, so if you had a field that was 5 bytes long for instance, you'd try
> to stick an odd-byte field next to it so that space wasn't wasted. Do I
> need to do this for MySQL (just using ISAM)?
>
> +mrcakey


To find out what's going on here, I can recommend reading the manual:

http://dev.mysql.com/doc/refman/5.0...eric-types.html

mrcakey

2007-07-03, 8:01 am

"Captain Paralytic" <paul_lautman@yahoo.com> wrote in message
news:1183458148.394512.69990@q75g2000hsh.googlegroups.com...
> On 3 Jul, 10:35, "mrcakey" <nos...@spamispoo.com> wrote:
>
> To find out what's going on here, I can recommend reading the manual:
>
> http://dev.mysql.com/doc/refman/5.0...eric-types.html
>


Thank you. I had spent a good 20 minutes looking at the manual, but
apparently not at the relevant bit. Seems a very weird thing for phpMyAdmin
to want to add the display length when it's not needed.

+mrcakey


Captain Paralytic

2007-07-03, 8:01 am

On 3 Jul, 11:45, "mrcakey" <nos...@spamispoo.com> wrote:
> "Captain Paralytic" <paul_laut...@yahoo.com> wrote in message
>
> news:1183458148.394512.69990@q75g2000hsh.googlegroups.com...
>
>
>
>
>
>
>
>
>
>
>
>
> Thank you. I had spent a good 20 minutes looking at the manual, but
> apparently not at the relevant bit. Seems a very weird thing for phpMyAdmin
> to want to add the display length when it's not needed.
>
> +mrcakey- Hide quoted text -
>
> - Show quoted text -


The writers of phpMyAdmin obviously didn't realise that you didn't
need that information. In their ignorance they went and built it to
display all the relevant information about the fields, for all the
other people who need to know the details. Crazy huh!

I notice the same with MicroSoft Windows. There are things in here
that I find totally unnecessary. So I assume that no one else needs
those features either!

mrcakey

2007-07-03, 8:01 am

"Captain Paralytic" <paul_lautman@yahoo.com> wrote in message
news:1183460553.581960.33590@g4g2000hsf.googlegroups.com...
> On 3 Jul, 11:45, "mrcakey" <nos...@spamispoo.com> wrote:
>
> The writers of phpMyAdmin obviously didn't realise that you didn't
> need that information. In their ignorance they went and built it to
> display all the relevant information about the fields, for all the
> other people who need to know the details. Crazy huh!
>
> I notice the same with MicroSoft Windows. There are things in here
> that I find totally unnecessary. So I assume that no one else needs
> those features either!
>


Wow. How dumb do I feel? You really got my number. Facetious gimp

+mrcakey


Captain Paralytic

2007-07-03, 8:01 am

On 3 Jul, 12:23, "mrcakey" <nos...@spamispoo.com> wrote:
> "Captain Paralytic" <paul_laut...@yahoo.com> wrote in message
>
> news:1183460553.581960.33590@g4g2000hsf.googlegroups.com...
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Wow. How dumb do I feel? You really got my number. Facetious gimp
>
> +mrcakey- Hide quoted text -
>
> - Show quoted text -


But at least I answered your original question ;-)

David Quinton

2007-07-04, 4:02 am

On Tue, 03 Jul 2007 05:27:26 -0700, Captain Paralytic
<paul_lautman@yahoo.com> wrote:


>
>But at least I answered your original question ;-)


.... and it WAS quite entertaining...
--
Locate your Mobile phone: <http://www.bizorg.co.uk/news.html>
Great gifts: <http://www.ThisBritain.com/ASOS_popup.html>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com