Notes by voodoo
Displaying keyword search results 1 - 6
Created by voodoo on August 12, 2011 14:43:57
Last update: August 14, 2011 15:19:21
#include <stdio.h>
#include <stdlib.h>
i...
Created by voodoo on August 12, 2011 14:44:45
Last update: August 12, 2011 14:44:45
#include <fstream>
#include <iostream>
i...
Created by voodoo on August 12, 2011 12:47:50
Last update: August 12, 2011 13:03:00
Use fstream and seekg :
#include <iostream>
#include <fstream>
i...
With stat :
#include <iostream>
#include <sys/stat.h>
...
Created by voodoo on November 25, 2010 00:15:37
Last update: November 25, 2010 00:15:37
PostgreSQL JDBC doc says:
Specifically deleting a row that contains a Large Object reference does not delete the Large Object. Deleting the Large Object is a separate operation that needs to be performed. .
In JDBC this can be done in two steps:
Delete the large object (call PostgreSQL function lo_unlink )
long oid = jdbcTemplate.queryForObject("select...
Delete the row in the referring table:
jdbcTemplate.update("delete from InventoryItem whe...
Created by voodoo on November 25, 2010 00:03:53
Last update: November 25, 2010 00:03:53
It seems that the JDBC standard way to create a BLOB is to call Connection.createBlob . However, this does not work for PostgreSQL (as of version 9.0-801 jdbc4):
Exception in thread "main" org.postgresql.util.PSQ...
The workaround is to call a PostgreSQL function to create the Blob, then use JDBC to update it:
Connection conn = jdbcTemplate.getDataSource().get...
Oracle Note: the Oracle way function to create an empty BLOB is EMPTY_BLOB() .
stmt.execute ("INSERT INTO my_blob_table VALUES ('...
Created by voodoo on November 24, 2010 23:43:29
Last update: November 24, 2010 23:43:29
Two of the three PreparedStatement.setBinaryStream methods are not implemented as of version 9.0-801 of the PostgreSQL JDBC driver.
Test program:
import java.io.*;
import java.sql.*;
pub...
Also note that setBinaryStream only works on a bytea column.