Skip to content

Commit

Permalink
Squashed 'src/soci/' changes from 79e222e3c..b5829e7e0
Browse files Browse the repository at this point in the history
b5829e7e0 Fixed PostgreSQL BLOB destructor.
125753ff2 Merge pull request XRPLF#614 from Astrinus/master
1ea06a74a Merge pull request #1 from Astrinus/docs-refactoring
efbc6c905 Fixed broken links in ada/reference.md
6fffb447c Fixed "statemETs" typo
66301072e Fixed broken links in client.md
6cb7a8355 Corrected table and added links to backends
549e9496d Fixed typo and broken link in multithreading.md
6eb048a62 Added missing parenthesis and fixed typo
34512ffad Fixed broken links in sqlite3.md
187ae3852 Fixed broken links and typos
38260d89e Fixed some typos in oracle.md
a68698003 Fixed broken links and a typo in oracle.md
17ec47828 Fixed broken links on odbc.md
437871dd4 Fixed broken links and some typos on mysql.md
09cb2f0a6 Refix BLOB link in firebird.md
52d006dac Fix broken links in firebird.md
3ccdd69bc Fixed broken link in interfaces.md
187256316 Fixed broken link in statements.md
634846bc8 Refixed
3686325b9 Fixed broken links and corrected some typos
de8dfe81a Fixed broken internal link
789e927b7 Fixed broken links on indicators.md
19617afb3 Fixed a typo in code
367c7df58 Fix broken links and minor typos on connections.md
356b8f30f Fix broken links in installation.md
d27639d17 Added rowset & core interface interaction howto
8b00c6bd0 Merge pull request XRPLF#613 from seiyap70/patch-1
0cbc9f33c Throw a mysql exception

git-subtree-dir: src/soci
git-subtree-split: b5829e7e0fae53c5fbd06a0b15758fb943559515
  • Loading branch information
seelabs committed Jan 17, 2018
1 parent 855681a commit 2eef8d2
Show file tree
Hide file tree
Showing 21 changed files with 148 additions and 114 deletions.
28 changes: 14 additions & 14 deletions docs/api/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,24 +110,24 @@ statement st = (sql.prepare <<
"insert into numbers(value) values(:val)", use(i));
```

`operator<<` that is a shortcut forwarder to the equivalent operator of the `once` member. Example:
* `operator<<` that is a shortcut forwarder to the equivalent operator of the `once` member. Example:

```cpp
sql << "drop table persons";
```

* `got_data` returns true if the last executed query had non-empty result.
* `get_next_sequence_value` returns true if the next value of the sequence with the specified name was generated and returned in its second argument. Unless you can be sure that your program will use only databases that support sequences, consider using this method in conjunction with `get_last_insert_id()` as explained in ["Working with sequences"](beyond.html#sequences) section.
* `get_next_sequence_value` returns true if the next value of the sequence with the specified name was generated and returned in its second argument. Unless you can be sure that your program will use only databases that support sequences, consider using this method in conjunction with `get_last_insert_id()` as explained in ["Working with sequences"](../beyond.md#sequences) section.
* `get_last_insert_id` returns true if it could retrieve the last value automatically generated by the database for an auto-incremented field. Notice that although this method takes the table name, for some databases, such as Microsoft SQL Server and SQLite, this value is actually global, so you should attempt to retrieve it immediately after performing an insertion.
* `get_query_stream` provides direct access to the stream object that is used to accumulate the query text and exists in particular to allow the user to imbue specific locale to this stream.
* `set_log_stream` and `get_log_stream` functions for setting and getting the current stream object used for basic query logging. By default, it is `NULL`, which means no logging The string value that is actually logged into the stream is one-line verbatim copy of the query string provided by the user, without including any data from the `use` elements. The query is logged exactly once, before the preparation step.
* `get_last_query` retrieves the text of the last used query.
* `uppercase_column_names` allows to force all column names to uppercase in dynamic row description; this function is particularly useful for portability, since various database servers report column names differently (some preserve case, some change it).
* `get_dummy_from_table` and `get_dummy_from_clause()`: helpers for writing portable DML statements, see [DML helpers](statement.html#dml) for more details.
* `get_dummy_from_table` and `get_dummy_from_clause()`: helpers for writing portable DML statements, see [DML helpers](../utilities.md#dml) for more details.
* `get_backend` returns the internal pointer to the concrete backend implementation of the session. This is provided for advanced users that need access to the functionality that is not otherwise available.
* `get_backend_name` is a convenience forwarder to the same function of the backend object.

See [Connections and simple queries](basics.html) for more examples.
See [connection](../connections.md) and [queries](../queries.md) for more examples.

## class connection_parameters

Expand Down Expand Up @@ -230,7 +230,7 @@ int count;
sql << "select count(*) from person", into(count);
```

