Page MenuHomePhabricator

(An Untitled Masterwork)
ActivePublic

Authored by stwalkerster on Jan 25 2017, 11:55 PM.
Tags
None
Referenced Files
F7610:
Jan 25 2017, 11:55 PM
Subscribers
None
[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>

Event Timeline

import-bot changed the edit policy from "All Users" to "Community (Project)".Feb 3 2017, 3:03 PM