This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Import of moma database tool

svn path=/trunk/moma-tool/; revision=107715
  • Loading branch information...
dickp committed Jul 11, 2008
0 parents commit d245d436d7d5253ad1d7dd7c578b630cea62fa87
Showing with 1,059 additions and 0 deletions.
  1. +43 −0 IssueTypeLookups.sql
  2. +26 −0 Makefile
  3. +131 −0 MomaTool.Database/Issue.cs
  4. +82 −0 MomaTool.Database/IssueType.cs
  5. +121 −0 MomaTool.Database/MomaDefinition.cs
  6. +217 −0 MomaTool.Database/Report.cs
  7. +189 −0 dbinsert.cs
  8. +221 −0 ddl.sql
  9. +20 −0 test.cs
  10. +9 −0 test_castle_config.xml
@@ -0,0 +1,43 @@
+INSERT INTO issue_type (
+ lookup_name,
+ display_name,
+ description
+)
+VALUES (
+ 'MISS',
+ 'Missing Method',
+ 'The application relies on a method that is not yet implemented in Mono. The application will not be able to run with this dependency.'
+);
+
+INSERT INTO issue_type (
+ lookup_name,
+ display_name,
+ description
+)
+VALUES (
+ 'NIEX',
+ 'NotImplementedException',
+ 'The application relies on a method which exists, but will throw a NotImplementedException if called. The application may run with this issue; however, the application will likely crash if the code that relies on this method is executed.'
+);
+
+INSERT INTO issue_type (
+ lookup_name,
+ display_name,
+ description
+)
+VALUES (
+ 'PINV',
+ 'P/Invoke',
+ 'The application relies on a non-managed library. If the library has not been ported to the target platform, this application will not be able to run.'
+);
+
+INSERT INTO issue_type (
+ lookup_name,
+ display_name,
+ description
+)
+VALUES (
+ 'TODO',
+ 'Method marked MonoTodo',
+ 'The application relies on a method that has been implemented in Mono, but which has been marked with the [MonoTodo] attribute. This method may exhibit unexpected behavior if the code that relies on this method is executed.'
+);
@@ -0,0 +1,26 @@
+ASS_SRCS=\
+ MomaTool.Database/Issue.cs \
+ MomaTool.Database/IssueType.cs \
+ MomaTool.Database/MomaDefinition.cs \
+ MomaTool.Database/Report.cs
+
+ASS_ASSES=-r:Castle.ActiveRecord.dll -r:NHibernate.dll
+ASS=MomaTool.Database.dll
+
+TEST_SRCS=test.cs
+TEST_ASSES=-r:$(ASS) $(ASS_ASSES)
+TEST=test.exe
+DBINS_SRCS=dbinsert.cs
+DBINS_ASSES=-r:$(ASS) $(ASS_ASSES)
+DBINS=dbinsert.exe
+
+all: $(ASS) $(TEST) $(DBINS)
+
+$(ASS): $(ASS_SRCS)
+ gmcs -out:$(ASS) -target:library $(ASS_SRCS) $(ASS_ASSES)
+
+$(TEST): $(TEST_SRCS) $(ASS)
+ gmcs -out:$(TEST) $(TEST_SRCS) $(TEST_ASSES)
+
+$(DBINS): $(DBINS_SRCS) $(ASS)
+ gmcs -out:$(DBINS) $(DBINS_SRCS) $(DBINS_ASSES)
@@ -0,0 +1,131 @@
+using System;
+using Castle.ActiveRecord;
+using NHibernate.Expression;
+
+namespace MomaTool.Database
+{
+ [ActiveRecord ("issue")]
+ public class Issue : ActiveRecordBase<Issue>
+ {
+ private int id;
+ private string method_return_type;
+ private string method_namespace;
+ private string method_class;
+ private string method_name;
+ private string method_library;
+
+ private Report report;
+ private IssueType issue_type;
+
+ [PrimaryKey (PrimaryKeyType.Sequence, SequenceName="issue_id_seq")]
+ public int Id
+ {
+ get {
+ return id;
+ }
+ set {
+ id = value;
+ }
+ }
+
+ [Property ("method_return_type", Length=200)]
+ public String MethodReturnType
+ {
+ get {
+ return method_return_type;
+ }
+ set {
+ method_return_type = value;
+ }
+ }
+
+ [Property ("method_namespace", Length=200)]
+ public String MethodNamespace
+ {
+ get {
+ return method_namespace;
+ }
+ set {
+ method_namespace = value;
+ }
+ }
+
+ [Property ("method_class", Length=200)]
+ public String MethodClass
+ {
+ get {
+ return method_class;
+ }
+ set {
+ method_class = value;
+ }
+ }
+
+ [Property ("method_name", Length=1000)]
+ public String MethodName
+ {
+ get {
+ return method_name;
+ }
+ set {
+ method_name = value;
+ }
+ }
+
+ [Property ("method_library", Length=500)]
+ public String MethodLibrary
+ {
+ get {
+ return method_library;
+ }
+ set {
+ method_library = value;
+ }
+ }
+
+ [BelongsTo ("report_id", ForeignKey="fk_issue_report", Cascade=CascadeEnum.All, NotNull=true)]
+ public Report Report
+ {
+ get {
+ return report;
+ }
+ set {
+ report = value;
+ }
+ }
+
+ [BelongsTo ("issue_type_id", ForeignKey="fk_issue_issue_type", Cascade=CascadeEnum.All, NotNull=true)]
+ public IssueType IssueType
+ {
+ get {
+ return issue_type;
+ }
+ set {
+ issue_type = value;
+ }
+ }
+
+ /* Accessor functions */
+ public static Issue FindById (int id)
+ {
+ return(FindOne (Expression.Eq ("Id", id)));
+ }
+
+ public static Issue Create (Report report, IssueType type, string return_type, string ns, string class_name, string method_name, string library)
+ {
+ Issue ret = new Issue ();
+
+ ret.Report = report;
+ ret.IssueType = type;
+ ret.MethodReturnType = return_type;
+ ret.MethodNamespace = ns;
+ ret.MethodClass = class_name;
+ ret.MethodName = method_name;
+ ret.MethodLibrary = library;
+
+ ret.Save ();
+
+ return ret;
+ }
+ }
+}
@@ -0,0 +1,82 @@
+using System;
+using Castle.ActiveRecord;
+using NHibernate.Expression;
+
+namespace MomaTool.Database
+{
+ [ActiveRecord ("issue_type")]
+ public class IssueType : ActiveRecordBase<IssueType>
+ {
+ private int id;
+ private string lookup_name;
+ private string display_name;
+ private string description;
+ private bool is_active;
+
+ [PrimaryKey (PrimaryKeyType.Sequence, SequenceName="issue_type_id_seq")]
+ public int Id
+ {
+ get {
+ return id;
+ }
+ set {
+ id = value;
+ }
+ }
+
+ [Property ("lookup_name", NotNull=true, Length=10)]
+ public String LookupName
+ {
+ get {
+ return lookup_name;
+ }
+ set {
+ lookup_name = value;
+ }
+ }
+
+ [Property ("display_name", NotNull=true, Length=100)]
+ public String DisplayName
+ {
+ get {
+ return display_name;
+ }
+ set {
+ display_name = value;
+ }
+ }
+
+ [Property ("description", SqlType="Text", NotNull=true)]
+ public String Description
+ {
+ get {
+ return description;
+ }
+ set {
+ description = value;
+ }
+ }
+
+ [Property ("is_active", NotNull=true)]
+ public bool IsActive
+ {
+ get {
+ return is_active;
+ }
+ set {
+ is_active = value;
+ }
+ }
+
+ /* Accessor functions */
+ public static IssueType FindById (int id)
+ {
+ return(FindOne (Expression.Eq ("Id",id)));
+ }
+
+ public static IssueType FindByLookupName (string name)
+ {
+ return(FindOne (Expression.Eq ("LookupName", name)));
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit d245d43

Please sign in to comment.