Browse Source

execute_batch api

Anton Lebedevich 13 years ago
parent
commit
5b58d0d67e
3 changed files with 12 additions and 1 deletions
  1. 4 0
      src/apgsql.erl
  2. 4 0
      src/ipgsql.erl
  3. 4 1
      src/pgsql.erl

+ 4 - 0
src/apgsql.erl

@@ -11,6 +11,7 @@
          parse/4,
          bind/4,
          execute/4,
+         execute_batch/2,
          describe/3,
          close/3,
          sync/1,
@@ -45,6 +46,9 @@ bind(C, Statement, PortalName, Parameters) ->
 execute(C, Statement, PortalName, MaxRows) ->
     cast(C, {execute, Statement, PortalName, MaxRows}).
 
+execute_batch(C, Batch) ->
+    cast(C, {execute_batch, Batch}).
+
 describe(C, statement, Name) ->
     cast(C, {describe_statement, Name});
 

+ 4 - 0
src/ipgsql.erl

@@ -11,6 +11,7 @@
          parse/4,
          bind/4,
          execute/4,
+         execute_batch/2,
          describe/3,
          close/3,
          sync/1,
@@ -45,6 +46,9 @@ bind(C, Statement, PortalName, Parameters) ->
 execute(C, Statement, PortalName, MaxRows) ->
     incremental(C, {execute, Statement, PortalName, MaxRows}).
 
+execute_batch(C, Batch) ->
+    incremental(C, {execute_batch, Batch}).
+
 describe(C, statement, Name) ->
     incremental(C, {describe_statement, Name});
 

+ 4 - 1
src/pgsql.erl

@@ -6,7 +6,7 @@
 -export([connect/2, connect/3, connect/4, close/1]).
 -export([get_parameter/2, squery/2, equery/2, equery/3]).
 -export([parse/2, parse/3, parse/4, describe/2, describe/3]).
--export([bind/3, bind/4, execute/2, execute/3, execute/4]).
+-export([bind/3, bind/4, execute/2, execute/3, execute/4, execute_batch/2]).
 -export([close/2, close/3, sync/1]).
 -export([with_transaction/2]).
 -export([sync_on_error/2]).
@@ -87,6 +87,9 @@ execute(C, S, N) ->
 execute(C, S, PortalName, N) ->
     gen_server:call(C, {execute, S, PortalName, N}, infinity).
 
+execute_batch(C, Batch) ->
+    gen_server:call(C, {execute_batch, Batch}, infinity).
+
 %% statement/portal functions
 
 describe(C, #statement{name = Name}) ->