DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
RoutineNotFouncException.cs
Go to the documentation of this file.
1 //
2 // Copyright 2010-2015 Deveel
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 using System;
18 using System.Text;
19 
20 using Deveel.Data;
21 using Deveel.Data.Sql;
23 
24 namespace Deveel.Data.Routines {
27  : this(routineName, new SqlExpression[0]) {
28  }
29 
30  public RoutineNotFouncException(string message)
31  : this(null, message) {
32  }
33 
34  public RoutineNotFouncException(ObjectName routineName, string message)
35  : this(routineName, new SqlExpression[0], message) {
36  }
37 
39  : this(routineName, args, FormMessage(routineName, args)) {
40  }
41 
42  public RoutineNotFouncException(ObjectName routineName, SqlExpression[] args, string message)
43  : base(routineName, message) {
44  Arguments = args;
45  }
46 
47  public SqlExpression[] Arguments { get; private set; }
48 
49  private static string FormMessage(ObjectName name, SqlExpression[] args) {
50  var sb = new StringBuilder(name.FullName);
51  sb.Append("(");
52  if (args != null) {
53  for (int i = 0; i < args.Length; i++) {
54  sb.Append(args[i]);
55 
56  if (i < args.Length - 1)
57  sb.Append(", ");
58  }
59  }
60  sb.Append(")");
61 
62  return String.Format("Unable to resolve {0} to any routine within the system.", sb);
63  }
64  }
65 }
RoutineNotFouncException(ObjectName routineName, SqlExpression[] args)
Describes the name of an object within a database.
Definition: ObjectName.cs:44
RoutineNotFouncException(ObjectName routineName, string message)
RoutineNotFouncException(ObjectName routineName, SqlExpression[] args, string message)
string FullName
Gets the full reference name formatted.
Definition: ObjectName.cs:114
static string FormMessage(ObjectName name, SqlExpression[] args)
Defines the base class for instances that represent SQL expression tree nodes.