Re: [sqlite] change sqlite table column type

2010-11-15 Thread Oliver Peters
lizhe l...@... writes:

 
 
 Dear Sir:
   I have a table type is blob,I think update  integer type, 
   How to solve my trouble? alter SQL?

[...]

use the CLI (sqlite3) and your favourite editor:

sqlite3 yourdatabase
.output file.sql
.dump
.q

edit file.sql
change from your column type to INTEGER

sqlite3 yournewdatabase  file.sql

ready

Oliver

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] change sqlite table column type

2010-11-15 Thread Jay A. Kreibich
On Mon, Nov 15, 2010 at 08:34:22AM +, Oliver Peters scratched on the wall:
 lizhe l...@... writes:
 
  
  
  Dear Sir:
I have a table type is blob,I think update  integer type, 
How to solve my trouble? alter SQL?
 
 [...]
 
 use the CLI (sqlite3) and your favourite editor:
 
 sqlite3 yourdatabase
 .output file.sql
 .dump
 .q

  You can also live dangerously and set PRAGMA writable_schema=1,
  allowing you to UPDATE the sqlite_master table directly.

   -j

-- 
Jay A. Kreibich  J A Y  @  K R E I B I.C H 

Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable. -- Angela Johnson
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] change sqlite table column type

2010-11-15 Thread Oliver Peters
Jay A. Kreibich j...@... writes:

[...]
 
   You can also live dangerously and set PRAGMA writable_schema=1,
   allowing you to UPDATE the sqlite_master table directly.
 
-j
 

is this PRAGMA documented? Can't find it here http://www.sqlite.org/pragma.html

What do I achieve by updating sqlite_master? Until now I thought that it is just
a kind of log for DDL-statements.

Oliver


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] change sqlite table column type

2010-11-15 Thread Jay A. Kreibich
On Mon, Nov 15, 2010 at 02:56:47PM +, Oliver Peters scratched on the wall:
 Jay A. Kreibich j...@... writes:
 
You can also live dangerously and set PRAGMA writable_schema=1,
allowing you to UPDATE the sqlite_master table directly.
 
 is this PRAGMA documented?

  No, not on the website.  It is considered a private PRAGMA.

 What do I achieve by updating sqlite_master?

  The SQL in sqlite_master is the definitive table definition.  It is
  re-parsed every time the database is open.  This is how SQLite knows
  and understands the internal data structures of the database file.

  Changing column types is usually OK, but modifing sqlite_master makes
  it very easy to corrupt a database file.  I would avoid it unless
  you're somewhat knowledgable of SQLite's internals and, of course,
  you're working on a backup copy of the database.

   -j

-- 
Jay A. Kreibich  J A Y  @  K R E I B I.C H 

Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable. -- Angela Johnson
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] change sqlite table column type

2010-11-15 Thread Kees Nuyt
On Mon, 15 Nov 2010 14:56:47 + (UTC), Oliver Peters
oliver@web.de wrote:

Jay A. Kreibich j...@... writes:

[...]
 
   You can also live dangerously and set PRAGMA writable_schema=1,
   allowing you to UPDATE the sqlite_master table directly.
 
-j
 

is this PRAGMA documented? Can't find it here http://www.sqlite.org/pragma.html

No, it is undocumented and unsupported. Use at your own risk.
It is easy to destroy a database using it, and nobody can help you
recover it.

What do I achieve by updating sqlite_master? Until now I thought
that it is just a kind of log for DDL-statements.

The table- index- view- and trigger metadata is only stored in the
sql column in sqlite_master. It is parsed on every sqlite3_open*().
The in-memory structures you see with PRAGMA table_info() and PRAGMA
index_info() are the result of that parsing.

Oliver
-- 
  (  Kees Nuyt
  )
c[_]
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] change sqlite table column type

2010-11-14 Thread lizhe

Dear Sir:
  I have a table type is blob,I think update  integer type, 
  How to solve my trouble? alter SQL?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] change sqlite table column type

2010-11-14 Thread Drake Wilson
Quoth lizhe l...@liustech-tj.cn, on 2010-11-15 10:59:40 +0800:
 Dear Sir:
   I have a table type is blob,I think update  integer type, 
   How to solve my trouble? alter SQL?

No.  If you really need that you'll need to recreate the table.  But
manifest typing means you probably don't need it as much as you think.
http://sqlite.org/lang_altertable.html shows that modifying existing
column types in-place is not available.

   --- Drake Wilson
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users