Author: danmorg
Date: 2005-04-25 23:33:37 -0400 (Mon, 25 Apr 2005)
New Revision: 43572
Added:
trunk/sqlsharpgtk/browser/MetaProcedure.cs
trunk/sqlsharpgtk/browser/MetaProcedureCollection.cs
trunk/sqlsharpgtk/browser/MetaView.cs
trunk/sqlsharpgtk/browser/MetaViewCollection.cs
trunk/sqlsharpgtk/browser/SqliteMetaData.cs
Modified:
trunk/sqlsharpgtk/ChangeLog
trunk/sqlsharpgtk/sqlsharpgtk/sqlsharpgtk.cs
Log:
2005-04-26 Daniel Morgan <[EMAIL PROTECTED]>
* browser/MetaView.cs
* browser/MetaViewCollection.cs: add files for
meta data for views
* browser/MetaProcedure.cs
* browser/MetaProcedureCollection.cs: meta data
for stored procedures
* browser/SqliteMetaData.cs: meta data for Sqlite
* sqlsharpgtk/sqlsharpgtk.cs: when logging error
messages to console
Modified: trunk/sqlsharpgtk/ChangeLog
===================================================================
--- trunk/sqlsharpgtk/ChangeLog 2005-04-26 02:24:01 UTC (rev 43571)
+++ trunk/sqlsharpgtk/ChangeLog 2005-04-26 03:33:37 UTC (rev 43572)
@@ -1,3 +1,19 @@
+2005-04-26 Daniel Morgan <[EMAIL PROTECTED]>
+
+ * browser/MetaView.cs
+ * browser/MetaViewCollection.cs: add files for
+ meta data for views
+
+ * browser/MetaProcedure.cs
+ * browser/MetaProcedureCollection.cs: meta data
+ for stored procedures
+
+ * browser/SqliteMetaData.cs: meta data for Sqlite
+
+ * sqlsharpgtk/sqlsharpgtk.cs: when logging error
+ messages to console
+
+
2005-04-10 Daniel Morgan <[EMAIL PROTECTED]>
* browser/SqlMetaData.cs: add meta data for Views and Stored Procedures
and
Added: trunk/sqlsharpgtk/browser/MetaProcedure.cs
===================================================================
--- trunk/sqlsharpgtk/browser/MetaProcedure.cs 2005-04-26 02:24:01 UTC (rev
43571)
+++ trunk/sqlsharpgtk/browser/MetaProcedure.cs 2005-04-26 03:33:37 UTC (rev
43572)
@@ -0,0 +1,80 @@
+// MetaProcedure.cs
+//
+// Author:
+// Daniel Morgan <[EMAIL PROTECTED]>
+//
+// (C)Copyright 2005 by Daniel Morgan
+//
+// To be included with Mono as a SQL query tool licensed under the LGPL
license.
+//
+
+using System;
+using System.Data;
+using System.Text;
+
+namespace Mono.Data.SqlSharp.DatabaseBrowser
+{
+ public class MetaProcedure
+ {
+ private string name = "";
+ private string owner = "";
+ private string procedureType = "";
+ // created date
+
+ public MetaProcedure()
+ {
+ }
+
+ public MetaProcedure(string procOwner, string procName, string
procType)
+ {
+ this.owner = procOwner;
+ this.name = procName;
+ this.procedureType = procType;
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Owner
+ {
+ get {
+ return owner;
+ }
+
+ set {
+ owner = value;
+ }
+ }
+
+ public string ProcedureType
+ {
+ get {
+ return procedureType;
+ }
+
+ set {
+ procedureType = value;
+ }
+ }
+
+ public override string ToString()
+ {
+ if(owner != null)
+ if(owner.Equals("") == false)
+ return owner + "." + name;
+
+ return name;
+ }
+ }
+}
+
Property changes on: trunk/sqlsharpgtk/browser/MetaProcedure.cs
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/sqlsharpgtk/browser/MetaProcedureCollection.cs
===================================================================
--- trunk/sqlsharpgtk/browser/MetaProcedureCollection.cs 2005-04-26
02:24:01 UTC (rev 43571)
+++ trunk/sqlsharpgtk/browser/MetaProcedureCollection.cs 2005-04-26
03:33:37 UTC (rev 43572)
@@ -0,0 +1,165 @@
+// MetaProcedureCollection.cs
+//
+// Author:
+// Daniel Morgan <[EMAIL PROTECTED]>
+//
+// (C)Copyright 2005 by Daniel Morgan
+//
+// To be included with Mono as a SQL query tool licensed under the LGPL
license.
+//
+
+using System;
+using System.Data;
+using System.Collections;
+
+namespace Mono.Data.SqlSharp.DatabaseBrowser
+{
+ public class MetaProcedureCollection : MarshalByRefObject, IList,
ICollection, IEnumerable
+ {
+ #region Fields
+
+ private ArrayList list = new ArrayList ();
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public MetaProcedureCollection ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public MetaProcedure this[int index]
+ {
+ get
+ {
+ return (MetaProcedure) list[index];
+ }
+ }
+
+ public MetaProcedure this[string name]
+ {
+ get
+ {
+ MetaProcedure p = null;
+ foreach(object o in list)
+ {
+ p = (MetaProcedure) o;
+ if(p.Name.Equals(name))
+ {
+ return p;
+ }
+ }
+ throw new Exception("MetaProcedure not found");
+ }
+ }
+
+ object IList.this[int index]
+ {
+ get
+ {
+ return list[index];
+ }
+
+ set
+ {
+ list[index] = value;
+ }
+ }
+
+ public int Count
+ {
+ get
+ {
+ return list.Count;
+ }
+ }
+
+ public bool IsFixedSize
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ throw new InvalidOperationException ();
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (object o)
+ {
+ return list.Add ((MetaProcedure) o);
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+
+ public bool Contains (object o)
+ {
+ return list.Contains ((MetaProcedure) o);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ public int IndexOf (object o)
+ {
+ return list.IndexOf ((MetaProcedure) o);
+ }
+
+ public void Insert (int index, object o)
+ {
+ list.Insert (index, (MetaProcedure) o);
+ }
+
+ public void Remove (object o)
+ {
+ list.Remove ((MetaProcedure) o);
+ }
+
+ public void RemoveAt (int index)
+ {
+ list.RemoveAt (index);
+ }
+
+ #endregion // Methods
+
+ }
+}
Property changes on: trunk/sqlsharpgtk/browser/MetaProcedureCollection.cs
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/sqlsharpgtk/browser/MetaView.cs
===================================================================
--- trunk/sqlsharpgtk/browser/MetaView.cs 2005-04-26 02:24:01 UTC (rev
43571)
+++ trunk/sqlsharpgtk/browser/MetaView.cs 2005-04-26 03:33:37 UTC (rev
43572)
@@ -0,0 +1,82 @@
+// MetaView.cs
+//
+// Author:
+// Daniel Morgan <[EMAIL PROTECTED]>
+//
+// (C)Copyright 2005 by Daniel Morgan
+//
+// To be included with Mono as a SQL query tool licensed under the LGPL
license.
+//
+
+using System;
+using System.Data;
+
+namespace Mono.Data.SqlSharp.DatabaseBrowser
+{
+ public class MetaView
+ {
+ private string name = "";
+ private string owner = "";
+ private string sql = "";
+
+ public MetaView()
+ {
+ }
+
+ public MetaView(string tableName)
+ {
+ this.name = tableName;
+ }
+
+ public MetaView(string tableOwner, string tableName)
+ {
+ this.owner = tableOwner;
+ this.name = tableName;
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string Owner
+ {
+ get
+ {
+ return owner;
+ }
+
+ set
+ {
+ owner = value;
+ }
+ }
+
+ public string SQL {
+ get {
+ return sql;
+ }
+ set {
+ sql = value;
+ }
+ }
+
+ public override string ToString()
+ {
+ if(owner != null)
+ if(owner.Equals("") == false)
+ return owner + "." + name;
+
+ return name;
+ }
+ }
+}
+
Property changes on: trunk/sqlsharpgtk/browser/MetaView.cs
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/sqlsharpgtk/browser/MetaViewCollection.cs
===================================================================
--- trunk/sqlsharpgtk/browser/MetaViewCollection.cs 2005-04-26 02:24:01 UTC
(rev 43571)
+++ trunk/sqlsharpgtk/browser/MetaViewCollection.cs 2005-04-26 03:33:37 UTC
(rev 43572)
@@ -0,0 +1,165 @@
+// MetaViewCollection.cs
+//
+// Author:
+// Daniel Morgan <[EMAIL PROTECTED]>
+//
+// (C)Copyright 2005 by Daniel Morgan
+//
+// To be included with Mono as a SQL query tool licensed under the LGPL
license.
+//
+
+using System;
+using System.Data;
+using System.Collections;
+
+namespace Mono.Data.SqlSharp.DatabaseBrowser
+{
+ public class MetaViewCollection : MarshalByRefObject, IList,
ICollection, IEnumerable
+ {
+ #region Fields
+
+ private ArrayList list = new ArrayList ();
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public MetaViewCollection ()
+ {
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public MetaView this[int index]
+ {
+ get
+ {
+ return (MetaView) list[index];
+ }
+ }
+
+ public MetaView this[string name]
+ {
+ get
+ {
+ MetaView p = null;
+ foreach(object o in list)
+ {
+ p = (MetaView) o;
+ if(p.Name.Equals(name))
+ {
+ return p;
+ }
+ }
+ throw new Exception("MetaView not found");
+ }
+ }
+
+ object IList.this[int index]
+ {
+ get
+ {
+ return list[index];
+ }
+
+ set
+ {
+ list[index] = value;
+ }
+ }
+
+ public int Count
+ {
+ get
+ {
+ return list.Count;
+ }
+ }
+
+ public bool IsFixedSize
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ throw new InvalidOperationException ();
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public int Add (object o)
+ {
+ return list.Add ((MetaView) o);
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+
+ public bool Contains (object o)
+ {
+ return list.Contains ((MetaView) o);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ list.CopyTo (array, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ public int IndexOf (object o)
+ {
+ return list.IndexOf ((MetaView) o);
+ }
+
+ public void Insert (int index, object o)
+ {
+ list.Insert (index, (MetaView) o);
+ }
+
+ public void Remove (object o)
+ {
+ list.Remove ((MetaView) o);
+ }
+
+ public void RemoveAt (int index)
+ {
+ list.RemoveAt (index);
+ }
+
+ #endregion // Methods
+
+ }
+}
Property changes on: trunk/sqlsharpgtk/browser/MetaViewCollection.cs
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/sqlsharpgtk/browser/SqliteMetaData.cs
===================================================================
--- trunk/sqlsharpgtk/browser/SqliteMetaData.cs 2005-04-26 02:24:01 UTC (rev
43571)
+++ trunk/sqlsharpgtk/browser/SqliteMetaData.cs 2005-04-26 03:33:37 UTC (rev
43572)
@@ -0,0 +1,78 @@
+// SqliteMetaData.cs - meta data for SQL Lite 2.x, 3.x databases
+//
+// Author:
+// Daniel Morgan <[EMAIL PROTECTED]>
+//
+// (C)Copyright 2005 by Daniel Morgan
+//
+// To be included with Mono as a SQL query tool licensed under the LGPL
license.
+//
+
+using System;
+using System.Data;
+
+namespace Mono.Data.SqlSharp.DatabaseBrowser
+{
+ public class SqliteMetaData : IMetaData
+ {
+ IDbConnection con;
+
+ public SqliteMetaData()
+ {
+ }
+
+ public SqliteMetaData(IDbConnection connection)
+ {
+ con = connection;
+ }
+
+ public MetaTableCollection GetTables(bool includeSystemTables)
+ {
+ if(con.State != ConnectionState.Open)
+ con.Open();
+
+ MetaTableCollection tables = new MetaTableCollection ();
+
+ string sql =
+ "SELECT name " +
+ "FROM sqlite_master " +
+ "WHERE type = 'table' " +
+ "ORDER BY name";
+
+ IDbCommand cmd = con.CreateCommand();
+ cmd.CommandText = sql;
+
+ IDataReader reader = cmd.ExecuteReader();
+ while(reader.Read())
+ {
+ MetaTable table = new
MetaTable(reader.GetString(0));
+ tables.Add(table);
+ }
+ reader.Close();
+ reader = null;
+
+ return tables;
+ }
+
+ public MetaViewCollection GetViews (bool includeSystem)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public MetaTableColumnCollection GetTableColumns(string owner,
string tableName)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ public MetaProcedureCollection GetProcedures(string owner)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public string GetSource (string objectName, string objectType)
+ {
+ return "";
+ }
+ }
+}
Property changes on: trunk/sqlsharpgtk/browser/SqliteMetaData.cs
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/sqlsharpgtk/sqlsharpgtk/sqlsharpgtk.cs
===================================================================
--- trunk/sqlsharpgtk/sqlsharpgtk/sqlsharpgtk.cs 2005-04-26 02:24:01 UTC
(rev 43571)
+++ trunk/sqlsharpgtk/sqlsharpgtk/sqlsharpgtk.cs 2005-04-26 03:33:37 UTC
(rev 43572)
@@ -227,7 +227,7 @@
void OnGridPopupMenu_SaveAs (object o, EventArgs args)
{
- Console.WriteLine("TODO: create dialog to allow you
save as to a xml file, csv file, etc");
+ Console.Error.WriteLine("TODO: create dialog to allow
you save as to a xml file, csv file, etc");
}
void OnGridPopupMenu_Copy (object o, EventArgs args)
@@ -367,7 +367,7 @@
void OnTreePopupMenu_Refresh (object o, EventArgs args)
{
// TODO: refresh the tree at this node and children
- Console.WriteLine("TODO: Refresh clicked!");
+ Console.Error.WriteLine("TODO: Refresh clicked!");
}
void OnTreePopupMenu_View (object o, EventArgs args)
@@ -1893,7 +1893,7 @@
// OutputData() - used for outputting data
// if an output filename is set, then the data will
- // go to a file; otherwise, it will go to the Console.
+ // go to a file; otherwise, it will go to the Console.Error
public void OutputData (string line)
{
AppendTextWithoutScroll (line);
@@ -1901,8 +1901,8 @@
public void Error (string message)
{
- Console.WriteLine (message);
- Console.Out.Flush ();
+ Console.Error.WriteLine (message);
+ Console.Errpr.Flush ();
SetStatusBarText (message);
AppendText (message);
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches