Re: [sqlite] [EXTERNAL] char(0) with SQLite
On Mon, Sep 2, 2019 at 12:12 PM Hick Gunter wrote: > Dimensions are ignored by SQLite. A field defined CHAR(0) can hold any > length (up to the internal limit) of string. SQlite will only store the > actual length of the string plus its contents, no space is wasted. And Gunter wrote "string" above, but SQLite will also hold an integer, or real, or blob value in that row/col (i.e. cell) just as well :) --DD PS: Note that if you use the text type for your password, note that the text is expected to be UTF-8. If you users use accented characters in an 8-bit encoding, and you do not properly convert that into UTF-8, this could perhaps create issues (although if you take that UTF-8, and manipulate it assuming the same 8-bit encoding, SQLite should give you back the same bytes, it doesn't do UTF-8 validation AFAIR). Otherwise use a blob and conventions/assumptions in your app. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] [EXTERNAL] char(0) with SQLite
> Le 2 sept. 2019 à 12:12, Hick Gunter a écrit : > >> Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im >> Auftrag von Grincheux >> Into my db I store passwords having differents lengths (from 1 to 50). >> I don't want to give the max size that woud be using space I don't need. >> I found that sqlite permits char(0) but what is the incidence for my db. > Dimensions are ignored by SQLite. A field defined CHAR(0) can hold any length > (up to the internal limit) of string. SQlite will only store the actual > length of the string plus its contents, no space is wasted. Grincheux, As Hick wrote, dimensions are ignored. You don't even need to use CHAR(0). CHAR(1000) or CHAR or TEXT (often used in SQLite schemas) will do and are all equivalents. If CHAR(50) makes sense for you, as a documentation hint that you don't expect ever more than 50 characters, then there is nothing wrong leaving it as such in your schema. If you want to enforce the 50 characters limit, you have to do it either in your code using SQLite OR through some CHECK on the SQL definition. — Best Regards, Meilleures salutations, Met vriendelijke groeten, Mit besten Grüßen, Olivier Mascia ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] [EXTERNAL] char(0) with SQLite
Dimensions are ignored by SQLite. A field defined CHAR(0) can hold any length (up to the internal limit) of string. SQlite will only store the actual length of the string plus its contents, no space is wasted. -Ursprüngliche Nachricht- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Grincheux Gesendet: Sonntag, 01. September 2019 08:14 An: sqlite-users@mailinglists.sqlite.org Betreff: [EXTERNAL] [sqlite] char(0) with SQLite Into my db I store passwords having differents lengths (from 1 to 50). I don't want to give the max size that woud be using space I don't need. I found that sqlite permits char(0) but what is the incidence for my db. -- Sent from: http://sqlite.1065341.n5.nabble.com/ ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___ Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0 May be privileged. May be confidential. Please delete if not the addressee. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users