/****** PG::Connection INSTANCE METHODS: Large Object Support ******/
@JRubyMethod(name = {"lo_creat", "locreat"}, optional = 1)
public IRubyObject lo_creat(ThreadContext context, IRubyObject[] args) {
try {
LargeObjectAPI manager = postgresqlConnection.getLargeObjectAPI();
int oid;
if (args.length == 1)
oid = manager.loCreat((Integer) args[0].toJava(Integer.class));
else
oid = manager.loCreat(0);
return new RubyFixnum(context.runtime, oid);
} catch (PostgresqlException e) {
throw newPgError(context, "lo_create failed: " + e.getLocalizedMessage(), e.getResultSet(), getClientEncodingAsJavaEncoding(context));
} catch (IOException e) {
throw newPgError(context, "lo_create failed: " + e.getLocalizedMessage(), null, getClientEncodingAsJavaEncoding(context));