Questions tagged [soci]

SOCI is a database access library for C++ that makes the illusion of embedding SQL queries in the regular C++ code, staying entirely within the Standard C++. The idea is to provide C++ programmers a way to access SQL databases in the most natural and intuitive way.

104 questions
1
vote
1 answer

How do I bind output from a SOCI query?

The following code :generates error messages, which follow: bool UACmUsers::GetUser(int userid) { soci::session sql(dbU::Connection()); sql << "SELECT userid, username, password FROM uac_users WHERE userid = \":user\"", …
J Vines
  • 182
  • 1
  • 16
1
vote
1 answer

undefined reference to soci::session::get_last_insert_id

So, I have downloaded soci 4.0.0 from souceforge and unpacked it into /tmp/. Then: cd /tmp/soci-4.0.0 mkdir build cd build cmake -G "Unix Makefiles" -DWITH_BOOST=OFF -DWITH_ORACLE=OFF -DSOCI_TESTS=ON -DWITH_SQLITE3=ON…
Petr
  • 1,159
  • 10
  • 20
1
vote
0 answers

Why in SOCI database type REAL is std::string when using SQLite3 as backend?

I'm trying Object-Relational Mapping in C++ SOCI library with SQLite3 backend. But when I try to load from database REAL value as C++'s double the std::bad_cast is being thrown. Full code: #include #include #include…
baziorek
  • 2,502
  • 2
  • 29
  • 43
1
vote
1 answer

How to get soci::rowset in sql query

I have a table with a column name and age. And I am trying to get all name as soci::session& sql_session(conn->Session()); soci::rowset rs = sql_session.prepare << select name from Person; std::vector
atulya
  • 535
  • 2
  • 8
  • 25
1
vote
1 answer

Set autocommit off in PostgreSQL with SOCI C++

This is an answer rather than a question which I need to state in SO anyway. I was struggle with this question ("how to turn off autocommit when using soci library with PostgreSQL databases") for a long time and came up with several solutions. In…
Amith Chinthaka
  • 1,015
  • 1
  • 17
  • 24
1
vote
1 answer

How to register a DB failover callback in SOCI?

I connect to the database using the SOCI library and I want to obtain database fail-over events for logging purposes. I'm not sure what interface to implement and how to do the callback registration. Is there such support in SOCI?
Sampath
  • 1,144
  • 1
  • 21
  • 38
1
vote
0 answers

Segmentation Fault with SOCI rowset

I get a segmentation fault when using SOCI rowset. Here is a simplified version of my code: query << "select * from mytable"; soci::rowset rs = (sql.prepare << query.str()); Here is an excerpt from gdb: Thread 3 "MyProgram" received…
Andrea Araldo
  • 1,332
  • 14
  • 20
1
vote
0 answers

SOCI bind into a rowset pointer when using Core Interface

I have following code which I try to use SOCI's core interface and get the result to a rowset object.This code perfectly works but I dont find anyway to get the result set directly to a rowset pointer. int main(int argc, char* argv[]) { …
Isura Nirmal
  • 777
  • 1
  • 9
  • 26
1
vote
1 answer

Does soci support Binary_Double data type?

When executing query via SOCI Handler, following error occurred. db column type 32556 not supported for dynamic selects I want to know whether SOCI supports BINARY_DOUBLE data type.
YatShan
  • 425
  • 2
  • 8
  • 22
1
vote
1 answer

Soci print out all data in table by rows

Without knowing the schema, how can I do the above? This is what I have so far: row r; soci::statement st = (mSql->prepare << "select * from tab", soci::into(r)); st.execute(); while (st.fetch()) { //want a…
user7537486
1
vote
1 answer

How to do a dynamic binding to a PL/pgSQL function using SOCI?

I have this PostgreSQL PL/pgSQL function: CREATE OR REPLACE FUNCTION get_people() RETURNS SETOF people AS $$ BEGIN RETURN QUERY SELECT * FROM people; END; $$ LANGUAGE plpgsql; Then I try to read the data in an application using SOCI, with this…
eXe
  • 186
  • 2
  • 9
1
vote
0 answers

Storing and Retrieving a BLOB from PostgreSQL using SOCI

Thank you for reading my question. We are accessing a Postgres database through SOCI. The schema requires to have tables that contain BLOB fields. Based on PostgreSQL documentation, the ideal type to store a BLOB in a Postgres table is…
Sampath
  • 1,144
  • 1
  • 21
  • 38
1
vote
0 answers

SOCI Bulk Insert using statement

I am working with SOCI in cpp statement sql = (db.prepare << "insert into table(bunch of columns) " "values(:s,:e,:qs,:qe, :ts,:te, :qi, :ti,:tutr, :q_oc,:q_g, " ":q_ref, :t_loc, :t_org, :t_ref)", use(s, use(e), use(q),…
1
vote
2 answers

How to build SOCI with PostgreSQL?

I'm trying to build the SOCI library to run with PostgreSQL. I followed these steps: Install PostgreSQL in Ubutu 15.10 Download SOCI source code Extract SOCI code I then run the following commands: mkdir build cd build cmake -G "Unix Makefiles"…
Sujith Gunawardhane
  • 1,251
  • 1
  • 10
  • 24
1
vote
0 answers

Number(10) to/from int converion in SOCI/Oracle

I have encountered a problem when trying to convert between NUMBER(10) data type of Oracle DB and int(soci::dt_integer). The problem is that the integer range is within NUMBER(10) although NUMBER(10) is actually dt_long_long. When I try to convert…
Sanka Darshana
  • 1,391
  • 1
  • 23
  • 41