zoukankan      html  css  js  c++  java
  • mysql 预处理

    mysql> prepare getpdo from 'select * from pdo where id=?';

    ERROR 1146 (42S02): Table 'yanruicheng.pdo' doesn't exist

    mysql> prepare getpdo from 'select * from class where id=?'

        -> ;

    Query OK, 0 rows affected (0.01 sec)

    Statement prepared

    mysql> set @id = 6;

    Query OK, 0 rows affected (0.00 sec)

    mysql> execute getpdo;

    ERROR 1210 (HY000): Incorrect arguments to EXECUTE

    mysql> execute getpdo using @id;

    +----+--------+--------+--------+-------+

    | id | same   | gender | salary | funbu |

    +----+--------+--------+--------+-------+

    |  6 | 刘备   | 男     | 8000   |  1.00 |

    +----+--------+--------+--------+-------+

    1 row in set (0.00 sec)

    mysql> set @id=5;

    Query OK, 0 rows affected (0.00 sec)

    mysql> execute getpdo using @id;

    +----+--------+--------+--------+-------+

    | id | same   | gender | salary | funbu |

    +----+--------+--------+--------+-------+

    |  5 | 刘备   | 男     | 8000   |  1.00 |

    +----+--------+--------+--------+-------+

    1 row in set (0.00 sec)

    mysql> set @id=5 or 1;

    Query OK, 0 rows affected (0.00 sec)

    mysql> execute getpdo using @id;

    +----+--------+--------+--------+-------+

    | id | same   | gender | salary | funbu |

    +----+--------+--------+--------+-------+

    |  1 | 刘备   | 男     | 8000   |  1.00 |

    +----+--------+--------+--------+-------+

    1 row in set (0.00 sec)

    mysql>

  • 相关阅读:
    double类型的数值计算
    模拟ATM的功能
    自学Java第七周的总结
    自学java第六周的总结
    自学Java第五周的总结
    自学Java第四周的总结
    自学Java第三个星期的总结
    自学Java第二周的总结
    python-----静态方法
    python----类方法
  • 原文地址:https://www.cnblogs.com/ayanboke/p/11023009.html
Copyright © 2011-2022 走看看