Forum: help

Monitor Forum | Start New Thread Start New Thread
Badly formed XML comments in npgsql.xml [ reply ]
By: Andrus Moor on 2007-11-11 20:08
npgsql.xml contains a lot of messages like

<!-- Badly formed XML comment ignored for member "P:Npgsql.NpgsqlConnection.ConnectionString" -->

<!-- Badly formed XML comment ignored for member "M:Npgsql.NpgsqlConnection.GetSchema" -->

Login as Administrator [ reply ]
By: Vital Logic on 2007-12-08 07:02
I want to create database from my application, using npgsql. However the connection string explicitly needs a database to be passed as paramenter. How can I solve this?

Similar is the case with creating users from the application.

Npgsql sunc notifications.How? [ reply ]
By: Dmitry Nizinkin on 2007-10-29 08:52
Hi, I have Win xp sp2,Postgresql 8.2.0,npgsql 1.0 data provider.
I need recieve notify from Postgresql server when row add in table on server.I write trigger on insert.In body this trigger write: notify MyApp.
In my application do:
npgsqlconnection+=new EventHandler(func);
It's work, but async. My app recieve message when i send next command on server.How my application can recieve message immediately.Pls help me.

search for string with back slash [ reply ]
By: Sean Zeng on 2007-12-03 18:05

I met a weird problem when save a string with back slash then search for it.

1. I wrote two PG stored procedures, one to insert a string, one to retrieve it.

a. FUNCTION proc_add_value(i_value text) as:

b. FUNCTION proc_find_value(i_value text) as:

2. In C#, call the stored procedures through npgsql:

a. call proc_add_value with string parameter of @"HKLM\Software\test"
I can see the record is added correctly in pgadmin.

b. call proc_find_value with string parameter of @"HKLM\Software"

No record is returned.

c. call proc_find_value with string parameter of @"HKLM\\Software" (noted that there are two back slashes in the string)

The record of "HKLM\Software\test" is returned.


In summary, I inserted @"HKLM\Software\test" but need to pass in @"HKLM\\Software" (double back slash) to find it. It seems strange to me.

Do I miss anything?


A few questions about Npgsql2 [ reply ]
By: Tao Wang on 2007-11-28 16:43
1. I think "CLASSNAME" in each class is not necessary, we can use "this.GetType().Name" instead. Am I missing anything here?

2. The Mono.Security reference is used for SSL connection. But .Net Framework 2.0 already implement SslStream, is that possible to eliminate Mono.Security dependence by using System.Net.Security.SslStream? And same thing for MD5, maybe using System.Security.Cryptography.MD5 is more natural for .Net 2.0. There are some classes or functions seems could be simplified by taking advantage of .Net 2.0 framework.

3. The recent updated test case for Connection:

public void ConnectionStringWithSemicolonSignValue()

NpgsqlConnection conn = new NpgsqlConnection("Server=;Port=44444;User Id=npgsql_tets;Password='j;'");



I cannot understand the case. Should we throw a Exception here?

If yes, how to write connection string which contains a password which contains a semicolon?

4. Missing 3 methods, 1 property in NpgsqlFactory.
public virtual bool CanCreateDataSourceEnumerator { get; }
public virtual DbConnectionStringBuilder CreateConnectionStringBuilder();
public virtual DbDataSourceEnumerator CreateDataSourceEnumerator();
public virtual CodeAccessPermission CreatePermission(PermissionState state);

They are new in .Net 2.0.

5. Maybe we should implement a class NpgsqlConnectionStringBuilder which inherit from DbConnectionStringBuilder, to replace NpgsqlConnectionString. They are really similar and some functions in NpgsqlConnectionString has done in DbConnectionStringBuilder.

6. May be we should have a look on LINQ, there are some code implement LINQ to SQL for postgresql by using npgsql. :

It's MIT license, is it possible that Npgsql merge the code from the project to make Npgsql support LINQ directly? or a sub-project to do it?

7. Npgsql seems not well support in design mode of Visual Studio. At least not as well as MySQL.Data did. Could that part be improved?


Tao Wang.

Should Npgsql Centralize the resource files? [ reply ]
By: Tao Wang on 2007-11-29 12:50
I think it would be good that if make the resource file centralized. It will much easier for translator and easier to pick an existing string rather than create mew one which actually existing in other resource file.

Npgsql.csproj and Npgsql.sln bugs. [ reply ]
By: Tao Wang on 2007-11-17 17:34
1. Npgsql.csproj missing include for zh-CN resource file.
When I use Visual Studio open Npgsql.csproj. All zh-CN.resx are exclude from the project.

