Re: Create stored procedure from C#.net - Mailing list pgsql-general

From Brar Piening
Subject Re: Create stored procedure from C#.net
Date
Msg-id 500479C2.2010301@gmx.de
Whole thread Raw
In response to Create stored procedure from C#.net  (postgresuser <ehsan.hafeez@gmail.com>)
Responses Re: Create stored procedure from C#.net
List pgsql-general
postgresuser wrote:
> I am using PostgreSql 8.3 version. I want to create stored procedure from
> C#.net. Is it possible? Any idea.

You probably don't mean something like:

using Npgsql;
...
using (NpgsqlConnection connection = new
NpgsqlConnection("Server=127.0.0.1;Database=postgres;Integrated
Security=true;"))
{
     string createFunctionCommand = @"
CREATE OR REPLACE FUNCTION my_cool_function() RETURNS integer AS
$BODY$
select 42;
$BODY$
LANGUAGE sql IMMUTABLE;
";
     NpgsqlCommand command = new NpgsqlCommand(createFunctionCommand,
connection);
     connection.Open();
     command.ExecuteNonQuery();
     connection.Close();
}

Something like PL/C# to write functions in C# doesn't exist.

Regards,

Brar



pgsql-general by date:

Previous
From: Philip Couling
Date:
Subject: Re: How do write schema independent install files for functions.
Next
From: Chris Bartlett
Date:
Subject: Re: Can't figure out how to use now() in default for tsrange column (PG 9.2)