See [Binding local dat](exchange.html#bind_local) for more examples
See [Binding output data](../binding.md#binding-output-data-into) for more examples

## function use

Expand Down Expand Up @@ -263,7 +263,7 @@ int val = 7;
sql << "insert into numbers(val) values(:val)", use(val);
```

See [Binding local data](exchange.html#bind_local) for more examples.
See [Binding input data](../binding.md#binding-input-data-use) for more examples.

## class statement

Expand Down Expand Up @@ -330,9 +330,9 @@ statement stmt(sql);
* `exchange_for_rowset` as a special case for binding `rowset` objects.
* `get_backend` function that returns the internal pointer to the concrete backend implementation of the statement object. This is provided for advanced users that need access to the functionality that is not otherwise available.

See [Statement preparation and repeated execution](statements.html#preparation) for example uses.
See [Statement preparation and repeated execution](../statements.md) for example uses.

Most of the functions from the `statement` class interface are called automatically, but can be also used explicitly. See [Interfaces](interfaces) for the description of various way to use this interface.
Most of the functions from the `statement` class interface are called automatically, but can be also used explicitly. See [Interfaces](../interfaces.md) for the description of various way to use this interface.

## class procedure

Expand All @@ -352,7 +352,7 @@ public:

The constructor expects the result of using `prepare` on the `session` object.

See [Stored procedures](statements.html#procedures) for examples.
See [Stored procedures](../procedures.md) for examples.

## class type_conversion

Expand All @@ -372,7 +372,7 @@ struct type_conversion

Users are supposed to properly implement the `from_base` and `to_base` functions in their specializations of this template class.

See [Extending SOCI to support custom (user-defined) C++ types](exchange.html#custom_types).
See [Extending SOCI to support custom (user-defined) C++ types](../types.md#user-defined-c-types).

## class row

Expand Down Expand Up @@ -427,7 +427,7 @@ This class contains the following members:
* `operator>>` for convenience stream-like extraction interface. Subsequent calls to this function are equivalent to calling `get` with increasing position parameter, starting from the beginning.
* `skip` and `reset_get_counter` allow to change the order of data extraction for the above operator.

See [Dynamic resultset binding](exchange.html#dynamic) for examples.
See [Dynamic resultset binding](../types.md#dynamic-binding) for examples.

## class column_properties

Expand All @@ -447,7 +447,7 @@ This class contains the following members:
* `get_name` function that returns the name of the column.
* `get_data_type` that returns the type of the column.

See [Dynamic resultset binding](exchange.html#dynamic) for examples.
See [Dynamic resultset binding](../types.md#dynamic-binding) for examples.

## class values

Expand Down Expand Up @@ -498,7 +498,7 @@ This class contains the same members as the `row` class (with the same meaning)
* `set` function for storing values in named columns or in subsequent positions.
* `operator<<` for convenience.

See [Object-relational mapping](exchange.html#object_relational) for examples.
See [Object-relational mapping](../types.md#object-relational-mapping) for examples.

## class blob

Expand Down Expand Up @@ -531,7 +531,7 @@ This class contains the following members:
* `trim` function that truncates the existing data to the new length.
* `get_backend` function that returns the internal pointer to the concrete backend implementation of the BLOB object. This is provided for advanced users that need access to the functionality that is not otherwise available.

See [Large objects (BLOBs)](exchange.html#blob) for more discussion.
See [Large objects (BLOBs)](../lobs.md) for more discussion.

## class rowid

Expand Down
18 changes: 9 additions & 9 deletions docs/backends/firebird.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ int count;
sql << "select count(*) from user_tables", into(count);
```

(See the [SOCI basics](../basics.html) and [exchanging data](../exchange.html) documentation
(See the [connection](../connections.md) and [data binding](../binding.md) documentation
for general information on using the `session` class.)

## SOCI Feature Support
Expand All @@ -84,13 +84,13 @@ For the Firebird backend, this type mapping is:
[^1] There is also 64bit integer type for larger values which is
currently not supported.

(See the [dynamic resultset binding](../exchange.html#dynamic) documentation for general information
(See the [dynamic resultset binding](../types.md#dynamic-binding) documentation for general information
on using the `Row` class.)

### Binding by Name

In addition to [binding by position](../exchange.html#bind_position), the Firebird backend supports
[binding by name](../exchange.html#bind_name), via an overload of the `use()` function:
In addition to [binding by position](../binding.md#binding-by-position), the Firebird backend supports
[binding by name](../binding.md#binding-by-name), via an overload of the `use()` function:

int id = 7;
sql << "select name from person where id = :id", use(id, "id")
Expand All @@ -100,20 +100,20 @@ since the underlying API used by the backend doesn't provide this feature.

### Bulk Operations

The Firebird backend has full support for SOCI [bulk operations](../statements.html#bulk) interface.
The Firebird backend has full support for SOCI [bulk operations](../binding.md#bulk-operations) interface.
This feature is also supported by emulation.

### Transactions

[Transactions](../statements.html#transactions) are also fully supported by the Firebird backend.
[Transactions](../transactions.md) are also fully supported by the Firebird backend.
In fact, an implicit transaction is always started when using this backend if one hadn't been
started by explicitly calling `begin()` before. The current transaction is automatically
committed in `session` destructor.

### BLOB Data Type

The Firebird backend supports working with data stored in columns of type Blob,
via SOCI `[BLOB](../exchange.html#blob)` class.
via SOCI [BLOB](../lobs.md) class.

It should by noted, that entire Blob data is fetched from database to allow random read and write access.
This is because Firebird itself allows only writing to a new Blob or reading from existing one -
Expand All @@ -130,12 +130,12 @@ This feature is not supported by Firebird backend.

### Stored Procedures

Firebird stored procedures can be executed by using SOCI [Procedure](../statements.html#procedures) class.
Firebird stored procedures can be executed by using SOCI [Procedure](../procedures.md) class.

## Native API Access

SOCI provides access to underlying datbabase APIs via several getBackEnd() functions,
as described in the [beyond SOCI](../beyond.html) documentation.
as described in the [beyond SOCI](../beyond.md) documentation.

The Firebird backend provides the following concrete classes for navite API access:

Expand Down
8 changes: 4 additions & 4 deletions docs/backends/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

Follow the links to learn more about each backend and detailed supported features.

|Oracle|PostgreSQL|MySQL|SQLite3|Firebird|ODBC|DB2|
|--- |--- |--- |--- |--- |--- |--- |
|Binding by Name|YES|YES (>=8.0)|YES|YES|YES|YES|YES|
||[Oracle](oracle.md)|[PostgreSQL](postgresql.md)|[MySQL](mysql.md)|[SQLite3](sqlite3.md)|[Firebird](firebird.md)|[ODBC](odbc.md)|[DB2](db2.md)|
|--- |--- |--- |--- |--- |--- |--- |--- |
|Binding by Name|YES|YES (&ge;8.0)|YES|YES|YES|YES|YES|
|Dynamic Binding|YES|YES|YES|YES|YES|YES|
|Bulk Operations|YES|YES|YES|YES|YES|YES|YES|
|Transactions|YES|YES|YES (>=4.0)|YES|YES|YES|YES|
|Transactions|YES|YES|YES (&ge;4.0)|YES|YES|YES|YES|
|BLOB Data Type|YES|YES|YES (mapped to `std::string`)|YES|YES|NO|NO|
|RowID Data Type|YES|YES|NO|NO|NO|NO|NO|
|Nested Statements|YES|NO|NO|NO|NO|NO|YES|
Expand Down
20 changes: 12 additions & 8 deletions docs/backends/mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,16 @@ Once you have created a `session` object as shown above, you can use it to acces
int count;
sql << "select count(*) from invoices", into(count);

(See the [SOCI basics]("../basics.html) and [exchanging data](../exchange.html) documentation for general information on using the `session` class.)
(See the [connection](../connections.md) and [data binding](../binding.md) documentation
for general information on using the `session` class.)

## SOCI Feature Support

### Dynamic Binding

The MySQL backend supports the use of the SOCI `row` class, which facilitates retrieval of data which type is not known at compile time.

When calling `row::get&lt;T&gt;()`, the type you should pass as `T` depends upon the underlying database type.
When calling `row::get<T>()`, the type you should pass as `T` depends upon the underlying database type.
For the MySQL backend, this type mapping is:

|MySQL Data Type|SOCI Data Type|`row::get<T>` specializations|
Expand All @@ -76,12 +77,13 @@ For the MySQL backend, this type mapping is:
|CHAR, VARCHAR, BINARY, VARBINARY, TINYBLOB, MEDIUMBLOB, BLOB,LONGBLOB, TINYTEXT, MEDIUMTEXT, TEXT, LONGTEXT, ENUM|dt_string|std::string|
|TIMESTAMP (works only with MySQL >= 5.0), DATE, TIME, DATETIME|dt_date|std::tm|

(See the [dynamic resultset binding](../exchange.html#dynamic) documentation for general information on using the `Row` class.)
(See the [dynamic resultset binding](../types.md#dynamic-binding) documentation for general information
on using the `Row` class.)

### Binding by Name

In addition to [binding by position](../exchange.html#bind_position), the MySQL backend supports
[binding by name](../exchange.html#bind_name), via an overload of the `use()` function:
In addition to [binding by position](../binding.md#binding-by-position), the MySQL backend supports
[binding by name](../binding.md#binding-by-name), via an overload of the `use()` function:

int id = 7;
sql << "select name from person where id = :id", use(id, "id")
Expand All @@ -90,7 +92,9 @@ It should be noted that parameter binding of any kind is supported only by means

### Bulk Operations

[Transactions](../statements.html#transactions) are also supported by the MySQL backend. Please note, however, that transactions can only be used when the MySQL server supports them (it depends on options used during the compilation of the server; typically, but not always, servers >=4.0 support transactions and earlier versions do not) and only with appropriate table types.
### Transactions

[Transactions](../transactions.md) are also supported by the MySQL backend. Please note, however, that transactions can only be used when the MySQL server supports them (it depends on options used during the compilation of the server; typically, but not always, servers >=4.0 support transactions and earlier versions do not) and only with appropriate table types.

### BLOB Data Type

Expand All @@ -108,11 +112,11 @@ Nested statements are not supported by the MySQL backend.

### Stored Procedures

MySQL version 5.0 and later supports two kinds of stored routines: stored procedures and stored functions (for details, please consult the [procedure MySQL documentation](http://dev.mysql.com/doc/refman/5.0/en/stored-procedures.html)). Stored functions can be executed by using SOCI's [procedure class](../statements.html#procedures). There is currently no support for stored procedures.
MySQL version 5.0 and later supports two kinds of stored routines: stored procedures and stored functions (for details, please consult the [procedure MySQL documentation](http://dev.mysql.com/doc/refman/5.0/en/stored-procedures.html)). Stored functions can be executed by using SOCI's [procedure class](../procedures.md). There is currently no support for stored procedures.

## Native API Access

SOCI provides access to underlying datbabase APIs via several `get_backend()` functions, as described in the [Beyond SOCI](../beyond.html) documentation.
SOCI provides access to underlying datbabase APIs via several `get_backend()` functions, as described in the [Beyond SOCI](../beyond.md) documentation.

The MySQL backend provides the following concrete classes for native API access:

Expand Down
12 changes: 6 additions & 6 deletions docs/backends/odbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int count;
sql << "select count(*) from invoices", into(count);
```

(See the [SOCI basics](../basics.html) and [exchanging data](../exchange.html) documentation for general information on using the `session` class.)
(See the [connection](../connections.md) and [data binding](../binding.md) documentation for general information on using the `session` class.)

## SOCI Feature Support

Expand All @@ -68,11 +68,11 @@ For the ODBC backend, this type mapping is:

Not all ODBC drivers support all datatypes.

(See the [dynamic resultset binding](../exchange.html#dynamic) documentation for general information on using the `row` class.)
(See the [dynamic resultset binding](../types.md#dynamic-binding) documentation for general information on using the `row` class.)

### Binding by Name

In addition to [binding by position](../exchange.html#bind_position), the ODBC backend supports [binding by name](../exchange.html#bind_name), via an overload of the `use()` function:
In addition to [binding by position](../binding.md#binding-by-position), the ODBC backend supports [binding by name](../binding.md#binding-by-name), via an overload of the `use()` function:

```cpp
int id = 7;
Expand All @@ -89,7 +89,7 @@ sql << "insert into t(x, y) values(?, ?)", use(i), use(j);

### Bulk Operations

The ODBC backend has support for SOCI's [bulk operations](../statements.html#bulk) interface. Not all ODBC drivers support bulk operations, the following is a list of some tested backends:
The ODBC backend has support for SOCI's [bulk operations](../binding.md#bulk-operations) interface. Not all ODBC drivers support bulk operations, the following is a list of some tested backends:

|ODBC Driver|Bulk Read|Bulk Insert|
|--- |--- |--- |
Expand All @@ -100,7 +100,7 @@ The ODBC backend has support for SOCI's [bulk operations](../statements.html#bul

### Transactions

[Transactions](../statements.html#transactions) are also fully supported by the ODBC backend, provided that they are supported by the underlying database.
[Transactions](../transactions.md) are also fully supported by the ODBC backend, provided that they are supported by the underlying database.

### BLOB Data Type

Expand All @@ -120,7 +120,7 @@ Not currently supported.

## Native API Access

SOCI provides access to underlying datbabase APIs via several getBackEnd() functions, as described in the [beyond SOCI](../beyond.html) documentation.
SOCI provides access to underlying datbabase APIs via several getBackEnd() functions, as described in the [beyond SOCI](../beyond.md) documentation.

The ODBC backend provides the following concrete classes for navite API access:

Expand Down
Loading

0 comments on commit 2eef8d2

Please sign in to comment.