function cleardata() does not exist

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
elid
Posts: 5
Joined: Sun 24 Jan 2010 17:09

function cleardata() does not exist

Post by elid » Sun 24 Jan 2010 17:23

I got a exception when calling to m_dataServices.ClearDB(); the exception is that there is no such stored procedure.




Enclosed more information about this exception:

{Devart.Data.PostgreSql.PgSqlException: function cleardata() does not exist
at Devart.Data.PostgreSql.r.c(ad A_0)
at Devart.Data.PostgreSql.ad.ad()
at Devart.Data.PostgreSql.PgSqlCommand.InternalPrepare(Boolean implicitPrepare, Int32 startRecord, Int32 maxRecords)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
at Nova.Common.DBHelper.DevArtPgCommand.ExecuteDbDataReader(CommandBehavior behavior) in D:\Nova\Common\Sources\DBHelper\DevArtPgDBHelper\DevArtPgCommand.cs:line 56}




The source code and sequence:

1
public void ClearDB()
{
using (IDBSession session = m_dbHelper.OpenSession())
{
using (IDbCommand command = m_dbHelper.CreateCommand("ClearData", CommandType.StoredProcedure, session))
{
try
{
command.ExecuteNonQuery();

session.Commit();
}
catch (Exception ex)
{
session.Rollback();

throw ErrorManager.Instance.ProcessError(
new DataStorageError(DataStorageErrorCode.SaveError, "RreportsDataServices", "ClearDB", ex));
}
}
}
}

2


public override int ExecuteNonQuery()
{
try
{
return base.ExecuteNonQuery();
}
catch (PgSqlException ex)
{
throw ErrorManager.Instance.ProcessError(new DevArtPgError(DevArtPgErrorErrorCode.CommandFailed, Connection.Database, ex));
}
}


3

Calls as result of base.ExecuteNonQuery();

protected override System.Data.Common.DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
{
try
{
return base.ExecuteDbDataReader(behavior);
}
catch (PgSqlException ex)
{
throw ErrorManager.Instance.ProcessError(new DevArtPgError(DevArtPgErrorErrorCode.CommandFailed, Connection.Database, ex));
}
}



I don’t understand this exception, everything looks right. There is a connection to the Database, a valid session was opened, a command was built and the stored procedure is exists in the DB (no parameters required).



Questions:
1 - I found this exact problem in the dev art forum, but it was in 2006 and told that they already fixed that.

http://www.devart.com/forums/viewtopic. ... tion+exist

are you sure?

2 - another reason for this error was a schema name that should added to a procedure name in case the scemais not public

http://www.devart.com/forums/viewtopic. ... tion+exist


The error message tells that procedure can not be found. You need to check the following issues:
- Did you create the procedure in the default scheme(public)?
If no then you should use the procedure name like "SchemaName.ProcedureName" in PgSqlCommand.CommandText, or set the Initial Schema parameter in the connection string.


But I looked in the browser tool that I downloaded that the functions (stored procedures) in my postgre DB ans the functions are located under the public area.


Could you help me and tell me what can be wrong?, why I get this exception?
How can I forced the dotConnect to use a case sensitive string for stored procedure name?


thnaks for your help,

Eli

elid
Posts: 5
Joined: Sun 24 Jan 2010 17:09

I added \” \” around the stored procedure name and it worked

Post by elid » Sun 24 Jan 2010 17:50

I added \” \” around the stored procedure name and it worked.


if I called the stored procedure function this way: "ClearData" it was faild,
but when i called it "\” ClearData\”" it works.


According to your reply in 2006, you already fixed it.

http://www.devart.com/forums/viewtopic. ... tion+exist


Eli

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 25 Jan 2010 11:19

This is a designed behaviour. The lower case is a native case for PostgreSQL. If you want to set the stored procedure name in a particular case, please quote it.

Post Reply