vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Is it safe to ALTER columns from the USERFIELD table ? (https://vborg.vbsupport.ru/showthread.php?t=159283)

mihai11 10-02-2007 09:46 AM

Is it safe to ALTER columns from the USERFIELD table ?
 
Hi,


For example I want to change the columns type to integer with an SQL like this:

Code:

ALTER TABLE ro_userfield MODIFY field5 int(10) NOT NULL DEFAULT 10;
Can I have issues if I do that ?



Regards,
Razvan M.

Marco van Herwaarden 10-03-2007 05:56 AM

I would not advise to change the column types.

mihai11 10-03-2007 11:04 AM

Quote:

Originally Posted by Marco van Herwaarden (Post 1351928)
I would not advise to change the column types.

What issues could I face if the fields would be set to be non-editable by users ?

Marco van Herwaarden 10-03-2007 11:08 AM

Parts of standard vBulletin coding may still assume a different column-type.

WhaLberg 10-03-2007 11:14 AM

Plus, there'd be no security issue for that you've changed the column type. You'll just face what Marco said.

Paul M 10-03-2007 11:55 AM

Why do you want to change it ?

mihai11 10-03-2007 01:00 PM

Quote:

Originally Posted by Paul M (Post 1352078)
Why do you want to change it ?

On my board, I am implementing right now a system of award points and it would be nice to be able to have those points on the user list. Obviously, the points are integers so I was thinking that I should ALTER the USERFIELD table to support integers. This would help because there will be no need to convert the data from string to integer when I will perform math operations in PHP.

But, after reading the replies above, I am starting to think that it is better to save the points as a string value and when it is necessary to convert the string to an integer.

Some additional advantage would have been that it would be quite fast to find all the users with more than lets say 70 points. Maybe there are some MySql functions that allow me to convert a string to integer so that the whole operation will be performed on the MySql side. If that is true, then the only disadvantage remains speed.

Dismounted 10-04-2007 05:08 AM

Errrrrmm, converting a string to an integer is easy...There are even two ways to do it.

1./ Probably the best way.
PHP Code:

$int intval($str); 

2./ Not optimal, but works.
PHP Code:

$int $str 0



All times are GMT. The time now is 01:12 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00954 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete