database/sql client side prepared bulk statement

952 views
Skip to first unread message

Johann Höchtl

unread,
Mar 30, 2013, 4:25:42 AM3/30/13
to golan...@googlegroups.com
I will have to insert a couple of rows into a table. Exec only gives me the option to do this by row. Is there any option to prepare an statement, bind multiple rows and execute this at once? I would like to avoid to hit the wire 50 times for inserting 50 rows.

Sure, I could assemble "INSERT INTO a(col1, col2) VALUES (1,2), (3,4) ... " by hand, but I would loose the security of prepared statements.

Johann

Brad Fitzpatrick

unread,
Mar 31, 2013, 2:20:34 AM3/31/13
to Johann Höchtl, golang-nuts
Not currently.

File a bug with what the API feels like it another language or two.





Johann

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Johann Höchtl

unread,
Mar 31, 2013, 5:24:47 AM3/31/13
to Brad Fitzpatrick, golang-nuts
On 03/31/2013 08:20 AM, Brad Fitzpatrick wrote:
> Not currently.
>
> File a bug with what the API feels like it another language or two.
>
>
Thank you, http://code.google.com/p/go/issues/detail?id=5171
Mentioning C# and Python DB API proposal 2.0
>
> On Sat, Mar 30, 2013 at 1:25 AM, Johann Höchtl <johann....@gmail.com
> <mailto:johann....@gmail.com>> wrote:
>
> I will have to insert a couple of rows into a table. Exec only gives
> me the option to do this by row. Is there any option to prepare an
> statement, bind multiple rows and execute this at once? I would like
> to avoid to hit the wire 50 times for inserting 50 rows.
>
> Sure, I could assemble "INSERT INTO a(col1, col2) VALUES (1,2),
> (3,4) ... " by hand, but I would loose the security of prepared
> statements.
>
> Johann
>
> --
> You received this message because you are subscribed to the Google
> Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to golang-nuts...@googlegroups.com
> <mailto:golang-nuts%2Bunsu...@googlegroups.com>.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


--
Dr. Johann Höchtl
http://www.facebook.com/myprivate42
https://plus.google.com/109572797756514902540
Reply all
Reply to author
Forward
0 new messages