Perl DBI insert multiple rows using mysql native multiple insert ability

后端 未结 3 1861
花落未央
花落未央 2021-01-04 09:14

Has anyone seen a DBI-type module for Perl which capitalizes, easily, on MySQL\'s multi-insert syntax

insert into TBL (col1, col2, col3) values (1,2,3),(4,5,6

3条回答
  •  独厮守ぢ
    2021-01-04 09:51

    If DBD::mysql supported DBI's execute_for_fetch (see DBI's execute_array and execute_for_fetch) this is the typical usage scenario i.e., you have multiple rows of inserts/updates/deletes available now and want to send them in one go (or in batches). I've no idea if the mysql client libs support sending multiple rows of bound parameters in one go but most other database client libs do and can take advantage of DBI's execute_array/execute_for_fetch. Unfortunately few DBDs actually implement execute_array/execute_for_fetch and rely on DBI implementing it one row at a time.

提交回复
热议问题