I create a patch for fix:
=================== CUT BEGIN ===================
Index: Npgsql.csproj
--- Npgsql.csproj (revision 4)
+++ Npgsql.csproj (working copy)
@@ -102,9 +102,9 @@
<Compile Include="Npgsql\NpgsqlConnectorPool.cs">
- <Compile Include="Npgsql\NpgsqlCopyFormat.cs">
- <SubType>Code</SubType>
- </Compile>
+ <Compile Include="Npgsql\NpgsqlCopyFormat.cs">
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="Npgsql\NpgsqlCopyIn.cs">
@@ -250,6 +250,10 @@
+ <EmbeddedResource Include="Npgsql\NpgsqlCommand.zh-CN.resx">
+ <DependentUpon>NpgsqlCommand.cs</DependentUpon>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
<EmbeddedResource Include="Npgsql\NpgsqlCommandBuilder.resx">
@@ -278,6 +282,10 @@
+ <EmbeddedResource Include="Npgsql\NpgsqlConnection.zh-CN.resx">
+ <DependentUpon>NpgsqlConnection.cs</DependentUpon>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
<EmbeddedResource Include="Npgsql\NpgsqlConnectionString.resx">
@@ -302,6 +310,10 @@
+ <EmbeddedResource Include="Npgsql\NpgsqlEventLog.zh-CN.resx">
+ <DependentUpon>NpgsqlEventLog.cs</DependentUpon>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
<EmbeddedResource Include="Npgsql\NpgsqlException.resx">
@@ -326,6 +338,10 @@
+ <EmbeddedResource Include="Npgsql\NpgsqlParameter.zh-CN.resx">
+ <DependentUpon>NpgsqlParameter.cs</DependentUpon>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
<EmbeddedResource Include="Npgsql\">
@@ -346,6 +362,10 @@
+ <EmbeddedResource Include="Npgsql\NpgsqlParameterCollection.zh-CN.resx">
+ <DependentUpon>NpgsqlParameterCollection.cs</DependentUpon>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
<EmbeddedResource Include="Npgsql\NpgsqlReadyState.resx">
@@ -374,6 +394,10 @@
+ <EmbeddedResource Include="Npgsql\NpgsqlTransaction.zh-CN.resx">
+ <DependentUpon>NpgsqlTransaction.cs</DependentUpon>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
<EmbeddedResource Include="Npgsql\PGUtil.resx">
=================== CUT END ===================

The patch also include the bug for "Missing reference to NpgsqlCopyFormat.cs" which already fix at Revision 1.5.

2. Cannot open the solution file with Visual Studio 2005.

The file looks alright, but I cannot double click it to open with Visual Studio 2005 (it said unrecognized version). I saved a solution file by VS 2005 to see the difference. I found the significant difference is that the new line of Npgsql2.sln is \n (0xA) rather than \r\n (0xD, 0xA). I think that might be the reason.

Can't find custom attr constructor image [ reply ]
By: sai sai on 2007-11-16 10:30

I am using ubuntu+apache+postgresql to develop I contact the pages,errors occur.

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

In the erro_log:
** (/usr/lib/mono/1.0/mod-mono-server.exe:5555): WARNING **: Missing method .ctor in assembly /tmp/daemon-temp-aspnet-0/51f4ab22/assembly/shadow/a232aa5f/5fd7e261_fde5483e/Npgsql.dll, type System.Runtime.CompilerServices.RuntimeCompatibilityAttribute

** ERROR **: Can't find custom attr constructor image: /tmp/daemon-temp-aspnet-0/51f4ab22/assembly/shadow/a232aa5f/5fd7e261_fde5483e/Npgsql.dll mtoken: 0x0a000156
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.

I cant not decide the errors happen in the mono runtime or Npgsql.dll.

Can any one help me?Thanks.

NpgsqlConnectionString's performance [ reply ]
By: Tao Wang on 2007-11-17 03:17

When I profiling my code, I found one of a bottle-neck of the code is setting NpgsqlConnection.ConnectionString. I used the profiler to dig in, and found it's the regular expression in NpgsqlConnectionString.ParseConnectionString() cost most time.

Could you use RegexOptions.Compiled for the static regular expressions in NpgsqlConnectionString? It may a little faster.

I think it's important to improve ParseConnectionString()'s performance, since for each DbCommand, I need to create a new DbConnection, and assign a parsed connection string.

One possible solution is caching the parsed connection string (NpgsqlConnectionString object). If it's same connection string, then use the existing parsed result, other than parse it again.

It make sense since, in most case, there are only a few connection string to use, but much more times than that to create a new DbConnection and assign the same connection string.


error: [ reply ]
By: Dmitry Nizinkin on 2007-11-19 11:08
hi, i have method
public void WriteRow()
{ string tmpStrWeight = null;
string tmp_command = null;
if (!f_is_connected)//check connection

tmpStrWeight = f_weigth.ToString();
tmpStrWeight = tmpStrWeight.Replace(",", ".");
tmp_command = String.Format("INSERT INTO tobackup.t_app_log(id, board_number,direction_id, time_best, auto_number, weight,IsCorrect ) VALUES ({0},{1},{2},'{3}','{4}',{5},{6});", f_row_id, BoardNumber(f_lpr_id), DirectionId(f_lpr_id),
ft_time_best, f_auto_number, tmpStrWeight, f_is_good_weigth);
f_command.CommandText = tmp_command;
catch (Exception e)
{ WriteToLog(" e.Message + "tmp_command: " + tmp_command , EventLogEntryType.Error);
and got tis error:
Backend sent unrecognized response type: tmp_command: INSERT INTO tobackup.t_app_log(id, board_number, direction_id, time_best, auto_number, weight,IsCorrect ) VALUES (21308,2,1,'2007-11-19 12:49:11.2650000','Y796EO42',7.86,True);
This method executing then pgsql server send to my application async notification.usially method run without error? but rarely i get error.Any Ideas?

NullReferenceException in Npgsql2 [ reply ]
By: Tao Wang on 2007-11-16 02:31
I run the following code:
command.Connection = this.DB.Factory.CreateConnection();
command.Connection.ConnectionString = this.DB.ConnectionString;
reader = command.ExecuteReader();
if (reader.Read())
obj = ParseReader(reader);
obj = null;

And I got NullReferenceException raise when calling command.ExecuteReader(). The command is DbCommand which created by NpgsqlFactory.

And sometime I got another Exception said command.Connection is not open at same position. I checked the State of the connection at the exception point, it is Closed.

Am I missing anything here?

Newer Messages  Older Messages
Powered By FusionForge