I just ran your code on 3.6.23.1 and it works just fine.
 
Can you try a newer version?
 
x.sql:
create table mytable (id VARCHAR(255), name VARCHAR(255), address VARCHAR(255), 
PRIMARY KEY(id));
insert into mytable (id, name, address) VALUES ('123abc','charlie', '123 st');
insert into mytable (id, name, address) VALUES ('yyzz', 'bob', '456nowhere');

SQLite version 3.6.23.1
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .read x.sql
sqlite> select * from mytable;
123abc|charlie|123 st
yyzz|bob|456nowhere
 
 
Michael D. Black
Senior Scientist
Advanced Analytics Directorate
Northrop Grumman Information Systems
 

________________________________

From: sqlite-users-boun...@sqlite.org on behalf of Benoit Aubuchon
Sent: Tue 8/3/2010 4:55 PM
To: sqlite-users@sqlite.org
Subject: EXTERNAL:[sqlite] Command line tool always return the first column in 
a select



Everytime I select something from a table I always get the first selected
field only. Here's what I mean:

# sqlite3 mytable.db
SQLite version 3.6.22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
*sqlite> .show*
     echo: off
  explain: off
  headers: off
     mode: list
nullvalue: ""
   output: stdout
separator: "|"
    width:
*sqlite> create table mytable (id VARCHAR(255), name VARCHAR(255), address
VARCHAR(255), PRIMARY KEY(id));*
*sqlite> insert into mytable (id, name, address) VALUES ('123abc',
'charlie', '123 st');*
*sqlite> insert into mytable (id, name, address) VALUES ('yyzz', 'bob', '456
nowhere');*
*sqlite> select * from mytable;*
123abc
yyzz
*sqlite> .head ON*
*sqlite> select * from mytable;*
id
123abc
yyzz
*sqlite> select id, name, address from mytable;*
id
123abc
yyzz
*sqlite> select name from mytable;*
name
charlie
bob
*sqlite> select name, address from mytable;*
name
charlie
bob
*sqlite> select address, id from mytable;*
address
123 st
456 nowhere
*sqlite> .dump*
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE mytable (id VARCHAR(255), name VARCHAR(255), address
VARCHAR(255), PRIMARY KEY(id));
INSERT INTO "mytable" VALUES('123abc','charlie','123 st');
INSERT INTO "mytable" VALUES('yyzz','bob','456 nowhere');
COMMIT;
*sqlite> select id, name, address from mytable;*
id
123abc
yyzz
*sqlite> .mode csv*
*sqlite> select id, name, address from mytable;*
id
123abc
yyzz
*sqlite> .mode line*
*sqlite> select id, name, address from mytable;*
   id = 123abc

   id = yyzz
*sqlite> select * from mytable;*
   id = 123abc

   id = yyzz
*sqlite> .dump*
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE mytable (id VARCHAR(255), name VARCHAR(255), address
VARCHAR(255), PRIMARY KEY(id));
INSERT INTO "mytable" VALUES('123abc','charlie','123 st');
INSERT INTO "mytable" VALUES('yyzz','bob','456 nowhere');
COMMIT;

# uname -a
Linux appserver1 2.6.32-gentoo-r1 #1 SMP Wed Jan 13 05:48:57 EST 2010 x86_64
Intel(R) Xeon(R) CPU X5550 @ 2.67GHz GenuineIntel GNU/Linux

If I use sqlite from PHP it works as expected. Its only from the command
line that it doesn't show the other fields.

Has anyone encountered this problem before?

Thanks

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


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

Reply via email to