I'm creating PostgreSQL database client that ought to work as substitute for SQL Server client. Both clients are written in C++. One of the supported operation is bulk copy from given instance of class containing std::string ReadChunk()
method.
For now I use libpq functions:
PQexec(connection, "COPY tablename FROM STDIN");
while(reader.HasNext()) {
PQputCopyData(connection, reader.ReadChunk().c_str());
}
PQputCopyEnd(connection);
But turns out that I should also be able to truncate too long varchars and insert NULL
between two consecutive \t
if they are representing nullable column. Is there any way to perform this conversion on the database side, writing C triggers or something similar? Or should I implement argument parsing on the client side, something like SQL Server bcp_bind
?