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
0
votes
1 answer

SOCI Vector of row

I'm trying to get a vector of row from SOCI, but I can't seem to work it out. I need a function to return a vector of row data from a sql statement. What I think is the right approach: vector GetRows(string input) { session…
0
votes
1 answer

Why I have not enough privilege to database when I use soci to connect to postgresql?

I can correctly use soci to connect to mysql and execute sql. But the same way to postgresql does not work. this is my makefile and main.cpp: all: main.cpp g++ -Wall -g -o main main.cpp -lpq -lsoci_core -lsoci_postgresql -ldl clean: And…
lxc
  • 67
  • 9
0
votes
0 answers

C++ querying through Soci doesn't work on computer that is not the owner

So I have this code: soci::session* mSql; mSql = new soci::session("sqlite3", "database.db"); soci::rowset rs = (mSql->prepare << "SELECT * FROM tab"); When I run this on the machine that created it, it works…
user8137073
0
votes
0 answers

Code for BLOB Insert to DB2 v11.1 through SOCI

Can anyone post a sample soci code-cut to Insert and Fetch BLOB to a table in db2 with version 11.1 ? The following Statement working fine in DB2 v10.5 through soci, but not in DB2 v11.1. statement Stmt = (sql->prepare<<"INSERT INTO TABLE_BLOB…
Yusuf
  • 11
  • 1
0
votes
1 answer

SOCI ODBC Connection ERROR

I am trying to connect the SOCI library to my database but keep on receiving this error on my VS compiler output. My code is : { try { backend_factory const& backEnd = odbc; std::string const & connectString =…
Erdos_x
  • 3
  • 1
0
votes
2 answers

SOCI clob data type in oracle c++

can someone say how to handle CLOB datatype in SOCI C++? I want to know how to read CLOB data column values in oracle using C++ SOCI. I tried to use BLOB type in SOCI but It gives an error. Oracle error 932: inconsistent datatypes expected %s got %s…
Noah
  • 55
  • 7
0
votes
1 answer

Why SOCI regression tests for PostgreSQL fail on Windows?

I build and test SOCI 3.2 on Windows 10 with Visual Studio 2015, using this batch: SET PREFIX=..\soci-3.2.3-install SET POSTGRES_DIR=E:\PostgreSQL\9.5 cmake^ -G "NMake Makefiles"^ -DCMAKE_BUILD_TYPE=Release^ -DCMAKE_INSTALL_PREFIX=%PREFIX%^ …
eXe
  • 186
  • 2
  • 9
0
votes
0 answers

How to set the library suffix on CMake for SOCI?

I am trying to build SOCI on Windows with a different library suffix using the CMAKE_SHARED_LIBRARY_SUFFIX option, but the script seems to ignore it. Here is the command I run in a batch file: cmake^ -G "NMake Makefiles"^ …
eXe
  • 186
  • 2
  • 9
0
votes
1 answer

Difference between soci::i_ok and soci::i_null

I could not find an explanation of the soci::i_ok and soci::i_null constants. They are mentioned in this page as possible states of data, but their exact meaning is not defined. I was wondering if soci::i_ok is true does it mean that the data is not…
Sampath
  • 1,144
  • 1
  • 21
  • 38
0
votes
2 answers

SOCI, pgsql function returning table record - type_conversion not working

I have a pgsql function declared as: CREATE FUNCTION auth.read_session(session_id varchar) RETURNS auth.sessions It returns one record from the table auth.sessions. I have a SOCI type_conversion that works perfectly fine when I run select * from…
PadThink
  • 11
  • 1
0
votes
2 answers

How to provide the values corresponding to the placeholders in soci?

I'm using soci 3.2.2. I'm looking for a way to provide multiple placeholders and corresponding values. std::vector vs; vs.push_back("key1"); vs.push_back("key2"); sql << "select * from mytable as t where t.field1 = :f1 and t.field2 =…
Takatoshi Kondo
  • 3,111
  • 17
  • 36
0
votes
1 answer

Linking error using soci 3.2.3 instead of 3.2.2

I have a project which uses soci for DB access. The project was originally developed with soci 3.2.2. Now I switched to soci 3.2.3 and get the following linker error messages: error LNK2001: unresolved external symbol "public: class…
shearer
  • 94
  • 7
0
votes
1 answer

Get bigint from Microsoft SQL Server with SOCI

I am trying to get a bigint value (named "NUM" in my example) that comes from my database (Microsoft SQL Server). In the following code, I am trying to get it as an int even if I know that an int is smaller than a bigint but the cast always fails. I…
Aleph0
  • 470
  • 2
  • 10
  • 27
0
votes
1 answer

SOCI rowset weird error

I recently installed SOCI library for my project because it requires working with SQLite database. I tried to fetch rowset but I got weird error: "c:\mingw\include\soci\exchange-traits.h:35:5: error: incomplete type…
Oded
  • 72
  • 1
  • 8
0
votes
1 answer

SOCI Session Sql return Values

In my office I m asked to write some test cases on basic areas where db connections check and test, so that is a technology we gona implement newly so nobody there to ask for helping hand well and what they asked it to do for me is write…
RezgHansa
  • 45
  • 11