Page 1 of 1

SQLlite big string column question

Posted: Wed Aug 11, 2010 9:21 pm
by Rook Zimbabwe
Lets say I had a string of about 3000 characters and I wanted to save it to a column of a table in a SQLlite DB... Does anyone know what COLUMN type that should be?
:mrgreen:

Re: SQLlite big string column question

Posted: Wed Aug 11, 2010 9:26 pm
by netmaestro
VARCHAR should be fine.

Re: SQLlite big string column question

Posted: Wed Aug 11, 2010 9:42 pm
by Kiffi
Rook Zimbabwe wrote:Lets say I had a string of about 3000 characters and I wanted to save it to a column of a table in a SQLlite DB... Does anyone know what COLUMN type that should be?
:mrgreen:
one of the great benefit of SQLite is creating typeless columns.
In short: Leave the colum type empty and it will store data of any size.

Code: Select all

Create myTable (myColumn)
Greetings ... Kiffi

Re: SQLlite big string column question

Posted: Wed Aug 11, 2010 10:01 pm
by Marco2007
Kiffi wrote:one of the great benefit of SQLite
If I only had known about all those benefits three years ago :evil:

Re: SQLlite big string column question

Posted: Wed Aug 11, 2010 11:20 pm
by Edwin Knoppert
Oh well the documentations was on three years ago ( www.sqlite.org )
Anyway, typeless s***s anyway..
Programmers need restrictions to fix their code and prevent/reduce bugs.
Strong typed is the way to go.

Re: SQLlite big string column question

Posted: Thu Aug 12, 2010 8:19 pm
by Kiffi
Edwin Knoppert wrote:Programmers need restrictions to fix their code and prevent/reduce bugs.
this is your opinion, not mine. :-)

Greetings ... Kiffi

Re: SQLlite big string column question

Posted: Thu Aug 12, 2010 8:23 pm
by srod
Aye, some programmers might need restrictions... not me however! :wink:

Re: SQLlite big string column question

Posted: Thu Aug 12, 2010 9:20 pm
by Rook Zimbabwe
It looks like SQLLite automatically truncates the line... I cannot tell however because the BLOB code that writes the tiles into the DB is not working...

Re: SQLlite big string column question

Posted: Thu Aug 12, 2010 9:35 pm
by Kiffi
Rook Zimbabwe wrote:It looks like SQLLite automatically truncates the line...
no truncation here:

Code: Select all

UseSQLiteDatabase()

DB = OpenDatabase(#PB_Any, ":memory:", "", "", #PB_Database_SQLite)

DatabaseUpdate(DB, "Create Table myTable (myColumn)")

DatabaseUpdate(DB, "Insert Into myTable (myColumn) Values ('" + Space(  1000) + "')")
DatabaseUpdate(DB, "Insert Into myTable (myColumn) Values ('" + Space(  5000) + "')")
DatabaseUpdate(DB, "Insert Into myTable (myColumn) Values ('" + Space( 10000) + "')")
DatabaseUpdate(DB, "Insert Into myTable (myColumn) Values ('" + Space(100000) + "')")

DatabaseQuery(DB, "Select * From myTable")

While NextDatabaseRow(DB)
  Debug Len(GetDatabaseString(DB, 0))
Wend
Greetings ... Kiffi