Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Small MOD: Real Numbers in MODs
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Deleted
deleted

4116 Posts

Posted - 17 September 2002 :  18:05:22  Show Profile
Well, I find the admin_mod_dbsetup.asp as the most andvanced tool around . Unfortunately, it was not supporting real numbers. If you are a MOD writer and want to support single or double precision floating point numbers here is the solution. I needed it for a MOD which keeps volume & temperature data, but any science related board can require this.

The basic data types can be found here:
http://forum.snitz.com/forum/topic.asp?ARCHIVE=true&TOPIC_ID=5120

I added two new data type definitions to the existing ones (smallint,int,varchar,memo): real for single precision (4 bytes) and double for double precision (8 bytes).

An example definition is:

TANK_VOL#real#NULL#
TANK_GRAVITY#double#NULL#

Required code change: Locate this code part in admin_mod_dbsetup.asp

		select case strDBType
			case "access"
				
				fType = replace(fType,"varchar (","text (")
			case "sqlserver"
				select case sqlVer
					case 7
						fType = replace(fType,"memo","ntext")
						fType = replace(fType,"varchar","nvarchar")
						fType = replace(fType,"date","datetime")
					case else
						fType = replace(fType,"memo","text")
				end select
			case "mysql"
				fType = replace(fType,"memo","text")
				fType = replace(fType,"#int","#int (11)")
				fType = replace(fType,"#smallint","#smallint (6)")
		end select


and replace it with the following (or just add the red lines):


		select case strDBType
			case "access"
				fType = replace(fType,"varchar (","text (")
			case "sqlserver"
				fType = replace(fType,"single","real")
				fType = replace(fType,"double","float")
				select case sqlVer
					case 7
						fType = replace(fType,"memo","ntext")
						fType = replace(fType,"varchar","nvarchar")
						fType = replace(fType,"date","datetime")
					case else
						fType = replace(fType,"memo","text")
				end select
			case "mysql"
				fType = replace(fType,"memo","text")
				fType = replace(fType,"#int","#int (11)")
				fType = replace(fType,"#smallint","#smallint (6)")
				fType = replace(fType,"single","real")
				fType = replace(fType,"double","double precision")
		end select



That's it (you may like to do a similar change in admin_mod_dbsetup2.asp).

Enjoy (My thanks go to Huw, who wrote this great tool).

Stop the WAR!

Etymon
Advanced Member

United States
2385 Posts

Posted - 17 September 2002 :  20:35:57  Show Profile  Visit Etymon's Homepage

Well, you are way over my head, but anything that can make a MOD writer's life easier and help others' lives easier to install the MODs gets two thumbs up from me!!!

Thanks Bozden!


Cheers,

Etymon
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000 Version 3.4.07