Warning, /sdk/codevis/thirdparty/soci/docs/index.md is written in an unsupported language. File is not indexed.
0001 # SOCI - The C++ Database Access Library 0002 0003 SOCI is a database access library written in C++ that makes an illusion of embedding 0004 SQL queries in the regular C++ code, staying entirely within the Standard C++. 0005 0006 The idea is to provide C++ programmers a way to access SQL databases in the most natural and intuitive way. 0007 If you find existing libraries too difficult for your needs or just distracting, SOCI can be a good alternative. 0008 0009 ## Basic Syntax 0010 0011 The simplest motivating code example for the SQL query that is supposed to retrieve a single row is: 0012 0013 ```cpp 0014 int id = ...; 0015 string name; 0016 int salary; 0017 0018 sql << "select name, salary from persons where id = " << id, 0019 into(name), into(salary); 0020 ``` 0021 0022 ## Basic ORM 0023 0024 The following benefits from extensive support for object-relational mapping: 0025 0026 ```cpp 0027 int id = ...; 0028 Person p; 0029 0030 sql << "select first_name, last_name, date_of_birth " 0031 "from persons where id = " << id, into(p); 0032 ``` 0033 0034 ## Integrations 0035 0036 Integration with STL is also supported: 0037 0038 ```cpp 0039 Rowset<string> rs = (sql.prepare << "select name from persons"); 0040 std::copy(rs.begin(), rs.end(), std::ostream_iterator<std::string>(std::cout, "\n")); 0041 ``` 0042 0043 SOCI offers also extensive [integration with Boost](boost.md) datatypes (optional, tuple and fusion) and flexible support for user-defined datatypes. 0044 0045 ## Database Backends 0046 0047 Starting from its 2.0.0 release, SOCI uses the plug-in architecture for 0048 backends - this allows to target various database servers. 0049 0050 Currently (SOCI 4.0.3), backends for following database systems are supported: 0051 0052 * [DB2](backends/db2.md) 0053 * [Firebird](backends/firebird.md) 0054 * [MySQL](backends/mysql.md) 0055 * [ODBC](backends/odbc.md) (generic backend) 0056 * [Oracle](backends/oracle.md) 0057 * [PostgreSQL](backends/postgresql.md) 0058 * [SQLite3](backends/sqlite3.md) 0059 0060 The intent of the library is to cover as many database technologies as possible. 0061 For this, the project has to rely on volunteer contributions from other programmers, 0062 who have expertise with the existing database interfaces and would like to help 0063 writing dedicated backends. 0064 0065 ## Language Bindings 0066 0067 Even though SOCI is mainly a C++ library, it also allows to use it from other programming languages. 0068 Currently the package contains the Ada binding, with more bindings likely to come in the future.