Patches
Search the entire project
This project's trackers
This project's forums
This project's tasks
This project's releases
This project's documents
This project's news
Project
People
Skill
Advanced search
Log In
|
New Account
Home
My Page
Projects
Code Snippets
Project Openings
Npgsql .Net Data Provider for Postgresql
Summary
Activity
Forums
Tracker
Lists
Tasks
Docs
Surveys
News
SCM
Files
[#1010229] Changes in LargeObject
View Trackers
|
Patches
|
Download .csv
|
Monitor
Date:
2008-01-09 08:26
Priority:
3
State:
Open
Submitted by:
Michael Parshin (
parshim
)
Assigned to:
Nobody (None)
Category:
Group:
Resolution:
None
Summary:
Changes in LargeObject
Detailed description
This pathch will add truncate function to the LargeObject that is supported in PostgreSQL V 8.3 or prev with paches.
In addition attached LargeObject.cs has changes all usages of Array.Copy to Buffer.BlockCopy
Seek function is now returns Int32 that is new position after the operation
Unfortunatly, I can attach only one file in this form, so another related change in LargeObjectManager.cs I am posting here. It has updated constructor wich selects fid for lo_truncate.
/*
* Constructs the LargeObject API.
*
* <p><b>Important Notice</b>
* <br>This method should only be called by org.postgresql.Connection
*
* <p>There should only be one LargeObjectManager per Connection. The
* org.postgresql.Connection class keeps track of the various extension API's
* and it's advised you use those to gain access, and not going direct.
*/
public LargeObjectManager(NpgsqlConnection conn)
{
// We need Fastpath to do anything
// Now get the function oid's for the api
//
// This is an example of Fastpath.addFunctions();
//
String sql;
if (conn.PostgreSqlVersion > new ServerVersion(7, 3, 0))
{
sql = "SELECT p.proname,p.oid "+
" FROM pg_catalog.pg_proc p, pg_catalog.pg_namespace n "+
" WHERE p.pronamespace=n.oid AND n.nspname='pg_catalog' AND (";
}
else
{
sql = "SELECT proname,oid FROM pg_proc WHERE ";
}
sql += " proname = 'lo_open'" +
" or proname = 'lo_close'" +
" or proname = 'lo_creat'" +
" or proname = 'lo_unlink'" +
" or proname = 'lo_lseek'" +
" or proname = 'lo_tell'" +
" or proname = 'lo_truncate'" +
" or proname = 'loread'" +
" or proname = 'lowrite'";
if (conn.PostgreSqlVersion > new ServerVersion(7, 3, 0))
{
sql += ")";
}
IDbCommand cmd = new NpgsqlCommand(sql);
cmd.Connection = conn;
this.fp = new Fastpath(conn,conn.Connector.Stream);
IDataReader res = cmd.ExecuteReader(CommandBehavior.CloseConnection);
if (res == null)
throw new NpgsqlException("postgresql.lo.init");
fp.AddFunctions(res);
}
Followup
No Followups Have Been Posted
Attached Files:
Attachments:
LargeObject.cs
LargeObjectManager.cs
Changes:
Field
Old Value
Date
By
File Added
295: LargeObjectManager.cs
2008-01-09 12:43
parshim
File Added
293: LargeObject.cs
2008-01-09 08:26
parshim