File: insertdata.ecpp

package info (click to toggle)
tntnet 3.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,488 kB
  • sloc: cpp: 16,636; javascript: 8,109; ansic: 2,189; makefile: 861; sh: 317; xml: 258; perl: 159; sql: 14
file content (28 lines) | stat: -rw-r--r-- 494 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<%include>action.ecpp</%include>
<%args>
int number;
name;
</%args>
<%pre>
#include <@PROJECT@/config.h>

#include <tntdb/connect.h>
#include <tntdb/statement.h>

</%pre>
<%cpp>

tntdb::Connection conn = tntdb::connectCached(@PROJECT@::Config::it().dburl());

tntdb::Statement ins = conn.prepare(R"SQL(
    insert into test(name, number)
     values (:name, :number)
)SQL");

ins.set("number", number)
   .set("name", name)
   .execute();

actionReply.information("one row inserted");

</%cpp>