SQLlite big string column question

Just starting out? Need help? Post your questions and find answers here.
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

SQLlite big string column question

Post 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:
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: SQLlite big string column question

Post by netmaestro »

VARCHAR should be fine.
BERESHEIT
User avatar
Kiffi
Addict
Addict
Posts: 1484
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: SQLlite big string column question

Post 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
Hygge
Marco2007
Enthusiast
Enthusiast
Posts: 648
Joined: Tue Jun 12, 2007 10:30 am
Location: not there...

Re: SQLlite big string column question

Post by Marco2007 »

Kiffi wrote:one of the great benefit of SQLite
If I only had known about all those benefits three years ago :evil:
PureBasic for Windows
Edwin Knoppert
Addict
Addict
Posts: 1073
Joined: Fri Apr 25, 2003 11:13 pm
Location: Netherlands
Contact:

Re: SQLlite big string column question

Post 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.
User avatar
Kiffi
Addict
Addict
Posts: 1484
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: SQLlite big string column question

Post by Kiffi »

Edwin Knoppert wrote:Programmers need restrictions to fix their code and prevent/reduce bugs.
this is your opinion, not mine. :-)

Greetings ... Kiffi
Hygge
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: SQLlite big string column question

Post by srod »

Aye, some programmers might need restrictions... not me however! :wink:
I may look like a mule, but I'm not a complete ass.
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: SQLlite big string column question

Post 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...
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
Kiffi
Addict
Addict
Posts: 1484
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: SQLlite big string column question

Post 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
Hygge
Post Reply