On Friday 20 July 2012 15:35:18 Georg Ehrke wrote:
> > Why these arbitrary short lengths for URI?
> > I thought that the maximum length for an URI was 2048, but according to
> > [1]  and the standard RFC 2616 [2] there is no real limit on the length
> > of an URI, although 2000/2048 seems to be the practical one.
> >
> > Since it looks like there needs to be a db 'conversion' anyway, why not
> > do it  properly?
> 
> Evenmore, afaik a varchar's max length is (or was) 255.

Database limitations are a valid reason.

For sqlite the maximum seems to be defined by the value of the preprocessor 
macro 
SQLITE_MAX_LENGTH, which defaults to 1 billion (1,000,000,000) [1]. So unless 
that value is changed before compiling, it's quite sufficient to hold an 
URL/URI.

With MySQL it seems to depend on the version used. See the next quote from 
MySQL's documentation [2]:

A variable-length string. M represents the maximum column length in characters. 
In MySQL 5.0, the range of M is 0 to 255 before MySQL 5.0.3, and 0 to 65,535 in 
MySQL 5.0.3 and later. The effective maximum length of a VARCHAR in MySQL 5.0.3 
and later is subject to the maximum row size (65,535 bytes, which is shared 
among all columns) and the character set used.

PostgreSQL limit for character string is about 1GB [3].


So if you want to support MySQL prior to 5.0.3, 255 is the limit you should 
use. 
If the required version of MySQL is greater then 5.0.3 then 65,535 is the 
limit; 
quite sufficient to store an URL/URI.

Cheers,
  Diederik


[1] http://www.sqlite.org/limits.html
[2] http://dev.mysql.com/doc/refman/5.0/en/string-type-overview.html
[3] http://www.postgresql.org/docs/8.0/static/datatype-character.html
_______________________________________________
Owncloud mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/owncloud

Reply via email to