SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
NpgsqlTypeConverter.ToBoolean cast exception [ reply ]
By: Kelly Anderson on 2007-03-27 18:08
[forum:1002274]
It seems to me that NpgsqlTypeConverter.ToBoolean should convert native int types to boolean. Until I added the check for int to the function .NET would throw a cast exception. Potentially other native types should be checked also.

<code>
/// <summary>
/// Convert to a postgresql boolean.
/// </summary>
internal static String ToBoolean(NpgsqlNativeTypeInfo TypeInfo, Object NativeData)
{
if (NativeData is int)
{
return ((int)NativeData == 0) ? "FALSE" : "TRUE";
}
return ((bool)NativeData) ? "TRUE" : "FALSE";
}
</code>

Postgres arrays in npgsql [ reply ]
By: Chris Coleman on 2007-03-21 10:44
[forum:1002269]
Hi,

I have the following PL function:

FunctionDoSomething(text[])

The parameter of this takes an array of key, value pairs, which are other arrays of size 2.

eg:

{ {'key1', 'value1'}, '{key2', 'value2'} }

Now, one of the values can also be an array of integers, eg {1,2,3} which I write as:

{ {'key1', 'value1'}, '{key2', '{val_2a, val_2b}'} }

This is syntacticaly invalid, so I re write it using the array constructor syntax as:

ARRAY[ ARRAY['key1', 'value1'], ARRAY['key2', '{val_2a, val_2b}'] ]

How would I parse this to a stored procedure using the npgsql wrapper?

I could pass it as a complete sql string, but the npgsql wrapper provides no escapeing functionality other than through its named parameter method.

Any ideas would be glady recieved.

Many thanks
Chris



ERROR: Query was cancelled [ reply ]
By: Brandon Arnold on 2007-03-20 15:22
[forum:1002264]
Hi,

This is a message that I only recently started receiving upon database queries to an external pgsql server. The Pgsql server version is 7.3.4 and Npgsql version (the .NET 2 build) is version 1.0.0.0. The connection seems to open fine, only when I pass a query string and execute it (ExecuteScalar, ExecuteReader, ...) I get the subject line error. If I fire up a cygwin shell and connect manually with the psql command, I can perform queries just fine. Has anyone come across this before?

Thanks,
Brandon

Npgsql source build failure, missing .ctor [ reply ]
By: Kelly Anderson on 2007-03-12 09:53
[forum:1002245]
NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006) Copyright (C) 2001-2006 Gerry Shaw http://nant.sourceforge.net

Buildfile: file:///home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/Npgsql.build
Target framework: Mono 2.0 Profile
Target(s) specified: build

Built-in property 'nant.project.basedir' is deprecated. Use the project::get-base-directory() function instead.
Built-in property 'nant.project.basedir' is deprecated. Use the project::get-base-directory() function instead.

init:

[mkdir] Creating directory '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/ms'.
[mkdir] Creating directory '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/res/ms'.
[mkdir] Creating directory '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/res/ms/Design'.
[mkdir] Creating directory '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/res/ms/NpgsqlTypes'.
[mkdir] Creating directory '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/mono'.
[mkdir] Creating directory '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/nunit2tests'.

resources:

