* System.Data/UniqueConstraint.cs (UniqueConstraint): commented
unreachable code to avoid compiler warning.
* System.Data.OleDb/libgda.cs (GdaList): added new internal class.
* System.Data.OleDb/OleDbConnection.cs (DataSource): implemented.
(OpenReader): removed internal method.
* System.Data.OleDb/OleDbCommand.cs (ExecuteReader): split correctly
the list of returned data models.
svn path=/trunk/mcs/; revision=6659
+2002-08-15 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data/UniqueConstraint.cs (UniqueConstraint): commented
+ unreachable code to avoid compiler warning.
+
+ * System.Data.OleDb/libgda.cs (GdaList): added new internal class.
+
+ * System.Data.OleDb/OleDbConnection.cs (DataSource): implemented.
+ (OpenReader): removed internal method.
+
+ * System.Data.OleDb/OleDbCommand.cs (ExecuteReader): split correctly
+ the list of returned data models.
+
2002-08-15 Franklin Wise <gracenote@earthlink.net>
* System.Data/Constraint.cs: Added helper virtual functions
2002-08-15 Franklin Wise <gracenote@earthlink.net>
* System.Data/Constraint.cs: Added helper virtual functions
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Data;
using System.Data.Common;
using System.Collections;
+using System.Runtime.InteropServices;
namespace System.Data.OleDb
{
namespace System.Data.OleDb
{
gdaCommand = IntPtr.Zero;
}
gdaCommand = IntPtr.Zero;
}
- public OleDbCommand (string cmdText)
- : this ()
+ public OleDbCommand (string cmdText) : this ()
{
CommandText = cmdText;
}
{
CommandText = cmdText;
}
Connection = connection;
}
Connection = connection;
}
- public OleDbCommand (string cmdText, OleDbConnection connection, OleDbTransaction transaction)
- : this (cmdText, connection)
+ public OleDbCommand (string cmdText,
+ OleDbConnection connection,
+ OleDbTransaction transaction) : this (cmdText, connection)
{
this.transaction = transaction;
}
{
this.transaction = transaction;
}
public OleDbDataReader ExecuteReader (CommandBehavior behavior)
{
ArrayList results = new ArrayList ();
public OleDbDataReader ExecuteReader (CommandBehavior behavior)
{
ArrayList results = new ArrayList ();
+ IntPtr rs_list;
+ GdaList glist_node;
if (connection.State != ConnectionState.Open)
throw new InvalidOperationException ();
if (connection.State != ConnectionState.Open)
throw new InvalidOperationException ();
IntPtr gdaConnection = connection.GdaConnection;
IntPtr gdaParameterList = parameters.GdaParameterList;
IntPtr gdaConnection = connection.GdaConnection;
IntPtr gdaParameterList = parameters.GdaParameterList;
+ /* execute the command */
- /* FIXME: split all returned resultsets into the array
- list of results */
- results.Add (libgda.gda_connection_execute_command (
- gdaConnection,
- gdaCommand,
- gdaParameterList));
-
- dataReader = new OleDbDataReader (this, results);
- dataReader.NextResult ();
+ rs_list = libgda.gda_connection_execute_command (
+ gdaConnection,
+ gdaCommand,
+ gdaParameterList);
+ if (rs_list != IntPtr.Zero) {
+ glist_node = (GdaList) Marshal.PtrToStructure (rs_list, typeof (GdaList));
+
+ while (glist_node != null) {
+ results.Add (glist_node.data);
+ glist_node = (GdaList) Marshal.PtrToStructure (glist_node.next,
+ typeof (GdaList));
+ }
+ dataReader = new OleDbDataReader (this, results);
+ dataReader.NextResult ();
+ }
public string Database {
get {
public string Database {
get {
- if (gdaConnection != IntPtr.Zero && libgda.gda_connection_is_open (gdaConnection)) {
+ if (gdaConnection != IntPtr.Zero
+ && libgda.gda_connection_is_open (gdaConnection)) {
return libgda.gda_connection_get_database (gdaConnection);
}
return libgda.gda_connection_get_database (gdaConnection);
}
}
public string DataSource {
}
public string DataSource {
- throw new NotImplementedException ();
+ if (gdaConnection != IntPtr.Zero
+ && libgda.gda_connection_is_open (gdaConnection)) {
+ return libgda.gda_connection_get_dsn (gdaConnection);
+ }
+
+ return null;
}
}
public string Provider {
get {
}
}
public string Provider {
get {
- if (gdaConnection != IntPtr.Zero && libgda.gda_connection_is_open (gdaConnection)) {
+ if (gdaConnection != IntPtr.Zero
+ && libgda.gda_connection_is_open (gdaConnection)) {
return libgda.gda_connection_get_provider (gdaConnection);
}
return libgda.gda_connection_get_provider (gdaConnection);
}
public OleDbCommand CreateCommand ()
{
public OleDbCommand CreateCommand ()
{
- if (gdaConnection != IntPtr.Zero && libgda.gda_connection_is_open (gdaConnection))
+ if (gdaConnection != IntPtr.Zero
+ && libgda.gda_connection_is_open (gdaConnection))
return new OleDbCommand (null, this);
return null;
return new OleDbCommand (null, this);
return null;
throw new NotImplementedException ();
}
throw new NotImplementedException ();
}
- #endregion
-
- #region Internal Methods
-
- // Used to prevent OleDbConnection
- // from doing anything while
- // OleDbDataReader is open.
- // Open the Reader. (called from OleDbCommand)
- internal void OpenReader (OleDbDataReader reader)
- {
- if(dataReaderOpen == true) {
- // TODO: throw exception here?
- // because a reader
- // is already open
- }
- else {
- dataReader = reader;
- dataReaderOpen = true;
- }
- }
-
-
#endregion
#region Events and Delegates
#endregion
#region Events and Delegates
private ArrayList gdaResults;
private int currentResult;
private int currentRow;
private ArrayList gdaResults;
private int currentResult;
private int currentRow;
gdaResults = new ArrayList ();
currentResult = -1;
currentRow = -1;
gdaResults = new ArrayList ();
currentResult = -1;
currentRow = -1;
public bool IsClosed {
get {
public bool IsClosed {
get {
}
}
public object this[string name] {
[MonoTODO]
}
}
public object this[string name] {
[MonoTODO]
- get { throw new NotImplementedException (); }
+ get {
+ throw new NotImplementedException ();
+ }
}
public object this[int index] {
}
public object this[int index] {
int i = currentResult + 1;
if (i >= 0 && i < gdaResults.Count) {
currentResult++;
int i = currentResult + 1;
if (i >= 0 && i < gdaResults.Count) {
currentResult++;
Type = 16,
Unknown = 17
};
Type = 16,
Unknown = 17
};
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal class GdaList
+ {
+ public IntPtr data;
+ public IntPtr next;
+ public IntPtr prev;
+ }
sealed internal class libgda
{
sealed internal class libgda
{
string[] columnNames, bool isPrimaryKey) {
throw new NotImplementedException(); //need to finish related logic
string[] columnNames, bool isPrimaryKey) {
throw new NotImplementedException(); //need to finish related logic
base.ConstraintName = name;
//set unique
base.ConstraintName = name;
//set unique
_dataColumnNames = columnNames;
_isPrimaryKey = isPrimaryKey;
_dataColumnNames = columnNames;
_isPrimaryKey = isPrimaryKey;