Preprocessing

Last updated: 2020-05-11 14:32:16

If you want to view or download the full set of development documents, please see Development Guide for TDSQL.

TDSQL supports preprocessing, which are used in the same way as in standalone MySQL. Below are some examples:

  • PREPARE Syntax
  • EXECUTE Syntax

Supported binary protocols:

  • COM_STMT_PREPARE
  • COM_STMT_EXECUTE

Sample:

    mysql> select * from test1;
    +---+------+
    | a | b    |
    +---+------+
    | 5 |    6 |
    | 3 |    4 |
    | 1 |    2 |
    +---+------+
    3 rows in set (0.03 sec)

    mysql> prepare ff from "select * from test1 where a=?";
    Query OK, 0 rows affected (0.00 sec)
    Statement prepared

    mysql> set @aa=3;
    Query OK, 0 rows affected (0.00 sec)

    mysql> execute ff using @aa;
    +---+------+
    | a | b    |
    +---+------+
    | 3 |    4 |
    +---+------+
    1 row in set (0.06 sec)

Was this page helpful?

Was this page helpful?

  • Not at all
  • Not very helpful
  • Somewhat helpful
  • Very helpful
  • Extremely helpful
Send Feedback
Help