[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlClosedState.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 9 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.de.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 9 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.es.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 9 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.fi.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 10 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.ja.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 11 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommandBuilder.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 9 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnectedState.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 13 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnection.de.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 13 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnection.es.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 13 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnection.fi.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 14 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnection.ja.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 14 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnection.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 6 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnectionString.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 12 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlEventLog.de.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 12 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlEventLog.es.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 12 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlEventLog.fi.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 12 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlEventLog.ja.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 12 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlEventLog.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 2 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlException.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameter.de.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameter.es.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameter.fi.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameter.ja.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameter.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameterCollection.de.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameterCollection.es.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameterCollection.fi.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 2 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameterCollection.ja.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 2 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameterCollection.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 10 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlReadyState.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 14 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlState.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlTransaction.de.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlTransaction.es.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlTransaction.fi.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlTransaction.ja.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlTransaction.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 2 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/PGUtil.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 37 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/Design/ConnectionStringEditorForm.de.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 37 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/Design/ConnectionStringEditorForm.es.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 23 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/Design/ConnectionStringEditorForm.fi.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 31 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/Design/ConnectionStringEditorForm.ja.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 620 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/Design/ConnectionStringEditorForm.resx'
[resgen] Writing resource file... Done.
[resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.resx'
[resgen] Writing resource file... Done.

build:

[csc] Compiling 58 files to '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/ms/Npgsql.dll'.
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(438,0): warning CS1587: XML comment is not placed on a valid language element
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataAdapter.cs(151,30): warning CS0108: `Npgsql.NpgsqlDataAdapter.DeleteCommand' hides inherited member `System.Data.Common.DbDataAdapter.DeleteCommand'. Use the new keyword if hiding was intended
[csc] /usr/lib/mono/gac/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll (Location of the symbol related to previous warning)
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataAdapter.cs(178,30): warning CS0108: `Npgsql.NpgsqlDataAdapter.SelectCommand' hides inherited member `System.Data.Common.DbDataAdapter.SelectCommand'. Use the new keyword if hiding was intended
[csc] /usr/lib/mono/gac/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll (Location of the symbol related to previous warning)
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataAdapter.cs(206,30): warning CS0108: `Npgsql.NpgsqlDataAdapter.UpdateCommand' hides inherited member `System.Data.Common.DbDataAdapter.UpdateCommand'. Use the new keyword if hiding was intended
[csc] /usr/lib/mono/gac/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll (Location of the symbol related to previous warning)
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataAdapter.cs(233,30): warning CS0108: `Npgsql.NpgsqlDataAdapter.InsertCommand' hides inherited member `System.Data.Common.DbDataAdapter.InsertCommand'. Use the new keyword if hiding was intended
[csc] /usr/lib/mono/gac/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll (Location of the symbol related to previous warning)
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.cs(353,32): warning CS0419: Ambiguous reference in cref attribute `System.Data.Common.DbDataAdapter.Update'. Assuming `System.Data.Common.DbDataAdapter.Update(System.Data.DataTable, System.Data.Common.DataTableMapping)' but other overloads including `System.Data.Common.DbDataAdapter.Update(System.Data.DataRow[], System.Data.Common.DataTableMapping)' have also matched
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnection.cs(823,26): warning CS1570: XML comment on `M:Npgsql.NpgsqlConnection.GetSchema' has non-well-formed XML (unexpected end of file. Current depth is 2 Line 4, position 1.)
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnectorPool.cs(236,21): warning CS1572: XML comment on `Npgsql.NpgsqlConnectorPool.ReleaseConnector(Npgsql.NpgsqlConnection, Npgsql.NpgsqlConnector)' has a param tag for `ForceClose', but there is no parameter by that name
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnectorPool.cs(407,21): warning CS1570: XML comment on `M:Npgsql.NpgsqlConnectorPool.FixPoolCountBecauseOfConnectionDisposeFalse(Npgsql.NpgsqlConnection)' has non-well-formed XML (Expected >, but found EOF [-1] Line 7, position 1.)
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(587,16): warning CS1572: XML comment on `NpgsqlTypes.NpgsqlNativeTypeInfo.NpgsqlNativeTypeInfo(string, NpgsqlTypes.NpgsqlDbType, System.Data.DbType, bool, NpgsqlTypes.ConvertNativeToBackendHandler)' has a param tag for `OID', but there is no parameter by that name
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(587,16): warning CS1572: XML comment on `NpgsqlTypes.NpgsqlNativeTypeInfo.NpgsqlNativeTypeInfo(string, NpgsqlTypes.NpgsqlDbType, System.Data.DbType, bool, NpgsqlTypes.ConvertNativeToBackendHandler)' has a param tag for `Type', but there is no parameter by that name
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(587,16): warning CS1572: XML comment on `NpgsqlTypes.NpgsqlNativeTypeInfo.NpgsqlNativeTypeInfo(string, NpgsqlTypes.NpgsqlDbType, System.Data.DbType, bool, NpgsqlTypes.ConvertNativeToBackendHandler)' has a param tag for `ConvertBackendToNative', but there is no parameter by that name
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(769,21): warning CS1572: XML comment on `NpgsqlTypes.NpgsqlBackendTypeMapping.AddType(int, string, NpgsqlTypes.NpgsqlDbType, System.Data.DbType, System.Type, NpgsqlTypes.ConvertBackendToNativeHandler)' has a param tag for `ConvertBackendToNative', but there is no parameter by that name
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(873,21): warning CS1572: XML comment on `NpgsqlTypes.NpgsqlNativeTypeMapping.AddType(string, NpgsqlTypes.NpgsqlDbType, System.Data.DbType, bool, NpgsqlTypes.ConvertNativeToBackendHandler)' has a param tag for `OID', but there is no parameter by that name
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(873,21): warning CS1572: XML comment on `NpgsqlTypes.NpgsqlNativeTypeMapping.AddType(string, NpgsqlTypes.NpgsqlDbType, System.Data.DbType, bool, NpgsqlTypes.ConvertNativeToBackendHandler)' has a param tag for `ConvertBackendToNative', but there is no parameter by that name
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(873,21): warning CS1572: XML comment on `NpgsqlTypes.NpgsqlNativeTypeMapping.AddType(string, NpgsqlTypes.NpgsqlDbType, System.Data.DbType, bool, NpgsqlTypes.ConvertNativeToBackendHandler)' has a param tag for `ConvertNativeToBackend', but there is no parameter by that name
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataAdapter.cs(39,26): warning CS1574: XML comment on `Npgsql.NpgsqlRowUpdatedEventHandler' has cref attribute `Npgsql.NpgsqlRowUpdatedEventArgs' that could not be resolved
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataAdapter.cs(46,26): warning CS1574: XML comment on `Npgsql.NpgsqlRowUpdatingEventHandler' has cref attribute `Npgsql.NpgsqlRowUpdatingEventArgs' that could not be resolved
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/MD5CryptoServiceProvider.cs(33,46): warning CS3019: CLS compliance checking will not be performed on `Npgsql.MD5CryptoServiceProvider._H' because it is not visible from outside this assembly
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/MD5CryptoServiceProvider.cs(34,44): warning CS3019: CLS compliance checking will not be performed on `Npgsql.MD5CryptoServiceProvider.count' because it is not visible from outside this assembly
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlState.cs(417,28): warning CS0219: The variable `cursorName' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlState.cs(617,29): warning CS0219: The variable `typeoid' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlState.cs(613,25): warning CS0219: The variable `lenght' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlClosedState.cs(73,28): warning CS0618: `System.Net.Dns.Resolve(string)' is obsolete: `Use GetHostEntry instead'
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlClosedState.cs(107,34): warning CS0168: The variable `ex' is declared but never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.cs(767,28): warning CS0219: The variable `portalName' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnection.cs(493,20): warning CS0219: The variable `oldDatabaseName' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataReader.cs(322,36): warning CS0219: The variable `TI' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameterStatus.cs(55,19): warning CS0219: The variable `messageLength' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(103,31): warning CS0168: The variable `e' is declared but never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(160,32): warning CS0219: The variable `param' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(158,32): warning CS0219: The variable `msg' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(157,31): warning CS0219: The variable `pid' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(156,31): warning CS0219: The variable `msglen' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(174,31): warning CS0219: The variable `l_nlen' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(183,31): warning CS0219: The variable `l_msgLen' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(225,30): warning CS0219: The variable `l_tStatus' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(281,32): warning CS0219: The variable `msg' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(280,31): warning CS0219: The variable `pid' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(330,35): warning CS0219: The variable `l_endChar' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(129,13): warning CS0162: Unreachable code detected
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlBind.cs(44,40): warning CS0414: The private field `Npgsql.NpgsqlBind.CLASSNAME' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCancelRequest.cs(38,40): warning CS0414: The private field `Npgsql.NpgsqlCancelRequest.CLASSNAME' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.cs(70,30): warning CS0414: The private field `Npgsql.NpgsqlCommand.invalidTransactionDetected' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommandBuilder.cs(45,40): warning CS0414: The private field `Npgsql.NpgsqlCommandBuilder.CLASSNAME' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnectionString.cs(41,40): warning CS0414: The private field `Npgsql.NpgsqlConnectionString.CLASSNAME' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnectorPool.cs(384,33): warning CS0169: The private method `Npgsql.NpgsqlConnectorPool.GetSharedConnector(Npgsql.NpgsqlConnection)' is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnectorPool.cs(498,22): warning CS0169: The private method `Npgsql.NpgsqlConnectorPool.UngetSharedConnector(Npgsql.NpgsqlConnection, Npgsql.NpgsqlConnector)' is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataReader.cs(79,25): warning CS0169: The private method `Npgsql.NpgsqlDataReader.HaveRow()' is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDescribe.cs(41,40): warning CS0414: The private field `Npgsql.NpgsqlDescribe.CLASSNAME' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlException.cs(44,40): warning CS0414: The private field `Npgsql.NpgsqlException.CLASSNAME' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlExecute.cs(40,40): warning CS0414: The private field `Npgsql.NpgsqlExecute.CLASSNAME' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlFlush.cs(41,40): warning CS0414: The private field `Npgsql.NpgsqlFlush.CLASSNAME' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParse.cs(45,40): warning CS0414: The private field `Npgsql.NpgsqlParse.CLASSNAME' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlSync.cs(41,40): warning CS0414: The private field `Npgsql.NpgsqlSync.CLASSNAME' is assigned but its value is never used
[csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(44,40): warning CS0414: The private field `NpgsqlTypes.NpgsqlTypesHelper.resman' is assigned but its value is never used
[csc] Compilation succeeded - 56 warning(s)
[al] Compiling 7 files to '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/ms/de/Npgsql.resources.dll'.
[al] ** (/usr/lib/mono/1.0/al.exe:28176): WARNING **: Missing method .ctor in assembly /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/ms/Npgsql.dll, type System.Runtime.CompilerServices.RuntimeCompatibilityAttribute
[al] ** ERROR **: Can't find custom attr constructor image: /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/ms/Npgsql.dll mtoken: 0x0a0001d5
[al] aborting...
[al] Stacktrace:
[al] at (wrapper managed-to-native) System.MonoCustomAttrs.GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool) <0x00004>
[al] at (wrapper managed-to-native) System.MonoCustomAttrs.GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool) <0xffffffff>
[al] at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider,System.Type) <0x00025>
[al] at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider,System.Type,bool) <0x0007e>
[al] at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider,bool) <0x00084>
[al] at System.Reflection.Assembly.GetCustomAttributes (bool) <0x0000f>
[al] at Mono.AssemblyLinker.AssemblyLinker.DoIt () <0x001e9>
[al] at Mono.AssemblyLinker.AssemblyLinker.DynMain (string[]) <0x00018>
[al] at Mono.AssemblyLinker.AssemblyLinker.Main (string[]) <0x00025>
[al] at (wrapper runtime-invoke) System.Object.runtime_invoke_int_string[] (object,intptr,intptr,intptr) <0xffffffff>
[al] Native stacktrace:
[al] /usr/bin/mono [0x815778a]
[al] [0xffffe440]
[al] /lib/tls/libc.so.6(abort+0xe9) [0xb7d160d9]
[al] /usr/lib/libglib-2.0.so.0 [0xb7e818d2]
[al] /usr/lib/libglib-2.0.so.0(g_log+0x26) [0xb7e81906]
[al] /usr/bin/mono(mono_custom_attrs_from_index+0x1d0) [0x80d8c20]
[al] /usr/bin/mono(mono_custom_attrs_from_assembly+0x44) [0x80d8d54]
[al] /usr/bin/mono(mono_reflection_get_custom_attrs_info+0x141) [0x80d91f1]
[al] /usr/bin/mono(mono_reflection_get_custom_attrs_by_type+0x14) [0x80e35e4]
[al] [0xb7422b3f]
[al] [0xb7422a56]
[al] [0xb74223b7]
[al] [0xb7422245]
[al] [0xb74221a8]
[al] [0xb7aaf602]
[al] [0xb7aa3069]
[al] [0xb7aa287e]
[al] [0xb7aa27d5]
[al] /usr/bin/mono(mono_runtime_exec_main+0x13c) [0x80cce5c]
[al] /usr/bin/mono(mono_runtime_run_main+0x21f) [0x80cd0ef]
[al] /usr/bin/mono(mono_main+0xfeb) [0x805915b]
[al] /usr/bin/mono [0x8057c8e]
[al] /lib/tls/libc.so.6(__libc_start_main+0xd4) [0xb7d00e14]
[al] /usr/bin/mono [0x8057bb1]
[al] Debug info from gdb:
[al] (no debugging symbols found)
[al] Using host libthread_db library "/lib/tls/libthread_db.so.1".
[al] (no debugging symbols found)
[al] (no debugging symbols found)
[al] (no debugging symbols found)
[al] (no debugging symbols found)
[al] (no debugging symbols found)
[al] [Thread debugging using libthread_db enabled]
[al] [New Thread -1211193664 (LWP 28176)]
[al] [New Thread -1219290192 (LWP 28180)]
[al] [New Thread -1209107536 (LWP 28178)]
[al] (no debugging symbols found)
[al] (no debugging symbols found)
[al] (no debugging symbols found)
[al] (no debugging symbols found)
[al] (no debugging symbols found)
[al] (no debugging symbols found)
[al] (no debugging symbols found)
[al] (no debugging symbols found)
[al] (no debugging symbols found)
[al] (no debugging symbols found)
[al] 0xb7d77fe1 in fork () from /lib/tls/libc.so.6
[al] 3 Thread -1209107536 (LWP 28178) 0xb7e4899c in __nanosleep_nocancel ()
[al] from /lib/tls/libpthread.so.0
[al] 2 Thread -1219290192 (LWP 28180) 0xb7e45b11 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
[al] 1 Thread -1211193664 (LWP 28176) 0xb7d77fe1 in fork ()
[al] from /lib/tls/libc.so.6
[al] Thread 3 (Thread -1209107536 (LWP 28178)):
[al] #0 0xb7e4899c in __nanosleep_nocancel () from /lib/tls/libpthread.so.0
[al] #1 0x080f052e in mono_thread_interruption_request_flag ()
[al] #2 0xb7e4320e in start_thread () from /lib/tls/libpthread.so.0
[al] #3 0xb7db50de in clone () from /lib/tls/libc.so.6
[al] Thread 2 (Thread -1219290192 (LWP 28180)):
[al] #0 0xb7e45b11 in pthread_cond_wait@@GLIBC_2.3.2 ()
[al] from /lib/tls/libpthread.so.0
[al] #1 0x080f543f in mono_thread_interruption_request_flag ()
[al] #2 0x080f55af in mono_thread_interruption_request_flag ()
[al] #3 0x080f571a in mono_thread_interruption_request_flag ()
[al] #4 0x08104d72 in mono_pthread_key_for_tls ()
[al] #5 0x080a251c in mono_domain_finalize ()
[al] #6 0x080ef1fe in mono_thread_get_pending_exception ()
[al] #7 0x08104105 in mono_pthread_key_for_tls ()
[al] #8 0x08115f04 in GC_push_all_stack ()
[al] #9 0x08116530 in GC_start_blocking ()
[al] #10 0x00000000 in ?? ()
[al] Thread 1 (Thread -1211193664 (LWP 28176)):
[al] #0 0xb7d77fe1 in fork () from /lib/tls/libc.so.6
[al] #1 0xb7e4a144 in fork () from /lib/tls/libpthread.so.0
[al] #2 0xb7ea2018 in g_spawn_error_quark () from /usr/lib/libglib-2.0.so.0
[al] #3 0xb7ea2a3f in g_spawn_sync () from /usr/lib/libglib-2.0.so.0
[al] #4 0xb7ea2ef7 in g_spawn_command_line_sync () from /usr/lib/libglib-2.0.so.0
[al] #5 0x08157823 in mono_debugger_run_finally ()
[al] #6 <signal handler called>
[al] #7 0xb7d14847 in raise () from /lib/tls/libc.so.6
[al] #8 0xb7d160d9 in abort () from /lib/tls/libc.so.6
[al] #9 0xb7e818d2 in g_logv () from /usr/lib/libglib-2.0.so.0
[al] #10 0xb7e81906 in g_log () from /usr/lib/libglib-2.0.so.0
[al] #11 0x080d8c20 in mono_custom_attrs_from_index ()
[al] #12 0x080d8d54 in mono_custom_attrs_from_assembly ()
[al] #13 0x080d91f1 in mono_reflection_get_custom_attrs_info ()
[al] #14 0x080e35e4 in mono_reflection_get_custom_attrs_by_type ()
[al] #15 0xb7422b3f in ?? ()
[al] #16 0x00041e40 in ?? ()
[al] #17 0x00000000 in ?? ()
[al] #0 0xb7d77fe1 in fork () from /lib/tls/libc.so.6
[al] =================================================================
[al] Got a SIGABRT while executing native code. This usually indicates
[al] a fatal error in the mono runtime or one of the native libraries
[al] used by your application.
[al] =================================================================

BUILD FAILED - 0 non-fatal error(s), 172 warning(s)

External Program Failed: /usr/lib/mono/1.0/al.exe (return code was 134)

Total time: 4 seconds.

User 'postgres' cannot login [ reply ]
By: Penelope Dramas on 2007-03-19 20:15
[forum:1002262]
Hello,

We just switched from MSDE to PostgreSQL and I'm having some problems.

I have created postgresql account when installing and I'm unable to login through npgsql.net driver. I keep getting password error.
However, when I create another user I have no problems logging in.

Is there any restriction for 'postgresql' user built-in .net driver?

Thanks ...

Penelope D.

Hundreds of open connections on server.... [ reply ]
By: steven floyd on 2007-03-05 00:14
[forum:1002223]
Have written the user interface using Visual Basic Express 2005.

Some tables have RULES that NOTIFY each each time the rows are inserted, deleted or notified.

The clients LISTEN and update the user interfaces.

Worked well for a week then found that table inserts and updates were becomming slower and slower....

Tracked down that the database server had lots of connections (maybe 100 or so).

Each time the table was modified the server CPU go to 100% while all the connections were notified.

Found that all the connections were caused by my client programs not closing the connections when they were exiting.

Had to restart the database server to get rid all the unclosed connections.

Fixed my program so it now closes the connection on exit.

However, if program crashes the connection can be left open.

I would never had found the problem if I was not using notify.

Questions:
1. Is this a bug in the NpgsqlConnection? (Should it be closing the connection automatically in it's destructor?)

2. Can the connection or the server be setup automatically close unused connections?

Any input would be appreciated!

Thanks
Steven.



problem with IDataReader + npgsql [ reply ]
By: Jan Dante Meulemeester on 2007-02-27 16:22
[forum:1002206]
I'm getting the following problem:

Unhandled Exception: Npgsql.NpgsqlException:
syntax error at or near "="
Severity: ERROR
Code: 42601
at Npgsql.NpgsqlConnector.CheckErrors () [0x00000]
at Npgsql.NpgsqlConnector.CheckErrorsAndNotifications () [0x00000]
at Npgsql.NpgsqlCommand.ExecuteCommand () [0x00000]
at Npgsql.NpgsqlCommand.ExecuteReader (CommandBehavior cb) [0x00000]
at Npgsql.NpgsqlCommand.ExecuteReader () [0x00000]
at Npgsql.NpgsqlCommand.System.Data.IDbCommand.ExecuteReader () [0x00000]
at ERPforKMO.Klantenbeheer..ctor () [0x000d1] in /home/jandante/Projects/ERPforKMO/ERPforKMO/Klantenbeheer.cs:51
at ERPforKMO.MainClass.Main (System.String[] args) [0x00005] in /home/jandante/Projects/ERPforKMO/ERPforKMO/Main.cs:14

with the following code:

public Klantenbeheer() :
base(null)
{
Stetic.Gui.Build(this, typeof(ERPforKMO.Klantenbeheer));
string connectionString =
"Server=localhost;" +
"Database=ERPforKMO;" +
"User ID=postgres;" +
"Password=CwWnxaW7;";
IDbConnection dbcon;
dbcon = new NpgsqlConnection(connectionString);
dbcon.Open();
IDbCommand dbcmd = dbcon.CreateCommand();
string sql =
"SELECT id, naam, rechtsvorm_id, adres, postcode_id, tel, e_mail " +
"FROM administration.bedrijven";
dbcmd.CommandText = sql;
IDataReader reader = dbcmd.ExecuteReader();
while (reader.Read()) {
txtID.Text = Convert.ToString(reader["id"]);
txtName.Text = (string) reader["naam"];
txtAddress.Text = (string) reader["adres"];
string test = Convert.ToString(reader["postcode_id"]);
//Postcode en gemeente ophalen
IDbCommand dbcmd2 = dbcon.CreateCommand();
string sqlPostcodeGemeente =
"SELECT id, postcode, stad, provincie, land " +
"FROM administration.postcode" +
"WHERE id = " + test;
dbcmd2.CommandText = sqlPostcodeGemeente;
(THE FOLLOWING LINE IS THE FAULT) IDataReader readerPostcode = dbcmd2.ExecuteReader();
while (readerPostcode.Read()) {
txtPostcode.Text = Convert.ToString(readerPostcode["postcode"]);
}
readerPostcode.Close();
readerPostcode = null;
dbcmd2.Dispose();
dbcmd2 = null;
txtTel.Text = Convert.ToString(reader["tel"]);
txtEmail.Text = (string) reader["e_mail"];
}
//clean up
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
}
The error is marked with: (THE FOLLOWING LINE GIVES THE ERROR)
I'm developping with monodevelop (0.12) and the mono 2.0 stack. It's the same code as with the first IDataReader (dbcmd)...

DataReader VS. DataSet ?? [ reply ]
By: Ayna Mayna on 2007-02-28 07:45
[forum:1002210]
What is your advise in general conditions?
Thank you.

How to get number of rows? [ reply ]
By: Ayna Mayna on 2007-02-27 07:32
[forum:1002202]
How can I get number of rows in my query?
Thank you...

executeReader duda [ reply ]
By: victor chavez on 2007-02-27 10:25
[forum:1002204]
es posible ejecutar un query dentro de otro sin haber cerrado el reader anterior?

es decir:

NpgsqlCommand command = new NpgsqlCommand("select * from tablea", conn);


try
{
NpgsqlDataReader dr = command.ExecuteReader();
while(dr.Read())
{
int = dr.getInt32(0);
NpgsqlCommand command2 = new NpgsqlCommand("select * from tableb where id = " + id, conn);
dr2.read();.........close();

}

}

finally
{
conn.Close();
}

refcursor returning <unnamed portal #> [ reply ]
By: Patrick Greenwald on 2006-09-15 22:19
[forum:1001767]
I have a very simple procedure that doesn't take any parameters, and returns a refcursor. It worked fine in 0.98.2 but is "Broken" in 0.99.2 and 0.99.3

I did look at Keith Kikta's post, but since I am not using input parameters, the solution didn't seem applicable.

I looked in the release notes, but didn't see any mention of changes to refcursor handling.

My procedure looks like:
CREATE OR REPLACE FUNCTION eventsselectall()
RETURNS refcursor AS
$BODY$
DECLARE
retval refcursor;
BEGIN
OPEN retval FOR
SELECT * FROM events;

RETURN retval;

EXCEPTION
WHEN others THEN
RETURN NULL;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;

The code that works in Beta but not RC is:
using (NpgsqlConnection cn = new NpgsqlConnection(connectString)) {
cn.Open();
using (NpgsqlTransaction transaction = cn.BeginTransaction()) {
using (NpgsqlCommand cmd = new NpgsqlCommand()) {
cmd.Connection = cn;
cmd.CommandText = "eventsselectall";
cmd.Transaction = transaction;
cmd.CommandType = System.Data.CommandType.StoredProcedure;
using (NpgsqlDataAdapter da = new NpgsqlDataAdapter(cmd)) {
using (ds = new System.Data.DataSet()) {
da.Fill(ds);
foreach (System.Data.DataRow row in ds.Tables[0].Rows) {
Console.WriteLine("(data adapter) {0}:{1}", row[0].ToString(), row[0].GetType());
}
}
}
}
}
}

I'm suprised that I haven't seen more feedback on this before now. I did run the log in debug mode, and both (RC2 and Beta2) log files were identical.

Patrick

migrating from MySql [ reply ]
By: Roberto Linares on 2007-02-09 21:03
[forum:1002154]
I was working for a long time on MySql and connecting to it with C# with MySqlConnector.Net. From MySql o my C# project, I used the command 'SHOW TABLES' to get, like a query, all the names of the tables from the selected database. With this, I automatically filled a DataSet with all the tables from a database.

Now, I'm migrating to PostgreSql and using Npgsql to connect to a database from C# but PostgreSql doesn't have a 'SHOW TABLES' command!!!.

My question is:
How can I know wich are the table names from a database from my C# project using Npgsql and fill a DataSet automatically with them?

No NpgsqlConnection.Notification function???? [ reply ]
By: steven floyd on 2007-02-20 23:40
[forum:1002187]
Trying to follow the simple example for Synchronous notifications.

The example has:
conn.Notification += new NotificationEventHandler(NotificationSupportHelper);


I am using visual basic 2005 and the member function .Notification does not seem to exist??

Any ideas?

Thanks

connection actively refused [ reply ]
By: glok twen on 2007-02-16 02:06
[forum:1002177]
hi. i downloaded and started to use npgsql - the ms20 version 1.0.0.0 version. i keep getting a connection refused on the initial connection. what's puzzling is i run pgadmin3 with the equivalent connection string from the same xp box and it connects no problem.

have i missed something?
what things would you check first to narrow down the cause?

thanks,
gt

Latest Npgsql 1.0 release? [ reply ]
By: Simon W on 2007-02-10 15:14
[forum:1002157]
Hi,

Which is the latest of Npgsql 1.0? I currently use 1.0 (2006-10-08) however I'm getting "System.NotSupportedException: This stream does not support seek operations" exceptions in multi-threaded applications which I thought was fixed in 1.0 RC3

Thanks

Synchronous notification blocks GC [ reply ]
By: Maarten Claes on 2007-02-08 10:19
[forum:1002145]
Hello,

I've a static connection with an attached notification eventhandler. When the connection object is processed by the GC, the connections thread is blocked at the line marked with '>>>>>' and the application hangs:

<code>
internal void RemoveNotificationThread()
{
// Wait notification thread finish its work.
>>>>>> _notificationAutoResetEvent.WaitOne();

// Kill notification thread.
_notificationThread.Abort();
_notificationThread = null;

// Special case in order to not get problems with thread synchronization.
// It will be turned to 0 when synch thread is created.
_notificationThreadStopCount = 1;

}
</code>

I've tried unregistering the eventhandler and closing the connection before it's destroyed by the GC. But the problem remains.

Sometimes it does block and sometimes it doesn't. I don't know when (seems to be random).

Kind regards,

Maarten Claes

Missing Namespace [ reply ]
By: Marc O'Neill on 2007-02-08 00:38
[forum:1002140]
Im trying to use Npgsql in a windows C# application.
The promlem is i recieve the following error

The type or namespace name 'Npgsql' could not be found (are you missing a using directive or an assembly reference?)

I have added to the GAC and I am using the using Npgsql declaration but still no joy. Any help would be great.

Im using vs2005.

Thanks
Marc

Compiling Error on Mono 2.0 [ reply ]
By: Kadri Kalemci on 2007-02-06 21:46
[forum:1002136]
I have a development platform on Debian with Mono 2.0 Framework. I'm using Monodevelop..

I have a postgreSql server and I want to connect that server using npgsql 1.0 that is installed on GAC.

When I make a reference to npgsql.dll from a project, monodevelop builds that project but when I started the project, following error occured:


** (/home/kadri/Projects/Intimatek/Testing/bin/Debug/Testing.exe:16727): WARNING **:
Missing method .ctor in assembly
/home/kadri/Projects/Intimatek/Testing/bin/Debug/Npgsql.dll, type
System.Runtime.CompilerServices.RuntimeCompatibilityAttribute

** ERROR **: Can't find custom attr constructor image:
/home/kadri/Projects/Intimatek/Testing/bin/Debug/Npgsql.dll mtoken: 0x0a00016e
aborting...
Stacktrace:

at (wrapper managed-to-native) System.MonoCustomAttrs.GetCustomAttributesInternal
(System.Reflection.ICustomAttributeProvider,System.Type,bool) <0x00004>

*************************************

What's the problem? How can I solve this?


Npgsql Visual Studio 2005 [ reply ]
By: Jean-Baptiste Raynaud on 2007-01-31 10:57
[forum:1002126]
Hi,

I donwloaded the Npgsql1.0-bin-ms2.0 version, and I use it for an ASP.NET application builded with VS 2005 an framework .NET 2.0.
Is it possible to use a NpgsqlConnection or NpgsqlDataAdapter as visual component in VS 2005? I didn't find how to do this.
I tried also to create a connection to a Postresql database with an ODBC or OLEDB driver but it doesn't work. The OLEDB connection doesn't work, and the ODBC Connection seems to work but the "Tables" section is empty...

It's not very useful because I have to create my connection and write my queries directly into my C# code, and I use a loop on the datareader to fill each page's component like combo, gridview...

I hope there's a solution to do this in an easier way...

Thanks.

CommandBehavior.SchemaOnly not working [ reply ]
By: Andrus Moor on 2007-01-28 21:52
[forum:1002119]
FYIReporting RDLDesigner executes select commands containing limit clauses using ExecuteReader(CommandBehavior.SchemaOnly)

This causes npgsql ExecuteReader to add LIMIT 0 clause to statement sent to PostgreSQL.
npgsql generates invalid SELECT statement.

Any idea how to fix this ?

Code to reproduce:

using System.Data;
using Npgsql;

class Program {
static void Main() {
Npgsql.NpgsqlConnection conn = new NpgsqlConnection(
"ENCODING=UNICODE;SERVER=localhost;DATABASE=postgres;" +
"USER ID=postgres");
conn.Open();
IDbCommand cmd = new Npgsql.NpgsqlCommand(
"select * from pg_tables limit 1", conn);
cmd.ExecuteReader(CommandBehavior.SchemaOnly);
}
}

Observed:

Message="ERROR: 42601: syntax error at or near \"limit\""
ErrorSql="select * from pg_tables limit 1 limit 0;"

Using IN() in Prepared Statements [ reply ]
By: s andaya on 2006-06-20 15:35
[forum:1001460]
Is there a way to do IN() as a prepared statement? i.e.:

"SELECT * FROM table WHERE id IN (:listvalue)"
"command.Parameters["listvalue"].Value = new int[2] {1,2};"

I saw a thread from 2004 and the answer was "no" back then....

Thanks!





Missing Resouce in Npgsql 2.0 [ reply ]
By: Thomas Burkhart on 2007-01-18 13:18
[forum:1002104]
Hi,

I just test the DbProvider architecture. I was quite suprised when I got a really strange exception:

DScanTests.DatabaseCoreTest.TestDbProviderFactory : System.Resources.MissingManifestResourceException : Für die angegebene Kultur oder die neutrale Kultur konnten keine Ressourcen gefunden werden. Stellen Sie sicher, dass Npgsql.NpgsqlConnectionString.resources beim Kompilieren richtig in die Assembly Npgsql eingebettet wurde, oder dass die erforderlichen Satellitenassemblys geladen werden können und vollständig signiert sind.

This means, that a requested resouce string is not availabe in my culture.

I tracked it down, it happens here

System.Resources.ResourceManager.GetString(String name)
Npgsql.NpgsqlConnectionString.ParseConnectionString(String CS) in C:\Entwicklung\DScan V2\Npgsql2\src\Npgsql\NpgsqlConnectionString.cs:Zeile 129.
Npgsql.NpgsqlConnection.set_ConnectionString(String value) in C:\Entwicklung\DScan V2\Npgsql2\src\Npgsql\NpgsqlConnection.cs:Zeile 232.
CMT.DScan.DocEditor.DatabaseManager.getDbProviderFactory() in C:\Entwicklung\DScan V2\DocumentEditor\DatabaseManager\DatabaseManager.cs:Zeile 176.
DScanTests.DatabaseCoreTest.TestDbProviderFactory() in C:\Entwicklung\DScan V2\DScanTests\DatabaseCoreTest.cs:Zeile 278.


// Check if there is a key-value pair.
if (keyvalue.Length != 2)
{
throw new ArgumentException(resman.GetString("Exception_WrongKeyVal"), Key);
}

What I don't understand is, why I don't get the fallback resource that exists in english if my german ressource is not available.

Cheers

Thomas


Feature request [ reply ]
By: Alejandro Gasca on 2007-01-19 10:50
[forum:1002113]
Hi.

I'm not sure this is a valid feature request, but, can you add an exception when putting an invalid parameter in the connection string?

I put Encodnig=UNICODE instead of Encoding=UNICODE, don't see the error and... well... i was unable to locate the error in the malformed accented string...

Thanks.

Alejandro


Help modifying npgsql [ reply ]
By: Alejandro Gasca on 2006-11-21 15:12
[forum:1001942]
Hi, i have this overloads of this methos of NpgsqlCommandBuilder:
GetUpdateCommand (DataRow row, string[] queLlave)
GetDeleteCommand (DataRow row, string[] queLlave)
Which are (almost) copies of the original methos; this methos make a simplification of the string sended to the server.

Ok. I insert this overloads in NpgsqlCommandBuilder.cs, and modify the AssemblyInfo by increasing the revision number.

But, as i see in "Price of the npgsql?" this is not recommended.

Meaby, deriving from NpgsqlCommandBuilder will resolve this situation, but, i use the same class memebers if the original Get*Commands, so, to work this class members must be turn to public / protected:
BuildSchema, GetQuotedName, QualifiedTableName
and select_schema... of couse, remove the sealed modifier of NpgsqlCommandBuilder...

So, witch are the options for the tiny changes i do?
-- just change revision?
-- change dll name?
-- ?

Thanks,

Alejandro.

Protocol option not supported in MONO [ reply ]
By: Andrus Moor on 2007-01-13 16:34
[forum:1002094]
Today I started to receive error

Protocol option not supported

when running Npgsql1.0 with MONO

Error occurs in line

Connection.Open();

Npgsql1.0 source code and docs does not contain such message.
When running under .NET this error does not occur.
It occurs even if PostgreSQL server is not running.

Any idea how to fix it ?


Code where error occurs is:

public static void CreateConnection(string Server, string Database,
string User, string Password) {

NpgsqlEventLog.Level = LogLevel.Debug;
NpgsqlEventLog.LogName = @"c:\NpgsqlLogFile.txt";

if (Connection != null)
Connection.Close();

ConnectionString = "ENCODING=UNICODE;" +
"SERVER=" + Server + ";" +
"DATABASE=" + Database + ";" +
"USER ID=" + User + ";" +
"PASSWORD=" + Password + ";";

Connection = new NpgsqlConnection(ConnectionString);
IDbCommand Command = new NpgsqlCommand(@"
SET search_path TO firma1,public;
SELECT sfirmanimi FROM prpalk",
(NpgsqlConnection)Connection);
// Follwing line causes error Protocol Option not supported in MONO
Connection.Open();
}

Stack trace:

Protocol option not supportedStack trace: at Npgsql.NpgsqlClosedState.Open (Npgsql.NpgsqlConnector context) [0x00000]
at Npgsql.NpgsqlConnector.Open () [0x00000]
at Npgsql.NpgsqlConnectorPool.GetPooledConnector (Npgsql.NpgsqlConnection Connection) [0x00000]


Log file:

13.01.2007 18:12:45 2364 Debug Entering NpgsqlConnection.NpgsqlConnection(NpgsqlConnection())
13.01.2007 18:12:45 2364 Debug ConnectionString Option: ENCODING = UNICODE
13.01.2007 18:12:45 2364 Debug ConnectionString Option: SERVER = localhost
13.01.2007 18:12:45 2364 Debug ConnectionString Option: DATABASE = mydb
13.01.2007 18:12:45 2364 Debug ConnectionString Option: USER ID = admin
13.01.2007 18:12:45 2364 Debug ConnectionString Option: PASSWORD = p
13.01.2007 18:12:45 2364 Debug Entering NpgsqlCommand.NpgsqlCommand()
13.01.2007 18:12:45 2364 Debug Entering NpgsqlParameterCollection.NpgsqlParameterCollection()
13.01.2007 18:12:45 2364 Debug Set NpgsqlCommand.Transaction =
13.01.2007 18:12:45 2364 Debug Entering NpgsqlConnection.Open()
13.01.2007 18:12:46 2364 Debug Get NpgsqlClosedState.Instance
13.01.2007 18:12:46 2364 Debug Get NpgsqlClosedState.Instance
13.01.2007 18:12:46 2364 Debug Entering NpgsqlClosedState.Open()
13.01.2007 18:12:46 2364 Debug Get NpgsqlClosedState.Instance

Selecting a field that is null [ reply ]
By: Curtis Scheer on 2007-01-11 20:22
[forum:1002092]
What is the proper way to select a varchar field as a null value.

for instance this doesn't return any rows

cmd.Parameters.Add("desc",NpgsqlDbType.Char).Value = Nothing
cmd.Parameters.Item("desc").IsNullable = True
cmd.CommandText = "select * from foo where description = :desc"
Reader = cmd.ExecuteReader()
Do While Reader.Read
MsgBox(Reader.Item("fooid"))
Loop

is the only way to get null values to use the is null keyword like so
"select * from foo where description is null"

Thanks,
Curtis

How to generate a typed dataset? [ reply ]
By: Sascha Storzum on 2007-01-11 10:30
[forum:1002088]
Hi,

I work wirh SharpDevelop2 and need to generate a typed dataset.
With the SQLDataAdapter I can generate it over a attribute in the SQLDataAdapter.
In the npgsqlDataAdapter I don`t see such an attribute.

Thanks for any hints.

Greets
Storzi

Unhandled Exception when trying to pull a SQ [ reply ]
By: Sascha Storzum on 2007-01-09 20:28
[forum:1002083]


Hi,

I get a unhandled exception when I try to pull a NpgsqlConnection into a formular.

I have installed the Npgsql - Assembly (1.0) with gacutil2 and put the NpgsqlConnection in the sidebar.




.NET Version : 2.0.50727.42
OS Version : Microsoft Windows NT 5.1.2600 Service Pack 2
Current culture : German (Germany) (de-DE)
Current UI language : en
Working Set Memory : 75204kb
SharpDevelop Version : 2.0.0.1710

Failed to create component 'NpgsqlConnection'. The error message follows:
'System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. Das System kann die angegebene Datei nicht finden.
File name: 'Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'
at Npgsql.NpgsqlConnection..ctor(String ConnectionString)
at Npgsql.NpgsqlConnection..ctor()

WRN: Protokollierung der Assemblybindung ist AUS.
Sie können die Protokollierung der Assemblybindungsfehler aktivieren, indem Sie den Registrierungswert [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) auf 1 festlegen.
Hinweis: Die Protokollierung der Assemblybindungsfehler führt zu einer gewissen Leistungseinbuße.
Sie können dieses Feature deaktivieren, indem Sie den Registrierungswert [HKLM\Software\Microsoft\Fusion!EnableLog] entfernen.
'
Exception thrown:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. Das System kann die angegebene Datei nicht finden.
File name: 'Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'
at Npgsql.NpgsqlConnection..ctor(String ConnectionString)
at Npgsql.NpgsqlConnection..ctor()

WRN: Protokollierung der Assemblybindung ist AUS.
Sie können die Protokollierung der Assemblybindungsfehler aktivieren, indem Sie den Registrierungswert [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) auf 1 festlegen.
Hinweis: Die Protokollierung der Assemblybindungsfehler führt zu einer gewissen Leistungseinbuße.
Sie können dieses Feature deaktivieren, indem Sie den Registrierungswert [HKLM\Software\Microsoft\Fusion!EnableLog] entfernen.

--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
at System.SecurityUtils.SecureConstructorInvoke(Type type, Type[] argTypes, Object[] args, Boolean allowNonPublic, BindingFlags extraFlags)
at System.ComponentModel.ReflectTypeDescriptionProvider.CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args)
at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args)
at System.ComponentModel.TypeDescriptor.CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args)
at System.ComponentModel.Design.DesignSurface.CreateInstance(Type type)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType)
at System.Drawing.Design.ToolboxItem.CreateComponentsCore(IDesignerHost host)
at System.Drawing.Design.ToolboxItem.CreateComponentsCore(IDesignerHost host, IDictionary defaultValues)
at System.Drawing.Design.ToolboxItem.CreateComponents(IDesignerHost host, IDictionary defaultValues)
at System.Windows.Forms.Design.OleDragDropHandler.CreateTool(ToolboxItem tool, Control parent, Int32 x, Int32 y, Int32 width, Int32 height, Boolean hasLocation, Boolean hasSize, ToolboxSnapDragDropEventArgs e)

