2 // TestPgSqlDataAdapter - tests PgSqlDataAdapter, DbDataAdapter, DataSet, DataTable,
3 // DataRow, and DataRowCollection by retrieving data
6 // Tim Coleman <tim@timcoleman.com>
7 // Daniel Morgan <danmorg@sc.rr.com>
9 // (c)copyright 2002 Tim Coleman
10 // (c)copyright 2002 Daniel Morgan
14 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
16 // Permission is hereby granted, free of charge, to any person obtaining
17 // a copy of this software and associated documentation files (the
18 // "Software"), to deal in the Software without restriction, including
19 // without limitation the rights to use, copy, modify, merge, publish,
20 // distribute, sublicense, and/or sell copies of the Software, and to
21 // permit persons to whom the Software is furnished to do so, subject to
22 // the following conditions:
24 // The above copyright notice and this permission notice shall be
25 // included in all copies or substantial portions of the Software.
27 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
31 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
33 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 using System.Collections;
39 using Mono.Data.PostgreSqlClient;
41 namespace TestSystemDataPgSqlClient
43 public class TestPgSqlDataAdapter
45 public static void Test()
47 string connectionString;
49 PgSqlDataAdapter adapter;
50 DataSet dataSet = null;
57 sqlQuery = "select * from pg_tables";
59 System.Console.WriteLine ("new PgSqlDataAdapter...");
60 adapter = new PgSqlDataAdapter (sqlQuery,
63 System.Console.WriteLine ("new DataSet...");
64 dataSet = new DataSet ();
67 System.Console.WriteLine("Fill...");
68 adapter.Fill (dataSet);
71 catch (NotImplementedException e) {
72 Console.WriteLine("Exception Caught: " + e);
75 System.Console.WriteLine ("get row...");
76 if (dataSet != null) {
77 foreach (DataRow row in dataSet.Tables["Table"].Rows)
78 Console.WriteLine("tablename: " + row["tablename"]);
79 System.Console.WriteLine("Done.");
84 public static void Main()