Thread: can I define a hyperlink as a datatype

can I define a hyperlink as a datatype

From
Kumar S
Date:
Dear Group,
 is there a way to define a hyperlink as a datatype.

I want to store hyperlink for an FTP site as my data
link. Is this possible or it is good to define it as
varchar.

Please suggest.
thanks
psk





__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail

Re: can I define a hyperlink as a datatype

From
Josh Berkus
Date:
Kumar,

>  is there a way to define a hyperlink as a datatype.
>
> I want to store hyperlink for an FTP site as my data
> link. Is this possible or it is good to define it as
> varchar.

You can just use TEXT.    If you want to get really sophisticated, you can
define a DOMAIN to check for proper format.

--
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco

Re: can I define a hyperlink as a datatype

From
Oliver Fromme
Date:
Josh Berkus wrote:
 > Kumar,
 > >  is there a way to define a hyperlink as a datatype.
 > >
 > > I want to store hyperlink for an FTP site as my data
 > > link. Is this possible or it is good to define it as
 > > varchar.
 >
 > You can just use TEXT.    If you want to get really sophisticated, you can
 > define a DOMAIN to check for proper format.

Depending on the application, it might also be useful to
store the components of the URI in separate columns, i.e.
method, hostname, username/password, port number, path,
arguments and anchor (most of those are optional).

For example, http://www.freebsd.org/cgi/man.cgi?query=ls
would be stored like this:  method = 'http', hostname =
"www.freebsd.org", username = NULL, password = NULL, port =
80, path = "/cgi/man.cgi", arguments = "query=ls", anchor =
NULL.

Then you can, for example, sort and select by hostname,
compare document URIs without regard to arguments and an-
chors, more easily search for specific path names, etc.

Of course, if the application handles the URIs as opaque
strings without being interested in their components, then
storing them as single TEXT values is sufficient.

(BTW, varchar(n) would be a bad idea, because they can get
pretty long.  Earlier RFCs define a limit of 1023 chars,
however, that limit was lifted by later standards, IIRC.)

Best regards
   Oliver

--
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"And believe me, as a C++ programmer, I don't hesitate to question
the decisions of language designers.  After a decent amount of C++
exposure, Python's flaws seem ridiculously small." -- Ville Vainio

Re: can I define a hyperlink as a datatype

From
Arthur van Dorp
Date:
> You can just use TEXT.    If you want to get really sophisticated,
> you can define a DOMAIN to check for proper format.

Isn't TEXT a bit dangerous? If the links come from "outside" someone
could try to DDOS the database with huge strings until you run out of space.

Arthur