Windows 98 and SSL problem [ reply ]
By: Pawel Michalowski on 2006-12-20 10:25
[forum:1002038]
Hello,
I wrote client application which connects to PostgreSQL servier via npgsql. The application is simple - it gets from server some info about people with given first/lastname. The application works with no problem on WindowsXP, however on Windows98 it just hangs up without any exception.

PostgreSQL version is 8.2.0 and is configured to use SSL. Npgsql version is 1.0.

From the behaviour of the application it seems that it hangs when opening connection. I enabled logging in npgsql and the last entries from it are:
----------------------------------------------------------
Debug Entering NpgsqlStartupPacket.NpgsqlStartupPacket()
Debug Entering NpgsqlStartupPacket.WriteToStream()
Debug Entering NpgsqlStartupPacket.WriteToStream_Ver_3()
Debug Entering PGUtil.WriteString()
Debug String written: user.
Debug Entering PGUtil.WriteString()
Debug String written: LuxDataSearcherAdmin.
Debug Entering PGUtil.WriteString()
Debug String written: database.
Debug Entering PGUtil.WriteString()
Debug String written: LuxDataSearcher.
Debug Entering PGUtil.WriteString()
Debug String written: DateStyle.
Debug Entering PGUtil.WriteString()
Debug String written: ISO.
----------------------------------------------------------

