Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F7610
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Authored By
stwalkerster
Jan 25 2017, 11:55 PM
2017-01-25 23:55:51 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
[23:54:33][stwalkerster@fearow:~]
bash $ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 628085
Server version: 5.5.54-0ubuntu0.14.04.1-log (Ubuntu)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use stwalkerster_test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> create table mytable (
-> id varchar(50) not null,
-> name varchar(50) null default '',
-> primary key (id));
Query OK, 0 rows affected (0.01 sec)
mysql>
mysql> create view myview as
-> select id,name from mytable;
Query OK, 0 rows affected (0.01 sec)
mysql>
mysql> insert into mytable values ('1','aaa');
Query OK, 1 row affected (0.00 sec)
mysql> insert into mytable values ('2','bbb');
Query OK, 1 row affected (0.00 sec)
mysql> insert into mytable values ('3','ccc');
Query OK, 1 row affected (0.00 sec)
mysql> select * from mytable;
+----+------+
| id | name |
+----+------+
| 1 | aaa |
| 2 | bbb |
| 3 | ccc |
+----+------+
3 rows in set (0.00 sec)
mysql> select * from myview;
+----+------+
| id | name |
+----+------+
| 1 | aaa |
| 2 | bbb |
| 3 | ccc |
+----+------+
3 rows in set (0.00 sec)
mysql> prepare cmd from 'select id,name from mytable where id=?';
Query OK, 0 rows affected (0.00 sec)
Statement prepared
mysql> set @param1 = '2';
Query OK, 0 rows affected (0.00 sec)
mysql> execute cmd using @param1;
+----+------+
| id | name |
+----+------+
| 2 | bbb |
+----+------+
1 row in set (0.00 sec)
mysql> deallocate prepare cmd;
Query OK, 0 rows affected (0.00 sec)
mysql> prepare cmd from 'select id,name from myview where id=?';
Query OK, 0 rows affected (0.00 sec)
Statement prepared
mysql> set @param1 = '2';
Query OK, 0 rows affected (0.00 sec)
mysql> execute cmd using @param1;
+----+------+
| id | name |
+----+------+
| 2 | bbb |
+----+------+
1 row in set (0.00 sec)
mysql> deallocate prepare cmd;
Query OK, 0 rows affected (0.00 sec)
mysql>
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6694
Default Alt Text
(2 KB)
Attached To
Mode
P91 (An Untitled Masterwork)
Attached
Detach File
Event Timeline
Log In to Comment