[Monodevelop-patches-list] r2742 - in trunk/MonoDevelop/Extras/MonoQuery: . Mono.Data.Sql Mono.Data.Sql/Providers Mono.Data.Sql/Schema MonoQuery MonoQuery/Gui/NodeBuilders
Christian Hergert <chris@mosaix.net>
chergert at mono-cvs.ximian.com
Sun Aug 14 00:21:06 EDT 2005
Author: chergert
Date: 2005-08-14 00:21:05 -0400 (Sun, 14 Aug 2005)
New Revision: 2742
Modified:
trunk/MonoDevelop/Extras/MonoQuery/ChangeLog
trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql.mds
trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Makefile.am
trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Providers/NpgsqlDbProvider.cs
trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Schema/ForeignKeyConstraintSchema.cs
trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Schema/UniqueConstraintSchema.cs
trunk/MonoDevelop/Extras/MonoQuery/MonoQuery/Gui/NodeBuilders/ConstraintNodeBuilder.cs
trunk/MonoDevelop/Extras/MonoQuery/MonoQuery/MonoQuery.addin.xml
Log:
* Mono.Data.Sql.mds: Updated
* Mono.Data.Sql/Schema/ForeignKeyConstraintSchema.cs: Add setter for
reference table name.
* Mono.Data.Sql/Schema/UniqueConstraintSchema.cs: Add default Constructor.
* Mono.Data.Sql/Makefile.am: Updated to build when files change.
* Mono.Data.Sql/Providers/NpgsqlDbProvider.cs: Add some more guts to the
Constraint builders for tables.
* MonoQuery/Gui/NodeBuilders/ConstraintNodeBuilder.cs: Add a handler
* MonoQuery/MonoQuery.addin.xml: Load mono.data.sql.
Modified: trunk/MonoDevelop/Extras/MonoQuery/ChangeLog
===================================================================
--- trunk/MonoDevelop/Extras/MonoQuery/ChangeLog 2005-08-14 00:05:21 UTC (rev 2741)
+++ trunk/MonoDevelop/Extras/MonoQuery/ChangeLog 2005-08-14 04:21:05 UTC (rev 2742)
@@ -1,5 +1,17 @@
2005-08-06 Christian Hergert <christian.hergert at gmail.com>
+ * Mono.Data.Sql.mds: Updated
+ * Mono.Data.Sql/Schema/ForeignKeyConstraintSchema.cs: Add setter for
+ reference table name.
+ * Mono.Data.Sql/Schema/UniqueConstraintSchema.cs: Add default Constructor.
+ * Mono.Data.Sql/Makefile.am: Updated to build when files change.
+ * Mono.Data.Sql/Providers/NpgsqlDbProvider.cs: Add some more guts to the
+ Constraint builders for tables.
+ * MonoQuery/Gui/NodeBuilders/ConstraintNodeBuilder.cs: Add a handler
+ * MonoQuery/MonoQuery.addin.xml: Load mono.data.sql.
+
+2005-08-06 Christian Hergert <christian.hergert at gmail.com>
+
* tests/Mono.Data.Sql.Tests.mdp: Updated
* Mono.Data.Sql/Schema/AbstractSchema.cs: Add Options hashtable for
generic extra options above and beyond the hardcoded properties.
Modified: trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Makefile.am
===================================================================
--- trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Makefile.am 2005-08-14 00:05:21 UTC (rev 2741)
+++ trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Makefile.am 2005-08-14 04:21:05 UTC (rev 2742)
@@ -47,7 +47,7 @@
all: $(DLL)
-$(DLL):
+$(DLL): $(FILES)
mkdir -p $(ADDIN_BUILD)
$(CSC) $(SCS_FLAGS) -target:library -out:$@ $(build_sources) $(REFS)
Modified: trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Providers/NpgsqlDbProvider.cs
===================================================================
--- trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Providers/NpgsqlDbProvider.cs 2005-08-14 00:05:21 UTC (rev 2741)
+++ trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Providers/NpgsqlDbProvider.cs 2005-08-14 04:21:05 UTC (rev 2742)
@@ -483,10 +483,22 @@
while (r.Read ()) {
ConstraintSchema constraint = null;
+
+ // XXX: Add support for Check constraints.
switch (r.GetString(2)) {
+ case "f":
+ string match = @".*REFERENCES (.+)\(.*\).*";
+ constraint = new ForeignKeyConstraintSchema ();
+ if (Regex.IsMatch (r.GetString (1), match))
+ (constraint as ForeignKeyConstraintSchema).ReferenceTableName
+ = Regex.Match (r.GetString (1), match).Groups[0].Captures[0].Value;
+ break;
+ case "u":
+ constraint = new UniqueConstraintSchema ();
+ break;
case "p":
default:
- constraint = new PrimaryKeyConstraintSchema();
+ constraint = new PrimaryKeyConstraintSchema ();
break;
}
@@ -605,6 +617,8 @@
ArrayList collection = new ArrayList ();
// FIXME: Won't work properly with overload functions.
+ // Maybe check the number of columns in the parameters for
+ // proper match.
NpgsqlCommand command = new NpgsqlCommand ();
command.Connection = connection;
command.CommandText = String.Format (
Modified: trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Schema/ForeignKeyConstraintSchema.cs
===================================================================
--- trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Schema/ForeignKeyConstraintSchema.cs 2005-08-14 00:05:21 UTC (rev 2741)
+++ trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Schema/ForeignKeyConstraintSchema.cs 2005-08-14 04:21:05 UTC (rev 2742)
@@ -44,6 +44,12 @@
}
}
+ public string ReferenceTableName {
+ set {
+ referenceTable = value;
+ }
+ }
+
public ColumnSchema[] ReferenceColumns {
get {
return (ColumnSchema[]) null;
Modified: trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Schema/UniqueConstraintSchema.cs
===================================================================
--- trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Schema/UniqueConstraintSchema.cs 2005-08-14 00:05:21 UTC (rev 2741)
+++ trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql/Schema/UniqueConstraintSchema.cs 2005-08-14 04:21:05 UTC (rev 2742)
@@ -32,5 +32,8 @@
{
public class UniqueConstraintSchema : ConstraintSchema
{
+ public UniqueConstraintSchema ()
+ {
+ }
}
}
\ No newline at end of file
Modified: trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql.mds
===================================================================
--- trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql.mds 2005-08-14 00:05:21 UTC (rev 2741)
+++ trunk/MonoDevelop/Extras/MonoQuery/Mono.Data.Sql.mds 2005-08-14 04:21:05 UTC (rev 2742)
@@ -1,4 +1,4 @@
-<Combine name="Mono.Data.Sql" fileversion="2.0">
+<Combine name="MonoQuery" fileversion="2.0">
<Configurations active="Debug">
<Configuration name="Debug" ctype="CombineConfiguration">
<Entry configuration="Debug" build="False" name="Mono.Data.Sql" />
Modified: trunk/MonoDevelop/Extras/MonoQuery/MonoQuery/Gui/NodeBuilders/ConstraintNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Extras/MonoQuery/MonoQuery/Gui/NodeBuilders/ConstraintNodeBuilder.cs 2005-08-14 00:05:21 UTC (rev 2741)
+++ trunk/MonoDevelop/Extras/MonoQuery/MonoQuery/Gui/NodeBuilders/ConstraintNodeBuilder.cs 2005-08-14 04:21:05 UTC (rev 2742)
@@ -29,6 +29,8 @@
using System;
using Mono.Data.Sql;
+
+using MonoDevelop.Core.Services;
using MonoDevelop.Services;
using MonoDevelop.Gui.Pads;
@@ -46,6 +48,12 @@
}
}
+ public override Type CommandHandlerType {
+ get {
+ return typeof (ConstraintNodeCommandHandler);
+ }
+ }
+
public override string GetNodeName (ITreeNavigator thisNode, object dataObject)
{
return GettextCatalog.GetString ("Constraint");
@@ -78,4 +86,21 @@
return false;
}
}
+
+ public class ConstraintNodeCommandHandler : NodeCommandHandler
+ {
+ public override DragOperation CanDragNode ()
+ {
+ return DragOperation.None;
+ }
+
+ public override void OnItemSelected ()
+ {
+ ConstraintSchema schema = CurrentNode.DataItem as ConstraintSchema;
+ MonoQueryService service = (MonoQueryService) ServiceManager.GetService (typeof (MonoQueryService));
+
+ if (service.SqlDefinitionPad != null)
+ service.SqlDefinitionPad.SetText(schema.Definition);
+ }
+ }
}
\ No newline at end of file
Modified: trunk/MonoDevelop/Extras/MonoQuery/MonoQuery/MonoQuery.addin.xml
===================================================================
--- trunk/MonoDevelop/Extras/MonoQuery/MonoQuery/MonoQuery.addin.xml 2005-08-14 00:05:21 UTC (rev 2741)
+++ trunk/MonoDevelop/Extras/MonoQuery/MonoQuery/MonoQuery.addin.xml 2005-08-14 04:21:05 UTC (rev 2742)
@@ -7,6 +7,7 @@
version = "0.2.0">
<Runtime>
+ <Import assembly="Mono.Data.Sql.dll"/>
<Import assembly="MonoQuery.dll"/>
</Runtime>
More information about the Monodevelop-patches-list
mailing list