Last entries from server log:
----------------------------------------------------------
DEBUG: 00000: forked new backend, pid=19719 socket=12
LOCATION: BackendStartup, postmaster.c:2573
192.168.15.65 /usr/local/pgsql/bin/postgres DEBUG: 00000: SSL connection from "(anonymous)"
192.168.15.65 /usr/local/pgsql/bin/postgres LOCATION: open_server_SSL, be-secure.c:946
DEBUG: 00000: reaping dead processes
LOCATION: reaper, postmaster.c:2010
DEBUG: 00000: server process (PID 19719) exited with exit code 1
LOCATION: LogChildExit, postmaster.c:2417
----------------------------------------------------------

Are there any issues in case of Windows 98 I should be aware of?

Any help will be very appreciated.

Why ContinueUpdateOnError is not implemented [ reply ]
By: Andrus Moor on 2006-12-29 12:30
[forum:1002055]
.NET data provider must implement DataAdapter.ContinueUpdateOnError
property in transaction.

ContinueUpdateOnError requires that transaction continues after error. In this case .NET can mark all bad rows in DataGrid. User can see all errors together.

Unfortunately inside transaction after error PostgreSQL returns message

"Current transaction aborted, command ignored after end of transaction block"

for all subsequent commands.

npgsql does NOT have any support for fix this.
It marks ALL subsequent commands as invalid.
So npgsql cannot used as reliable .NET data provider.

