On Sat, 2007-08-04 at 13:51 -0400, jim-on-linux wrote: > PY help, > > Using sqlite3 v3.1.3 > > When I create a table collumn using; > > newcollum VARCHAR(35), > > I get a default of 10 spaces. > > No matter what I set the size to I get 10 spqces, > even using varchar(0) defaults to 10 spaces. > > I would appreciae the help if someone could tell > me what I'm missing, I want to varry the column > sizes.
What you're missing is that sqlite columns are type-less. Column type and size are irrelevant: >>> import sqlite3 >>> conn = sqlite3.connect(":memory") >>> cur = conn.cursor() >>> cur.execute("create table t1 (c1 varchar(35))") <sqlite3.Cursor object at 0xb7f6dbf0> >>> cur.executemany("insert into t1(c1) values(?)", ... [ ("X"*i*10,) for i in range(10) ] ) >>> cur.execute("select * from t1") <sqlite3.Cursor object at 0xb7f6dbf0> >>> for row in cur: print row ... (u'',) (u'XXXXXXXXXX',) (u'XXXXXXXXXXXXXXXXXXXX',) (u'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',) (u'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',) (u'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',) (u'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',) (u'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',) (u'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',) (u'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',) Even though the column was created to be 35 characters wide, it'll happily accept 100-character strings. HTH, -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list