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.
Questions tagged [soci]
104 questions
1
vote
1 answer
How to declare an empty rowset properly with SOCI?
Imagine that I have the following function. In case of invalid parameters or exception, the function has to exit with an empty rowset.
rowset SelectAllFromTable(string tableName)
{
session sql(odbc, "...");
// if parameters are not…

Aleph0
- 470
- 2
- 10
- 27
1
vote
2 answers
C++ linker error LNK2019 for soci ODBC
I'm building a c++ project with soci using this line of code:
session sql(odbc, "DRIVER={SQL Server};SERVER=server;DATABASE=database;UID=user;PWD=pass;");
I get this linker error message:
Error 1 error LNK2019: unresolved external…

Asken
- 7,679
- 10
- 45
- 77
1
vote
2 answers
Include soci in cmake on windows
I have a HelloWorld project in JetBrains CLion and set up boost so I can build it fine.
I've managed to build soci using cmake and make with mingw outside the HelloWorld project.
For boost I used:
include(FindBoost)
find_package(Boost 1.55.0…

Asken
- 7,679
- 10
- 45
- 77
1
vote
1 answer
COPY to remote databse from a local file
There are similar questions but they didn't address my problem:
I have a stored procedure defined in my remote database. As part of it operation, the SP has to bulk insert from a local file (through my application running on my local machine):
the…

rahman
- 4,820
- 16
- 52
- 86
1
vote
2 answers
SOCI external symbol unresolved "struct soci::mysql_backend_factory const soci::mysql"
I'm really confused, i'm stuck with this problem, i hope you can help me :
I use : Windows 8.1, Visual Studio Express 2013 and SOCI 3.2.2
I have compiled both libsoci_mysql and libsoci_core and linked them into my project, but when i launch the…

eroween
- 163
- 11
1
vote
0 answers
How to access SQLite3 native API with SOCI?
I am currently using SOCI with SQLite3. Everything was working fine until I got to the point that I needed to call a native SQLite3 function in order to enable loading custom extensions into my database (http://www.sqlite.org/loadext.html). Here is…
1
vote
1 answer
Unresolved symbol error with the soci library
I understand what an unresolved symbol error is, but I don't understand why I'm getting it in this particular situation with this particular library. Here is the output of the error.
Undefined symbols for architecture x86_64:
…

magnus
- 4,031
- 7
- 26
- 48
1
vote
0 answers
Accessing data with C++
I'm developing an application from scratch that will be installed in a system with very few resources, and it will access to a database where will save the data obtained and where other processes could query that data.
Finally I decided to use C++…

villanueva.ricardo
- 195
- 1
- 10
1
vote
1 answer
soci does not always return the same type for a NUMERIC column
I use the soci library to access an sqlite3 database:
rowset rs = (sql.prepare << "select * from my_table");
for (auto it = rs.begin(); it != rs.end(); ++it) {
int some_value = it->get(1);
// ...
}
(This is not my actual code;…

flyx
- 35,506
- 7
- 89
- 126
1
vote
1 answer
SOCI: How to deal with many columns?
I'm using SOCI to access a PostgreSQL database. One particular table that I'm inserting into and selecting from has (at present) 72 columns. My question is how does one best deal with so many columns?
I've determined that for selecting, using the…

JMW
- 31
- 4
1
vote
0 answers
C++ soci inserting row from one table into another with same structure
I have two tables in different databases but their structure is identical. It is possible that one or more columns contain "null" values. I found the following
http://soci.sourceforge.net/doc/3.2/exchange.html (See indicators)
How do I apply this to…

Anonymous
- 4,617
- 9
- 48
- 61
1
vote
1 answer
High precision timestamp in SOCI library when working with PostgreSQL
SOCI library describes binding for std::tm to work with timestamps.
std::tm structure precision is second, but PostgreSQL timestamp provides better precision.
Can you advise the optimal way to access timestamps with less than second precision?
I…

user1977560
- 11
- 1
1
vote
1 answer
Using libraries compiled with GCC in a VisualC++ project (and vice versa)
It's possible to use code (and libraries) compiled with VisualC++ (so with .lib extension) in a project that will use GCC as compiler (and vice versa)? Or I have to rebuild them?
I'm trying to use SOCI 3.1 libraries that I have compiled with…

Overflowh
- 1,103
- 6
- 18
- 40
1
vote
1 answer
How to check how many rows is in table using SOCI and C++?
Simple question. I have a table Person. I have in it two rows:
1 Joe Doe joe.doe@ymail.com
2 Vivien Doe v.doe@gmail.com
How to write a SOCI statement, which will tell me (return) how many rows I have in my table? (Here, in my example, I have 2…

Brian Brown
- 3,873
- 16
- 48
- 79
1
vote
1 answer
Soci: Create Custom class to store results
I use Soci to make database queries. Now I need to have a custom resultset class that will wrap around soci::rowset. I cannot get it work in the way my code are below simply because copy constructor is private in soci (not supported according to…

Stefano Mtangoo
- 6,017
- 6
- 47
- 93