Page MenuHomePhabricator
Authored By
stwalkerster
Jan 25 2017, 11:52 PM
Size
1 KB
Referenced Files
None
Subscribers
None
MariaDB [test]> create table mytable (
-> id varchar(50) not null,
-> name varchar(50) null default '',
-> primary key (id));
Query OK, 0 rows affected (0.26 sec)
MariaDB [test]> create view myview as
-> select id,name from mytable;
Query OK, 0 rows affected (0.05 sec)
MariaDB [test]>
MariaDB [test]> insert into mytable values ('1','aaa');
Query OK, 1 row affected (0.03 sec)
MariaDB [test]> insert into mytable values ('2','bbb');
Query OK, 1 row affected (0.03 sec)
MariaDB [test]> insert into mytable values ('3','ccc');
Query OK, 1 row affected (0.03 sec)
MariaDB [test]> select * from mytable;
+----+------+
| id | name |
+----+------+
| 1 | aaa |
| 2 | bbb |
| 3 | ccc |
+----+------+
3 rows in set (0.00 sec)
MariaDB [test]> select * from myview;
+----+------+
| id | name |
+----+------+
| 1 | aaa |
| 2 | bbb |
| 3 | ccc |
+----+------+
3 rows in set (0.01 sec)
MariaDB [test]> prepare cmd from 'select id,name from mytable where id=?';
Query OK, 0 rows affected (0.00 sec)
Statement prepared
MariaDB [test]> set @param1 = '2';
Query OK, 0 rows affected (0.06 sec)
MariaDB [test]> execute cmd using @param1;
+----+------+
| id | name |
+----+------+
| 2 | bbb |
+----+------+
1 row in set (0.00 sec)
MariaDB [test]> deallocate prepare cmd;
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> prepare cmd from 'select id,name from myview where id=?';
Query OK, 0 rows affected (0.00 sec)
Statement prepared
MariaDB [test]> set @param1 = '2';
Query OK, 0 rows affected (0.01 sec)
MariaDB [test]> execute cmd using @param1;
ERROR 1615 (HY000): Prepared statement needs to be re-prepared
MariaDB [test]> deallocate prepare cmd;
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]>

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6693
Default Alt Text
(1 KB)

Event Timeline