Swoole-src: How to prepare a statement using swoole-mysql?

Created on 14 Oct 2017  路  9Comments  路  Source: swoole/swoole-src

I cannot find prepare method. Only query is available. any supports?

coroutine enhancement

Most helpful comment

The prepare method is not currently supported. You can use escape and query instead of prepare.
We will support prepare in this version of 2.0.11

All 9 comments

use escape to sanitize use input

escaping is not the same as prepare. prepare can be faster for the same query running multiple times with different bindings.

sad enough, swoole doesn't have it.
mysql support for swoole is built from scratch, obviously prepare just has not been implemented.
so yeah, it's gonna take extra work and got worse performance to do it manually in PHP.

prepare does not give a noticable performance improvement in most cases. pdo does emulated prepare by default for that reason. swoole has very limited contributors. you can manually implement a emulated prepare just like pdo.

@gouchaoer for event-driven server side program, the performance increase a lot.

The prepare method is not currently supported. You can use escape and query instead of prepare.
We will support prepare in this version of 2.0.11

@matyhtf That's great. I am looking forward to this.

@matyhtf is there going to be an info on that in the docs?

Was this page helpful?
0 / 5 - 0 ratings