MyStatus Update Mod (beta) - a social network extension for SMF 2.0

Started by ElectricSquid, October 15, 2009, 02:14:01 PM

Previous topic - Next topic

sangwe11


ElectricSquid

I'm about half way through converting this mod over to it's own tables.
I might get it done tonight if all goes well.

While I'm at it, I'm taking the time to take the admin settings out of the language file and add them to  $modSettings. This was intended from the start, but I had other stuff that was more inportant that needed to be taken care of first.

Any suggestion on the data type the messages should be?

sangwe11

Depends how long they are gunna be xD

Also, are you adding BBC buttons to the message boxes ?

Arantor

It does, very much, depend on how long they are going to be.

If you keep it to 255 characters, you can do it in a varchar(255) which will keep performance well, but any longer than that, you'll need to use text.

sangwe11

Quote from: Arantor on November 14, 2009, 04:14:12 PM
It does, very much, depend on how long they are going to be.

If you keep it to 255 characters, you can do it in a varchar(255) which will keep performance well, but any longer than that, you'll need to use text.

If any sad act wants to type more than 255 characters about what they're doing, faeking let em have the bad performance xD :D

ElectricSquid

255 is too small, have you see the length of some of the political conversations on facebook lately? 420 doesn't even cover it.

...and BBcode buttons will be eventually added so I should support those from the start.

sangwe11


Arantor

Quote from: sangwe11 on November 14, 2009, 04:21:39 PM
Then text is the only type you can use

Not strictly true. Varchar does support > 255 characters, however that's only on MySQL 5 and up. AFAIK the majority of SMF users aren't on MySQL 5+ yet.

sangwe11

Quote from: Arantor on November 14, 2009, 04:28:23 PM
Quote from: sangwe11 on November 14, 2009, 04:21:39 PM
Then text is the only type you can use

Not strictly true. Varchar does support > 255 characters, however that's only on MySQL 5 and up. AFAIK the majority of SMF users aren't on MySQL 5+ yet.

Hense why I said text is the way too go xD

ElectricSquid

text or mediumtext?
SMF's message body uses mediumtext.
It there an advantage of using one over the other?

Quote
Not strictly true. Varchar does support > 255 characters, however that's only on MySQL 5 and up. AFAIK the majority of SMF users aren't on MySQL 5+ yet.

I have to keep this backward compatible. A lot of users can't control the database version they are on since they run through a host.


Arantor

In MySQL, TEXT and MEDIUMTEXT are exactly the same thing. MEDIUMTEXT is the technical name, TEXT the canonical.

ElectricSquid

Text could still be limited if I am understanding this correctly?
By adding a size to the row during creation?
Example below limits to 420?

And if this is so, how do I pass that info back to the user if the user types more than 420?


<?php

array(
'name' => 'body',
'type' => 'mediumtext',
'size' => '420',
'default' => null,
),

?>



Arantor

That won't work properly and will not actually create the column (or table) for you.

TEXT and MEDIUMTEXT do not have implicit sizes less than 65535 characters.

You will have to check it yourself when the user submits it before attempting to add it to the database, and revert to the user appropriately.

MultiformeIngegno

Well I think that 255 characters are enough!! It's only a status update..!

Anyway I'm glad to read you've decided to use another table!! :)
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

Arantor

While I personally would agree (255 is fine for most users!) I can see the benefit of allowing the mod not to.

Idea for you: allow the user to switch it, and issue the appropriate db_alter_column statement.

ElectricSquid


Arantor

Oh, it's called db_change_column. I don't use it much to be honest so I wasn't 100% on what it was called.


sangwe11


Advertisement: