DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
RoutineInfo.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;
22 
23 namespace Deveel.Data.Routines {
28  public abstract class RoutineInfo : IObjectInfo {
33  protected RoutineInfo(ObjectName routineName)
34  : this(routineName, new RoutineParameter[] {}) {
35  }
36 
42  protected RoutineInfo(ObjectName routineName, RoutineParameter[] parameters) {
43  if (routineName == null)
44  throw new ArgumentNullException("routineName");
45 
46  if (parameters == null)
47  parameters = new RoutineParameter[0];
48 
49  RoutineName = routineName;
50  Parameters = parameters;
51  // TODO: Body = new RoutineBody(this);
52  }
53 
55  get { return DbObjectType.Routine; }
56  }
57 
59  get { return RoutineName; }
60  }
61 
65  public ObjectName RoutineName { get; private set; }
66 
67  public abstract RoutineType RoutineType { get; }
68 
72  public RoutineParameter[] Parameters { get; private set; }
73 
74  public string ExternalMethodName { get; set; }
75 
76  public Type ExternalType { get; set; }
77 
78  // TODO: public RoutineBody Body { get; private set; }
79 
80  internal abstract bool MatchesInvoke(Invoke request, IQuery query);
81 
82  public override string ToString() {
83  var sb = new StringBuilder();
84  sb.Append(RoutineName);
85  if (Parameters != null && Parameters.Length > 0) {
86  sb.Append('(');
87  for (int i = 0; i < Parameters.Length; i++) {
88  sb.Append(Parameters[i]);
89 
90  if (i < Parameters.Length - 1)
91  sb.Append(", ");
92  }
93  sb.Append(')');
94  }
95  return sb.ToString();
96  }
97  }
98 }
Describes the name of an object within a database.
Definition: ObjectName.cs:44
A user-defined TYPE that holds complex objects in a database column.
RoutineType
The type of routine program.
Definition: RoutineType.cs:23
The information about the invocation of a routine, including the full name and arguments (as SqlExpre...
Definition: Invoke.cs:30
RoutineInfo(ObjectName routineName, RoutineParameter[] parameters)
Constructs the routine info with the given signature.
Definition: RoutineInfo.cs:42
Defines the metadata for a routine that are used to resolve within a context.
Definition: RoutineInfo.cs:28
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
RoutineInfo(ObjectName routineName)
Constructs a routine info with the given name.
Definition: RoutineInfo.cs:33