Comments (8)
Also sidenote: ibpqxx.readthedocs.io/en/stable is dead as we speak
from libpqxx.
Not supported as far as I know.
I assume that this is because the time that std::chrono::time_point
is based on is platform-dependent, and the time zone and format of TIMESTAMP
retrieved from PostgreSQL is configuration-dependent, making it difficult for libpqxx to parse the time string.
from libpqxx.
There is built-in support for std::chrono::year_month_day
and friends, but that's about it. The system for supporting data types is extensible though — see include/pqxx/doc/datatypes.md.
from libpqxx.
Thanks for the warning about readthedocs.io
... As far as I can tell the class documentation is there, but not the indexes.
from libpqxx.
There is built-in support for
std::chrono::year_month_day
and friends, but that's about it. The system for supporting data types is extensible though — see include/pqxx/doc/datatypes.md.
What if I do .as<std::string>()
on the timestamp row? Would it return a specific format?
from libpqxx.
The column values received from the database are in string format.
TIMESTAMP
is in ISO format (default).
https://www.postgresql.org/docs/16/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT
The output format of the date/time types can be set to one of the four styles ISO 8601, SQL (Ingres), traditional POSTGRES (Unix date format), or German. The default is the ISO format. (The SQL standard requires the use of the ISO 8601 format. The name of the “SQL” output format is a historical accident.) Table 8.14 shows examples of each output style. The output of the date and time types is generally only the date or time part in accordance with the given examples. However, the POSTGRES style outputs date-only values in ISO format.
from libpqxx.
In other words: the database sends the data in a human-readable text format (in the case of a timestamp: in ISO-8601 format), and so from libpqxx's standpoint all data in a result are already strings. If you request it using .as<std::string>()
, you simply get that string exactly as you would hope.
The part that's more complicated is if you want to convert the string that the database sent to a C++ type that libpqxx doesn't yet support. (Or going the other way: if you want to pass such an object as a parameter to an SQL statement.) However it is possible for an application to "inject" support for additional data types.
from libpqxx.
I hope this has been resolved. Closing the ticket.
from libpqxx.
Related Issues (20)
- Docs gone since 7.9 HOT 19
- Error building a project with the library HOT 8
- Building with bazel error: "ar: libdeps specified more than once" or "undefined reference to PQ" HOT 7
- Make of libpqxx on Red Hat Enterprise Linux 8.8 fails HOT 6
- PQXX_DECLARE_ENUM_CONVERSION issues HOT 15
- G++ Vcpkg Debian Docker image linker errors HOT 18
- Query streaming doesn't compile anymore HOT 3
- Can't initialize zview from string_view HOT 2
- Missing cast opportunity HOT 17
- cmake will take the given lib name and it changes to "-l{libname}" and linker will search using "-l{libname}" HOT 7
- `RETURNING` from a `stream_to` HOT 3
- Failure on streaming a list of empty strings HOT 6
- Conversion of TEXT[] to std::vector<std::string>. HOT 5
- error C2039: 'converts_from_string': is not a member of 'pqxx::string_traits<pgvector::Vector>' HOT 8
- Undefined references while compiling project HOT 17
- Static linking is not working, C++20, libpq REL_16_2, HOT 11
- Can I use stream_to to insert multiple records while one field is Postgis Geometry type? HOT 5
- std::optional<std::chrono::year_month_day> to DATE error if optional is empty HOT 4
- Encoding problems with bytea HOT 19
- Undefined refences when compiling example from the documentation HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libpqxx.