NpgsqlDataAdapter must invoke automatic SAVEPOINT / ROLLBACK TO SAVEPOINT commands if ContinueUpdateOnError is set.

Why this is not implemented ?

Andrus

Why exception is not catched [ reply ]
By: Andrus Moor on 2006-12-24 18:07
[forum:1002046]
The following code causes error in Update() line

Npgsql.NpgsqlException was unhandled by user code

Why exception is not catched ?
catch must catch all exceptions!

------ code:

int RowsUpdated;
try {
RowsUpdated = datapter.Update(changes);
}
catch {
System.Windows.Forms.MessageBox.Show("error");
transact.Rollback();
throw;
}


error message details are:

Npgsql.NpgsqlException was unhandled by user code
Message="ERROR: 23505: duplicate key violates unique constraint \"konto_pkey\""
Source="Npgsql"
BaseMessage="duplicate key violates unique constraint \"konto_pkey\""
Code="23505"
Detail=""
ErrorSql="update \"firma1\".\"konto\" set \"kontonr\" = '2', ....
File="nbtinsert.c"
Hint=""
Line="277"
Position=""
Routine="_bt_check_unique"
Severity="ERROR"
Where=""

StackTrace:
at Npgsql.NpgsqlConnector.CheckErrors() in c:\Desenvolvimento\NpgsqlBuildOficial2.0\src\Npgsql\NpgsqlConnector.cs:line 359
at Npgsql.NpgsqlConnector.CheckErrorsAndNotifications() in c:\Desenvolvimento\NpgsqlBuildOficial2.0\src\Npgsql\NpgsqlConnector.cs:line 410
at Npgsql.NpgsqlCommand.ExecuteCommand() in c:\Desenvolvimento\NpgsqlBuildOficial2.0\src\Npgsql\NpgsqlCommand.cs:line 1479
at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior cb) in c:\Desenvolvimento\NpgsqlBuildOficial2.0\src\Npgsql\NpgsqlCommand.cs:line 633
at Npgsql.NpgsqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior cb) in c:\Desenvolvimento\NpgsqlBuildOficial2.0\src\Npgsql\NpgsqlCommand.cs:line 601
at System.Data.Common.DbDataAdapter.UpdateRowExecute(RowUpdatedEventArgs rowUpdatedEvent, IDbCommand dataCommand, StatementType cmdIndex)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)

