Author: fxjr
Date: 2006-10-20 01:21:40 -0400 (Fri, 20 Oct 2006)
New Revision: 66824
Modified:
trunk/mcs/class/Npgsql/ChangeLog
trunk/mcs/class/Npgsql/Npgsql/NpgsqlCommand.resx
trunk/mcs/class/Npgsql/Npgsql/NpgsqlCommandBuilder.cs
trunk/mcs/class/Npgsql/Npgsql/NpgsqlConnection.cs
trunk/mcs/class/Npgsql/Npgsql/NpgsqlConnectorPool.cs
trunk/mcs/class/Npgsql/Npgsql/NpgsqlDataReader.cs
trunk/mcs/class/Npgsql/Npgsql/NpgsqlState.cs
trunk/mcs/class/Npgsql/NpgsqlTypes/FastPath.cs
trunk/mcs/class/Npgsql/NpgsqlTypes/LargeObject.cs
trunk/mcs/class/Npgsql/NpgsqlTypes/LargeObjectManager.cs
trunk/mcs/class/Npgsql/NpgsqlTypes/NpgsqlDbType.cs
trunk/mcs/class/Npgsql/NpgsqlTypes/NpgsqlTypesHelper.cs
Log:
2006-10-20 Francisco Figueiredo Jr. <[EMAIL PROTECTED]>
*Npgsql/NpgsqlCommand.resx,
Npgsql/NpgsqlConnection.cs,
Npgsql/NpgsqlCommand.cs,
Npgsql/NpgsqlState.cs,
Npgsql/NpgsqlConnectorPool.cs,
Npgsql/NpgsqlCommandBuilder.cs,
Npgsql/NpgsqlDataReader.cs,
NpgsqlTypes/LargeObjectManager.cs,
NpgsqlTypes/NpgsqlDbType.cs,
NpgsqlTypes/LargeObject.cs,
NpgsqlTypes/NpgsqlTypesHelper.cs,
NpgsqlTypes/FastPath.cs: Updated to 1.0 final version.
Modified: trunk/mcs/class/Npgsql/ChangeLog
===================================================================
--- trunk/mcs/class/Npgsql/ChangeLog 2006-10-20 02:54:53 UTC (rev 66823)
+++ trunk/mcs/class/Npgsql/ChangeLog 2006-10-20 05:21:40 UTC (rev 66824)
@@ -1,3 +1,21 @@
+
+2006-10-20 Francisco Figueiredo Jr. <[EMAIL PROTECTED]>
+
+ *Npgsql/NpgsqlCommand.resx,
+ Npgsql/NpgsqlConnection.cs,
+ Npgsql/NpgsqlCommand.cs,
+ Npgsql/NpgsqlState.cs,
+ Npgsql/NpgsqlConnectorPool.cs,
+ Npgsql/NpgsqlCommandBuilder.cs,
+ Npgsql/NpgsqlDataReader.cs,
+ NpgsqlTypes/LargeObjectManager.cs,
+ NpgsqlTypes/NpgsqlDbType.cs,
+ NpgsqlTypes/LargeObject.cs,
+ NpgsqlTypes/NpgsqlTypesHelper.cs,
+ NpgsqlTypes/FastPath.cs: Updated to 1.0 final version.
+
+
+
2006-09-06 Kornél Pál <[EMAIL PROTECTED]>
* Test/TestConfiguration.cs: Moved from build/common.
Modified: trunk/mcs/class/Npgsql/Npgsql/NpgsqlCommand.resx
===================================================================
--- trunk/mcs/class/Npgsql/Npgsql/NpgsqlCommand.resx 2006-10-20 02:54:53 UTC
(rev 66823)
+++ trunk/mcs/class/Npgsql/Npgsql/NpgsqlCommand.resx 2006-10-20 05:21:40 UTC
(rev 66824)
@@ -127,4 +127,7 @@
<data name="Exception_ParamNotInQuery">
<value>Parameter {0} not found in query.</value>
</data>
-</root>
\ No newline at end of file
+ <data name="Exception_ConnectionBroken">
+ <value>The Connection is broken.</value>
+ </data>
+</root>
Modified: trunk/mcs/class/Npgsql/Npgsql/NpgsqlCommandBuilder.cs
===================================================================
--- trunk/mcs/class/Npgsql/Npgsql/NpgsqlCommandBuilder.cs 2006-10-20
02:54:53 UTC (rev 66823)
+++ trunk/mcs/class/Npgsql/Npgsql/NpgsqlCommandBuilder.cs 2006-10-20
05:21:40 UTC (rev 66824)
@@ -1,9 +1,9 @@
// NpgsqlCommandBuilder.cs
//
// Author:
-// Pedro Martínez Juliá ([EMAIL PROTECTED])
+// Pedro Mart�nez Juli� ([EMAIL PROTECTED])
//
-// Copyright (C) 2003 Pedro Martínez Juliá
+// Copyright (C) 2003 Pedro Mart�nez Juli�
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -150,14 +150,39 @@
/// <param name="command">NpgsqlCommand whose function parameters will
be obtained.</param>
public static void DeriveParameters (NpgsqlCommand command)
{
- String query = "select proargtypes from pg_proc where proname =
:procname";
-
+
+ // Updated after 0.99.3 to support the optional existence of a
name qualifying schema and case insensitivity when the schema ror procedure
name do not contain a quote.
+ // This fixed an incompatibility with
NpgsqlCommand.CheckFunctionReturn(String ReturnType)
+ String query = null;
+ string procedureName = null;
+ string schemaName = null;
+ string[] fullName = command.CommandText.Split('.');
+ if (fullName.Length > 1 && fullName[0].Length > 0)
+ {
+ query = "select proargtypes from pg_proc p left join
pg_namespace n on p.pronamespace = n.oid where proname=:proname and
n.nspname=:nspname";
+ schemaName = (fullName[0].IndexOf("\"") != -1) ? fullName[0] :
fullName[0].ToLower();
+ procedureName = (fullName[1].IndexOf("\"") != -1) ?
fullName[1] : fullName[1].ToLower();
+ }
+ else
+ {
+ query = "select proargtypes from pg_proc where proname =
:proname";
+ procedureName = (fullName[0].IndexOf("\"") != -1) ?
fullName[0] : fullName[0].ToLower();
+ }
+
NpgsqlCommand c = new NpgsqlCommand(query, command.Connection);
- c.Parameters.Add(new NpgsqlParameter("procname",
NpgsqlDbType.Text));
- c.Parameters[0].Value = command.CommandText;
+ c.Parameters.Add(new NpgsqlParameter("proname",
NpgsqlDbType.Text));
+
+
+ c.Parameters[0].Value = procedureName.Replace("\"", "").Trim();
+
+ if (fullName.Length > 1 && schemaName.Length > 0)
+ {
+ NpgsqlParameter prm = c.Parameters.Add(new
NpgsqlParameter("nspname", NpgsqlDbType.Text));
+ prm.Value = schemaName.Replace("\"", "").Trim();
+ }
String types = (String) c.ExecuteScalar();
-
+
if (types == null)
throw new InvalidOperationException
(String.Format(resman.GetString("Exception_InvalidFunctionName"),
command.CommandText));
Modified: trunk/mcs/class/Npgsql/Npgsql/NpgsqlConnection.cs
===================================================================
--- trunk/mcs/class/Npgsql/Npgsql/NpgsqlConnection.cs 2006-10-20 02:54:53 UTC
(rev 66823)
+++ trunk/mcs/class/Npgsql/Npgsql/NpgsqlConnection.cs 2006-10-20 05:21:40 UTC
(rev 66824)
@@ -871,6 +871,17 @@
throw new NotSupportedException();
}
}
+
+ public void ClearPool()
+ {
+ NpgsqlConnectorPool.ConnectorPoolMgr.ClearPool(this);
+ }
+
+ public void ClearAllPools()
+ {
+ NpgsqlConnectorPool.ConnectorPoolMgr.ClearAllPools();
+ }
+
}
Modified: trunk/mcs/class/Npgsql/Npgsql/NpgsqlConnectorPool.cs
===================================================================
--- trunk/mcs/class/Npgsql/Npgsql/NpgsqlConnectorPool.cs 2006-10-20
02:54:53 UTC (rev 66823)
+++ trunk/mcs/class/Npgsql/Npgsql/NpgsqlConnectorPool.cs 2006-10-20
05:21:40 UTC (rev 66824)
@@ -310,32 +310,22 @@
PooledConnectors[Connection.ConnectionString.ToString()] =
Queue;
}
+ // Fix queue use count. Use count may be dropped below zero if
Queue was cleared and there were connections open.
+ if (Queue.UseCount < 0)
+ Queue.UseCount = 0;
+
+
if (Queue.Count > 0)
{
// Found a queue with connectors. Grab the top one.
// Check if the connector is still valid.
- while (true)
- {
- Connector = (NpgsqlConnector)Queue.Dequeue();
- if (Connector.IsValid())
- {
- Queue.UseCount++;
- break;
- }
+ Connector = (NpgsqlConnector)Queue.Dequeue();
+ Queue.UseCount++;
- // Don't need - we dequeue connector = decrease
Queue.Count.
- //Queue.UseCount--;
- if (Queue.Count <= 0)
- return GetPooledConnector(Connection);
-
- }
-
-
-
}
else if (Queue.Count + Queue.UseCount < Connection.MaxPoolSize)
{
@@ -460,9 +450,7 @@
Queue =
(ConnectorQueue)PooledConnectors[Connector.ConnectionString.ToString()];
if (Queue == null)
- {
- throw new InvalidOperationException("Internal: No connector
queue found for existing connector.");
- }
+ return; // Queue may be emptied by connection problems. See
ClearPool below.
Connector.CertificateSelectionCallback -=
Connection.CertificateSelectionCallbackDelegate;
Connector.CertificateValidationCallback -=
Connection.CertificateValidationCallbackDelegate;
@@ -511,5 +499,59 @@
{
// To be implemented
}
+
+ private void ClearQueue(ConnectorQueue Queue)
+ {
+ if (Queue == null)
+ return;
+
+ while (Queue.Count > 0)
+ {
+ NpgsqlConnector connector = (NpgsqlConnector)Queue.Dequeue();
+
+ try
+ {
+ connector.Close();
+ }
+ catch {
+ // Maybe we should log something here to say we got an
exception while closing connector?
+
+ }
+
+ }
+
+ }
+
+
+ internal void ClearPool(NpgsqlConnection Connection)
+ {
+ // Prevent multithread access to connection pool count.
+ lock(this)
+ {
+ // Try to find a queue.
+ ConnectorQueue queue =
(ConnectorQueue)PooledConnectors[Connection.ConnectionString.ToString()];
+
+ ClearQueue(queue);
+
+ PooledConnectors[Connection.ConnectionString.ToString()] =
null;
+
+ }
+
+
+ }
+
+ internal void ClearAllPools()
+ {
+
+ lock (this)
+ {
+ foreach (ConnectorQueue Queue in PooledConnectors.Values)
+ ClearQueue(Queue);
+
+ }
+
+
+ }
+
}
}
Modified: trunk/mcs/class/Npgsql/Npgsql/NpgsqlDataReader.cs
===================================================================
--- trunk/mcs/class/Npgsql/Npgsql/NpgsqlDataReader.cs 2006-10-20 02:54:53 UTC
(rev 66823)
+++ trunk/mcs/class/Npgsql/Npgsql/NpgsqlDataReader.cs 2006-10-20 05:21:40 UTC
(rev 66824)
@@ -42,6 +42,7 @@
private ArrayList _responses;
private Int32 _rowIndex;
private Int32 _resultsetIndex;
+ private Int32 _recordsAffected;
private NpgsqlResultSet _currentResultset;
private DataTable _currentResultsetSchema;
private CommandBehavior _behavior;
@@ -58,10 +59,12 @@
_responses = responses;
_connection = command.Connection;
_rowIndex = -1;
- _resultsetIndex = 0;
+ _resultsetIndex = -1;
+ _recordsAffected = -1;
- if (_resultsets.Count > 0)
- _currentResultset =
(NpgsqlResultSet)_resultsets[_resultsetIndex];
+ // positioned before the first results.
+ // move to the first results
+ NextResult();
_behavior = behavior;
_isClosed = false;
@@ -153,22 +156,7 @@
get
{
NpgsqlEventLog.LogPropertyGet(LogLevel.Debug, CLASSNAME,
"RecordsAffected");
-
- if (HaveResultSet())
- {
- return -1;
- }
-
- String[] _returnStringTokens =
((String)_responses[_resultsetIndex]).Split(null); // whitespace separator.
-
- try
- {
- return
Int32.Parse(_returnStringTokens[_returnStringTokens.Length - 1]);
- }
- catch (FormatException)
- {
- return -1;
- }
+ return _recordsAffected;
}
}
@@ -213,15 +201,41 @@
{
NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME,
"NextResult");
- if((_resultsetIndex + 1) < _resultsets.Count)
+ _currentResultset = null;
+ while((_resultsetIndex + 1) < _resultsets.Count &&
!HaveResultSet())
{
_resultsetIndex++;
_rowIndex = -1;
_currentResultset =
(NpgsqlResultSet)_resultsets[_resultsetIndex];
- return true;
+
+ if (!HaveResultSet())
+ {
+ String[] _returnStringTokens =
((String)_responses[_resultsetIndex]).Split(null); // whitespace separator.
+ int responseAffectedRows = 0;
+
+ try
+ {
+ responseAffectedRows =
Int32.Parse(_returnStringTokens[_returnStringTokens.Length - 1]);
+ }
+ catch (FormatException)
+ {
+ responseAffectedRows = -1;
+ }
+
+ if (responseAffectedRows != -1)
+ {
+ if (_recordsAffected == -1)
+ {
+ _recordsAffected = responseAffectedRows;
+ }
+ else
+ {
+ _recordsAffected += responseAffectedRows;
+ }
+ }
+ }
}
- else
- return false;
+ return HaveResultSet();
}
Modified: trunk/mcs/class/Npgsql/Npgsql/NpgsqlState.cs
===================================================================
--- trunk/mcs/class/Npgsql/Npgsql/NpgsqlState.cs 2006-10-20 02:54:53 UTC
(rev 66823)
+++ trunk/mcs/class/Npgsql/Npgsql/NpgsqlState.cs 2006-10-20 05:21:40 UTC
(rev 66824)
@@ -146,7 +146,16 @@
// Process commandTimeout behavior.
if ((context.Mediator.CommandTimeout > 0) &&
(!context.Socket.Poll(1000000 * context.Mediator.CommandTimeout,
SelectMode.SelectRead)))
- context.CancelRequest();
+ {
+ // If timeout occurs when establishing the session with
server then
+ // throw an exception instead of trying to cancel query.
This helps to prevent loop as CancelRequest will also try to stablish a
connection and sends commands.
+ if ((this is NpgsqlStartupState || this is
NpgsqlConnectedState))
+ throw new
NpgsqlException(resman.GetString("Exception_ConnectionTimeout"));
+ else
+ context.CancelRequest();
+
+ }
+
switch (context.BackendProtocolVersion)
@@ -428,6 +437,10 @@
// Wait for ReadForQuery message
break;
+ case -1:
+ // Connection broken. Mono returns -1 instead of throw an
exception as ms.net does.
+ throw new IOException();
+
default :
// This could mean a number of things
// We've gotten out of sync with the backend?
@@ -747,6 +760,10 @@
break;
+ case -1:
+ // Connection broken. Mono returns -1 instead of throw an
exception as ms.net does.
+ throw new IOException();
+
default :
// This could mean a number of things
// We've gotten out of sync with the backend?
Modified: trunk/mcs/class/Npgsql/NpgsqlTypes/FastPath.cs
===================================================================
--- trunk/mcs/class/Npgsql/NpgsqlTypes/FastPath.cs 2006-10-20 02:54:53 UTC
(rev 66823)
+++ trunk/mcs/class/Npgsql/NpgsqlTypes/FastPath.cs 2006-10-20 05:21:40 UTC
(rev 66824)
@@ -85,17 +85,25 @@
* @param resulttype True if the result is an integer, false for other
results
* @param args FastpathArguments to pass to fastpath
* @return null if no data, Integer if an integer result, or byte[]
otherwise
- * @exception SQLException if a database-access error occurs.
+ * @exception NpgsqlException if a database-access error occurs.
*/
public Object FastpathCall(Int32 fnid, Boolean resulttype,
FastpathArg[] args)
{
- if (conn.BackendProtocolVersion == ProtocolVersion.Version3)
+ try
{
- return FastpathV3(fnid, resulttype, args);
+ if (conn.BackendProtocolVersion == ProtocolVersion.Version3)
+ {
+ return FastpathV3(fnid, resulttype, args);
+ }
+ else
+ {
+ return FastpathV2(fnid, resulttype, args);
+ }
}
- else
+ catch(IOException e)
{
- return FastpathV2(fnid, resulttype, args);
+ conn.ClearPool();
+ throw new NpgsqlException("The Connection is broken.");
}
}
@@ -105,34 +113,30 @@
lock (stream)
{
// send the function call
- try
+
{
Int32 l_msgLen = 0;
l_msgLen += 16;
for (Int32 i=0;i < args.Length;i++)
l_msgLen += args[i].SendSize();
-
+
stream.WriteByte((Byte)'F');
PGUtil.WriteInt32(stream,l_msgLen);
PGUtil.WriteInt32(stream,fnid);
PGUtil.WriteInt16(stream,1);
PGUtil.WriteInt16(stream,1);
PGUtil.WriteInt16(stream,(short)args.Length);
-
+
for (Int32 i = 0;i < args.Length;i++)
args[i].Send(stream);
-
+
PGUtil.WriteInt16(stream,1);
-
+
// This is needed, otherwise data can be lost
stream.Flush();
-
}
- catch (Exception ex)
- {
- throw new Exception(ex.ToString());
- }
+
// Now handle the result
// Now loop, reading the results
@@ -162,7 +166,7 @@
case 'E':
NpgsqlError e = new
NpgsqlError(conn.BackendProtocolVersion);
e.ReadFromStream(stream,conn.Connector.Encoding);
- throw new Exception(e.ToString());
+ throw new NpgsqlException(e.ToString());
//------------------------------
// Notice from backend
@@ -216,14 +220,14 @@
case 'Z':
//TODO: use size better
if (PGUtil.ReadInt32(stream,input_buffer) != 5)
- throw new Exception("Received Z" );
+ throw new NpgsqlException("Received Z" );
//TODO: handle transaction status
Char l_tStatus = (Char)stream.ReadByte();
l_endQuery = true;
break;
default:
- throw new Exception("postgresql.fp.protocol received "
+ c.ToString());
+ throw new NpgsqlException("postgresql.fp.protocol
received " + c.ToString());
}
}
@@ -240,29 +244,22 @@
lock (stream)
{
// send the function call
- try
- {
- // 70 is 'F' in ASCII. Note: don't use SendChar() here as
it adds padding
- // that confuses the backend. The 0 terminates the command
line.
- stream.WriteByte((Byte)70);
- stream.WriteByte((Byte)0);
+
+ // 70 is 'F' in ASCII. Note: don't use SendChar() here as it
adds padding
+ // that confuses the backend. The 0 terminates the command
line.
+ stream.WriteByte((Byte)70);
+ stream.WriteByte((Byte)0);
- PGUtil.WriteInt32(stream,fnid);
- PGUtil.WriteInt32(stream,args.Length);
+ PGUtil.WriteInt32(stream,fnid);
+ PGUtil.WriteInt32(stream,args.Length);
- for (Int32 i = 0;i < args.Length;i++)
- args[i].Send(stream);
+ for (Int32 i = 0;i < args.Length;i++)
+ args[i].Send(stream);
- // This is needed, otherwise data can be lost
- stream.Flush();
+ // This is needed, otherwise data can be lost
+ stream.Flush();
- }
- catch (IOException ioe)
- {
- //Should be sending exception as second arg.
- throw new Exception("postgresql.fp.send: " +
ioe.ToString());
- }
// Now handle the result
@@ -343,12 +340,12 @@
break;
default:
- throw new Exception("postgresql.fp.protocol " +
c.ToString());
+ throw new NpgsqlException("postgresql.fp.protocol " +
c.ToString());
}
}
if ( errorMessage != null )
- throw new Exception("postgresql.fp.error" + errorMessage);
+ throw new NpgsqlException("postgresql.fp.error" +
errorMessage);
return result;
}
@@ -370,7 +367,7 @@
* results
* @param args FastpathArguments to pass to fastpath
* @return null if no data, Integer if an integer result, or byte[]
otherwise
- * @exception SQLException if name is unknown or if a database-access
error
+ * @exception NpgsqlException if name is unknown or if a
database-access error
* occurs.
* @see org.postgresql.largeobject.LargeObject
*/
@@ -384,7 +381,7 @@
* @param name Function name
* @param args Function arguments
* @return integer result
- * @exception SQLException if a database-access error occurs or no
result
+ * @exception NpgsqlException if a database-access error occurs or no
result
*/
public Int32 GetInteger(String name, FastpathArg[] args)
{
@@ -398,7 +395,7 @@
* @param name Function name
* @param args Function arguments
* @return byte[] array containing result
- * @exception SQLException if a database-access error occurs or no
result
+ * @exception NpgsqlException if a database-access error occurs or no
result
*/
public Byte[] GetData(String name, FastpathArg[] args)
{
@@ -450,7 +447,7 @@
* unwarranted headaches in the future.
*
* @param rs ResultSet
- * @exception SQLException if a database-access error occurs.
+ * @exception NpgsqlException if a database-access error occurs.
* @see org.postgresql.largeobject.LargeObjectManager
*/
public void AddFunctions(IDataReader rs)
@@ -467,11 +464,11 @@
* This returns the function id associated by its name
*
* <p>If addFunction() or addFunctions() have not been called for this
name,
- * then an SQLException is thrown.
+ * then an NpgsqlException is thrown.
*
* @param name Function name to lookup
* @return Function ID for fastpath call
- * @exception SQLException is function is unknown.
+ * @exception NpgsqlException is function is unknown.
*/
public Int32 GetID(String name)
{
Modified: trunk/mcs/class/Npgsql/NpgsqlTypes/LargeObject.cs
===================================================================
--- trunk/mcs/class/Npgsql/NpgsqlTypes/LargeObject.cs 2006-10-20 02:54:53 UTC
(rev 66823)
+++ trunk/mcs/class/Npgsql/NpgsqlTypes/LargeObject.cs 2006-10-20 05:21:40 UTC
(rev 66824)
@@ -60,13 +60,13 @@
/*
* This opens a large object.
*
- * <p>If the object does not exist, then an SQLException is thrown.
+ * <p>If the object does not exist, then an NpgsqlException is thrown.
*
* @param fp FastPath API for the connection to use
* @param oid of the Large Object to open
* @param mode Mode of opening the large object
* (defined in LargeObjectManager)
- * @exception SQLException if a database-access error occurs.
+ * @exception NpgsqlException if a database-access error occurs.
* @see org.postgresql.largeobject.LargeObjectManager
*/
public LargeObject(Fastpath fp, Int32 oid, Int32 mode)
@@ -92,7 +92,7 @@
/*
* This method closes the object. You must not call methods in this
* object after this is called.
- * @exception SQLException if a database-access error occurs.
+ * @exception NpgsqlException if a database-access error occurs.
*/
public void Close()
{
@@ -112,7 +112,7 @@
*
* @param len number of bytes to read
* @return byte[] array containing data read
- * @exception SQLException if a database-access error occurs.
+ * @exception NpgsqlException if a database-access error occurs.
*/
public Byte[] Read(Int32 len)
{
@@ -155,7 +155,7 @@
* @param off offset within array
* @param len number of bytes to read
* @return the number of bytes actually read
- * @exception SQLException if a database-access error occurs.
+ * @exception NpgsqlException if a database-access error occurs.
*/
public Int32 Read(Byte[] buf, Int32 off, Int32 len)
{
@@ -170,7 +170,7 @@
* Writes an array to the object
*
* @param buf array to write
- * @exception SQLException if a database-access error occurs.
+ * @exception NpgsqlException if a database-access error occurs.
*/
public void Write(Byte[] buf)
{
@@ -186,7 +186,7 @@
* @param buf destination array
* @param off offset within array
* @param len number of bytes to write
- * @exception SQLException if a database-access error occurs.
+ * @exception NpgsqlException if a database-access error occurs.
*/
public void Write(Byte[] buf, Int32 off, Int32 len)
{
@@ -204,7 +204,7 @@
*
* @param pos position within object
* @param ref Either SEEK_SET, SEEK_CUR or SEEK_END
- * @exception SQLException if a database-access error occurs.
+ * @exception NpgsqlException if a database-access error occurs.
*/
public void Seek(Int32 pos, Int32 refi)
{
@@ -222,7 +222,7 @@
* allows you to have random access to the large object.
*
* @param pos position within object from begining
- * @exception SQLException if a database-access error occurs.
+ * @exception NpgsqlException if a database-access error occurs.
*/
public void Seek(Int32 pos)
{
@@ -231,7 +231,7 @@
/*
* @return the current position within the object
- * @exception SQLException if a database-access error occurs.
+ * @exception NpgsqlException if a database-access error occurs.
*/
public Int32 Tell()
{
@@ -248,7 +248,7 @@
* <p>A better method will be found in the future.
*
* @return the size of the large object
- * @exception SQLException if a database-access error occurs.
+ * @exception NpgsqlException if a database-access error occurs.
*/
public Int32 Size()
{
Modified: trunk/mcs/class/Npgsql/NpgsqlTypes/LargeObjectManager.cs
===================================================================
--- trunk/mcs/class/Npgsql/NpgsqlTypes/LargeObjectManager.cs 2006-10-20
02:54:53 UTC (rev 66823)
+++ trunk/mcs/class/Npgsql/NpgsqlTypes/LargeObjectManager.cs 2006-10-20
05:21:40 UTC (rev 66824)
@@ -116,7 +116,7 @@
if (res == null)
- throw new Exception("postgresql.lo.init");
+ throw new NpgsqlException("postgresql.lo.init");
fp.AddFunctions(res);
@@ -128,7 +128,7 @@
*
* @param oid of large object
* @return LargeObject instance providing access to the object
- * @exception SQLException on error
+ * @exception NpgsqlException on error
*/
public LargeObject Open(Int32 oid)
{
@@ -141,7 +141,7 @@
* @param oid of large object
* @param mode mode of open
* @return LargeObject instance providing access to the object
- * @exception SQLException on error
+ * @exception NpgsqlException on error
*/
public LargeObject Open(Int32 oid, Int32 mode)
{
@@ -154,7 +154,7 @@
* <p>It defaults to READWRITE for the new object's attributes.
*
* @return oid of new object
- * @exception SQLException on error
+ * @exception NpgsqlException on error
*/
public Int32 Create()
{
@@ -168,7 +168,7 @@
*
* @param mode a bitmask describing different attributes of the new
object
* @return oid of new object
- * @exception SQLException on error
+ * @exception NpgsqlException on error
*/
public Int32 Create(Int32 mode)
{
@@ -181,7 +181,7 @@
* This deletes a large object.
*
* @param oid describing object to delete
- * @exception SQLException on error
+ * @exception NpgsqlException on error
*/
public void Delete(Int32 oid)
{
@@ -197,7 +197,7 @@
* unlink.
*
* @param oid describing object to delete
- * @exception SQLException on error
+ * @exception NpgsqlException on error
*/
public void Unlink(Int32 oid)
{
Modified: trunk/mcs/class/Npgsql/NpgsqlTypes/NpgsqlDbType.cs
===================================================================
--- trunk/mcs/class/Npgsql/NpgsqlTypes/NpgsqlDbType.cs 2006-10-20 02:54:53 UTC
(rev 66823)
+++ trunk/mcs/class/Npgsql/NpgsqlTypes/NpgsqlDbType.cs 2006-10-20 05:21:40 UTC
(rev 66824)
@@ -56,7 +56,8 @@
Varchar,
Refcursor,
Inet,
- Bit
+ Bit,
+ TimestampTZ
}
Modified: trunk/mcs/class/Npgsql/NpgsqlTypes/NpgsqlTypesHelper.cs
===================================================================
--- trunk/mcs/class/Npgsql/NpgsqlTypes/NpgsqlTypesHelper.cs 2006-10-20
02:54:53 UTC (rev 66823)
+++ trunk/mcs/class/Npgsql/NpgsqlTypes/NpgsqlTypesHelper.cs 2006-10-20
05:21:40 UTC (rev 66824)
@@ -242,6 +242,9 @@
NativeTypeMapping.AddTypeAlias("timestamp", typeof(DateTime));
+ NativeTypeMapping.AddType("timestamptz",
NpgsqlDbType.TimestampTZ, DbType.DateTime, true,
+ new
ConvertNativeToBackendHandler(BasicNativeToBackendTypeConverter.ToDateTime));
+
NativeTypeMapping.AddType("point", NpgsqlDbType.Point,
DbType.Object, true,
new
ConvertNativeToBackendHandler(ExtendedNativeToBackendTypeConverter.ToPoint));
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches