|
From: <sv...@de...> - 2005-05-25 00:05:44
|
Author: marijn
Date: 2005-05-24 20:05:37 -0400 (Tue, 24 May 2005)
New Revision: 1142
Modified:
humano2/trunk/core/db/pgsql/pgsqlConnection.cs
Log:
* Adding work around for mono framework limitations of Fill() method.
Modified: humano2/trunk/core/db/pgsql/pgsqlConnection.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- humano2/trunk/core/db/pgsql/pgsqlConnection.cs 2005-05-24 21:10:33 UT=
C (rev 1141)
+++ humano2/trunk/core/db/pgsql/pgsqlConnection.cs 2005-05-25 00:05:37 UT=
C (rev 1142)
@@ -64,28 +64,37 @@
=20
}
=09
+ //FIXME: This does way many calls to the database, However it is neede=
d since the mono framework dies on us.
override public DataSet doSelect(string query,DataSet ds)
{
Open();
- NpgsqlConnection conn =3D ( (NpgsqlConnection) dbCon );
- =09
- NpgsqlDataAdapter da =3D new NpgsqlDataAdapter(query,conn);
- try
+ NpgsqlConnection conn =3D ( (NpgsqlConnection) dbCon ); =20
+ NpgsqlDataAdapter da =3D new NpgsqlDataAdapter();
+ query =3D query.Trim();
+ if (query.StartsWith(";"))
+ query =3D query.Substring(1);
+
+ string[] sqls =3D query.Split(';');
+ int counter =3D 0;
+ for (int i =3D0; i< sqls.Length;i++)
{
- da.Fill(ds);
+ da =3D new NpgsqlDataAdapter(sqls[i],conn);
+ try
+ {
+ da.Fill(ds,"tbl"+counter++);
+ }
+ catch(Exception ex)
+ {
+ Close();
+ Logger.Log("Error executing query:\r\n" + query, LogLevel.Trace);
+ throw new Exception("Error executing query:\r\n" + query + "\n\r" +=
ex.Message,ex.InnerException);
+ }
+ da.Dispose();
}
- catch(Exception ex)
- {
- Close();
- Logger.Log("Error executing query:\r\n" + query, LogLevel.Trace);
- throw new Exception("Error executing query:\r\n" + query + "\n\r" +e=
x.Message,ex.InnerException);
- }
- da.Dispose();
Close();
return ds;
+ }=20
=20
- }
-
///<summary>Realiza comandos en la base de datos que no retornen.</sum=
mary>
///<param name=3D"query">El SQL para la base de datos.</param>
///<returns>Cantidad de filas afectado por el comando.</returns>
|