Connection Timeout and Invalid Startup Packet [ reply ]
By: Stephen l on 2006-11-17 15:13
[forum:1001932]
Hi,

I'm using Npgsql 1.0 with Postgresql 8.1 on Windows 2003 running .NET 1.1.

Every hour or so depending on load, I get exception "Connection establishment timeout. Increase Timeout value in ConnectionString". The higher the load, the more timeouts I get. My connection string looks like this:

SERVER=<IP>;PORT=5432;DATABASE=<DB>;USER ID=<user>;TIMEOUT=15;MINPOOLSIZE=1;MAXPOOLSIZE=20;PROTOCOL=3;CONNECTIONLIFETIME=60;ENCODING=UNICODE;

Everytime this happens, I see "LOG: incomplete startup packet" in Postgresql at the precise time when the exception happened. The DB has plenty of empty connection slots available.

The database sits on the same machine as the web application. The problem occurs when connecting to my other database servers on the network as well. The CPU, Memory and disk space & IO are perfectly in good health.

A search on Postgresql list, seem to point to a bad client software. I didn't file a bug report yet because the BeginConnect() and WaitOne code in NpgsqlClosedState seem straightforward.

I've tried disabling pooling, increase timeout (started from 1 sec to 20 secs), and the problem is still there. At lower timeout numbers, I get more timeout problems of course.

Please help!


Reuse NpgsqlConnection object after close? [ reply ]
By: Alexander Golikov on 2006-12-19 08:01
[forum:1002034]
Hi. I have read on this forum, that Close method is implemented by calling Dispose. So, I wandering - can I safely reuse NpgsqlConnection object after calling close method on it? Since after calling Dispose, my object existence depend on references to him and GC work. Also, may be you freed some other resources (like unmanaged ) in Dispose?

Like this:

NpgsqlConnection conn = new NpgsqlConnection("Server=127.0.0.1;Port=5432;User Id=joe;Password=secret;Database=joedata;");
conn.Open();
/*Some work to do...*/
conn.Close();
conn.ConnectionString = "new con string here";
conn.Open();
.........

P.s. in UserManual.htm in "Synchronous notifications" section, "Syncnotification=true" not present in connection string, and not mentioned at all.

Newer Messages  Older Messages
Powered By FusionForge