From http://examples.oreilly.com/rubyrails/ I downloaded src-start-
chapter-4.zip and extraced the following file, which fails to import
correctly. Is this a syntax problem, a database password problem, or
what?
thufir@arrakis ~/oreilly-photos $
thufir@arrakis ~/oreilly-photos $ cat db/slideshow_data.sql -n | head -n 2
1 insert into slideshows values (1, ''Interesting
pictures'', now());
2 insert into slides values (1, 1, 1, 1);
thufir@arrakis ~/oreilly-photos $
thufir@arrakis ~/oreilly-photos $ source db/slideshow_data.sql
bash: db/slideshow_data.sql: line 1: syntax error near unexpected token `
(''
bash: db/slideshow_data.sql: line 1: `insert into slideshows values (1,
''Interesting pictures'', now())''
thufir@arrakis ~/oreilly-photos $
thufir@arrakis ~/oreilly-photos $ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 43
Server version: 5.0.44-log Gentoo Linux mysql-5.0.44
Type ''help;'' or ''\h'' for help. Type
''\c'' to clear the buffer.
mysql> select * from oreilly_photos_development.slide_shows;
+----+------+---------------------+
| id | name | created_at |
+----+------+---------------------+
| 1 | foo | 2008-01-30 00:13:50 |
| 2 | bar | 2008-01-30 00:53:23 |
| 3 | baz | 2008-01-30 01:34:39 |
| 4 | blah | 2008-01-30 01:35:21 |
+----+------+---------------------+
4 rows in set (0.50 sec)
mysql> insert into oreilly_photos_development.slide_shows
(name,created_at) values ("again",NOW());
Query OK, 1 row affected (1.42 sec)
mysql> select * from oreilly_photos_development.slide_shows;
+----+-------+---------------------+
| id | name | created_at |
+----+-------+---------------------+
| 1 | foo | 2008-01-30 00:13:50 |
| 2 | bar | 2008-01-30 00:53:23 |
| 3 | baz | 2008-01-30 01:34:39 |
| 4 | blah | 2008-01-30 01:35:21 |
| 5 | again | 2008-01-30 03:18:28 |
+----+-------+---------------------+
5 rows in set (0.00 sec)
mysql> quit;
Bye
thufir@arrakis ~/oreilly-photos $
thanks,
Thufir
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On Wed, 30 Jan 2008 11:21:04 +0000, Thufir wrote:> From http://examples.oreilly.com/rubyrails/ I downloaded src-start- > chapter-4.zip and extraced the following file, which fails to import > correctly. Is this a syntax problem, a database password problem, or > what?Just to clarify, it can be done, but not at all in the way which the oreilly book says: thufir@arrakis ~/oreilly-photos $ thufir@arrakis ~/oreilly-photos $ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 47 Server version: 5.0.44-log Gentoo Linux mysql-5.0.44 Type ''help;'' or ''\h'' for help. Type ''\c'' to clear the buffer. mysql> select * from oreilly_photos_development.slide_shows; +----+-------+---------------------+ | id | name | created_at | +----+-------+---------------------+ | 1 | foo | 2008-01-30 00:13:50 | | 2 | bar | 2008-01-30 00:53:23 | | 3 | baz | 2008-01-30 01:34:39 | | 4 | blah | 2008-01-30 01:35:21 | | 5 | again | 2008-01-30 03:18:28 | | 6 | again | 2008-01-30 03:50:31 | +----+-------+---------------------+ 6 rows in set (0.00 sec) mysql> quit; Bye thufir@arrakis ~/oreilly-photos $ thufir@arrakis ~/oreilly-photos $ cat db/data.sql insert into oreilly_photos_development.slide_shows (name,created_at) values ("fubar",NOW()); thufir@arrakis ~/oreilly-photos $ thufir@arrakis ~/oreilly-photos $ source db/data.sql bash: db/data.sql: line 1: syntax error near unexpected token `('' bash: db/data.sql: line 1: ` insert into oreilly_photos_development.slide_shows (name,created_at) values ("fubar",NOW());'' thufir@arrakis ~/oreilly-photos $ thufir@arrakis ~/oreilly-photos $ mysql -u root -p < db/data.sql Enter password: thufir@arrakis ~/oreilly-photos $ thufir@arrakis ~/oreilly-photos $ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 49 Server version: 5.0.44-log Gentoo Linux mysql-5.0.44 Type ''help;'' or ''\h'' for help. Type ''\c'' to clear the buffer. mysql> select * from oreilly_photos_development.slide_shows; +----+-------+---------------------+ | id | name | created_at | +----+-------+---------------------+ | 1 | foo | 2008-01-30 00:13:50 | | 2 | bar | 2008-01-30 00:53:23 | | 3 | baz | 2008-01-30 01:34:39 | | 4 | blah | 2008-01-30 01:35:21 | | 5 | again | 2008-01-30 03:18:28 | | 6 | again | 2008-01-30 03:50:31 | | 7 | fubar | 2008-01-30 03:54:55 | +----+-------+---------------------+ 7 rows in set (0.00 sec) mysql> quit; Bye thufir@arrakis ~/oreilly-photos $ thanks, Thufir --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---