Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

add a new field in database - type question

Quote Reply
add a new field in database - type question
Hello all,

I have read on the net about types on a field.

In the links table you can add a new field and select 1 of the following type's:

INT, CHAR or TEXT, DATE

My question is:

The CHAR type can only max. 256 characters right ?
TEXT can be as big as it's allowed by the database limits ?

Next question about 'Validation' on a field:
The field ID in links table has Validation ^\d*\.?\d*$
I really don't know what ^\d*\.?\d*$ means.
Does any know a good resources (site) about this sort of things explained ? www.perl.com Smile

Last question is about the Index Weight in the table:
Is this only for the search option? So it index a field when it's >0 and the higher the number (max. 3) the higher it will be listed ? But what if i set index weight to zero, then there will be no search possibility on that field?

Allready thanks.

Regards Startpoint.

Quote Reply
Re: add a new field in database - type question In reply to
In Reply To:
The CHAR type can only max. 256 characters right ?
TEXT can be as big as it's allowed by the database limits ?
Actually, in MySQL, there is field type called LONGTEXT. You can use this field type for long text fields. Using VARCHAR or CHAR will restrict the number of characters in the field.

In Reply To:
Next question about 'Validation' on a field:
The field ID in links table has Validation ^\d*\.?\d*$
I really don't know what ^\d*\.?\d*$ means.
Does any know a good resources (site) about this sort of things explained ? www.perl.com
This is a regular expression that basically means it must be a series of connected digits.

Example:

10001

NOT 1 0 0 0 1

In Reply To:
Last question is about the Index Weight in the table:
Is this only for the search option? So it index a field when it's >0 and the higher the number (max. 3) the higher it will be listed ? But what if i set index weight to zero, then there will be no search possibility on that field?
That is correct...setting fields to 0 will ignore that field in the indexing process. So, you should set fields you want to index above 0. I use the following weights:

Links

Title = 3
URL = 2
Description = 3

Category

Name = 3
Meta Description = 2
Meta Keywords = 3

Regards,

Eliot Lee



Quote Reply
Re: add a new field in database - type question In reply to
Thanks for the reply AnthroRules.

In Reply To:
Actually, in MySQL, there is field type called LONGTEXT. You can use this field type for long text fields. Using VARCHAR or CHAR will restrict the number of characters in the field.
So the type TEXT in admin.cgi when you add new field under table is a longtext (text/blob?). When i select the type text i can enter field length 5000 ?

Allready thanks.

Regards Startpoint.


Quote Reply
Re: add a new field in database - type question In reply to
Not really...there are actually a bunch of TEXT field types:

SMALLTEXT
TEXT
LONGTEXT

You must select LONGTEXT and input 5000 in the Length/Set
field.

BTW: I would HIGHLY recommend downloading and installing MySQLMan since it is
more robust than editor.cgi that comes with Links SQL.

Regards,

Eliot Lee

Quote Reply
Re: add a new field in database - type question In reply to
In Reply To:
MySQLMan
Thanks for the tip AnthroRules, i'll download it.

So that's why you can select all the types [smiles] !

Regards Startpoint.

Quote Reply
Re: add a new field in database - type question In reply to
Right...but you can also select those types via telnet when you connect to your MySQL server. To find out about field types in MySQL, search the http://www.mysql.com web site.

MySQLMan is web emulator for accessing your MySQL server rather than having to type in a bunch of SQL commands via your shell account.

Regards,

Eliot Lee

Quote Reply
Re: add a new field in database - type question In reply to
Thanks AnthroRules.

I have tried mysqlman and it's really looks great (GS 10 points!:)) but 1 thing i don't understand is the following:

- I add a new field called "testfield" in mysqlman in links table ---> type longtext;

- Then i go to editor.cgi Smile table links;

- Then i press resync button and quess what ?

The field "testfield" is type [CHAR], form lenght 40x3, max length 5000.

Dah... some questions in my mind? Is this good or bad ? Will the backup be good ? or

Is this a automatic convert within editor.cgi ?

Hope you can tell me why this happen.

Allready thanks.

btw. if i use longtext i don't (can't) have to have a lenght is that right? What's the differences between text and longtext?

Regards startpoint.

Quote Reply
Re: add a new field in database - type question In reply to
In Reply To:
Then i press resync button and quess what ?
NO...this will resync the tables back to original .def files. You need to also add the new field in your Links.def file or whatever associated .def file to the table you are "updating".

In Reply To:
Dah... some questions in my mind? Is this good or bad ? Will the backup be good ? or
It should read LONGTEXT in your editor.cgi script. If it reads CHAR, it means that you have resynced the table back to the original .def file.

In Reply To:
btw. if i use longtext i don't (can't) have to have a lenght is that right? What's the differences between text and longtext?
Correct...although in terms of limiting data in your tables, it would be wise to set a limit since people could abuse that field and your database by inundating your database with extraneous data.

Regards,

Eliot Lee




Quote Reply
Re: add a new field in database - type question In reply to
Thanks Eliot for the reply !

You got me very confused here, maybe you can give my a hit.

In Reply To:
NO...this will resync the tables back to original .def files. You need to also add the new field in your Links.def file or whatever associated
.def file to the table you are "updating".
The orginal links.def file didn't contain the field "testfield" but after i pressed resync and now i look in the .def file it contains the field "testfield". You tell me that it will restore the .def in the table right?

Where is my thinking going the wrong way on this point, really i don't get it ?

In Reply To:
It should read LONGTEXT in your editor.cgi script. If it reads CHAR, it means that you have resynced the table back to the original .def file.
Well the field "testfield" wasn't in the .def but showed up in editor.cgi, how can that be ?
Also when i look in mysqlman the field is still longtext.

In Reply To:
Correct...although in terms of limiting data in your tables, it would be wise to set a limit since people could abuse that field and your
database by inundating your database with extraneous data.
I get what you mean, good point !
When i try to set the lenght is the field lenght/set (mysqlman) i can't enter 5000 it give error:

MySQL said: You have an error in your SQL syntax near '(5000) null ' at line 1.

Query: ALTER TABLE Links CHANGE testfield testfield longtext(5000) null

- What do i have to enter in option "lenght/set" (mysqlman) because value 5000 is not correct ?
- Is option "max. lenght" in editor.cgi the same as "option lenght/set" (mysqlman) ?

Allready thanks.

Regards startpoint.

Quote Reply
Re: add a new field in database - type question In reply to
Hello all,

aha... .def files are a sort of templates file for the editor.cgi and are only being use the first time (setup.cgi) to create new fields in the database ?! Right, or close ?

So there is a 'bug' in the resync button under editor.cgi right?

Or do i have to edit the .def file manually upload it and then resync it ? <-- well i tried that but after resync the same problem so:

- if you add a field in mysqlman don't EVER use the resync button.

If doens't make any sense to me.... Till then i use the type TEXT in editor.cgi and don't] use myslqman because i my point of view they don't work good together. Or use mysqlman edit links.def and add field and NEVER use the resync button right?

What is the difference between text and longtext ? text has a max. ? or something else ?

Regards startpoint.