2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / class / FirebirdSql.Data.Firebird / Test / FbDataAdapterTest.cs
1 /*
2  *  Firebird ADO.NET Data provider for .NET and Mono 
3  * 
4  *     The contents of this file are subject to the Initial 
5  *     Developer's Public License Version 1.0 (the "License"); 
6  *     you may not use this file except in compliance with the 
7  *     License. You may obtain a copy of the License at 
8  *     http://www.firebirdsql.org/index.php?op=doc&id=idpl
9  *
10  *     Software distributed under the License is distributed on 
11  *     an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
12  *     express or implied.  See the License for the specific 
13  *     language governing rights and limitations under the License.
14  * 
15  *  Copyright (c) 2002, 2004 Carlos Guzman Alvarez
16  *  All Rights Reserved.
17  */
18
19 using NUnit.Framework;
20 using System;
21 using System.Data;
22 using FirebirdSql.Data.Firebird;
23
24 namespace FirebirdSql.Data.Firebird.Tests
25 {
26         [TestFixture]
27         public class FbDataAdapterTest : BaseTest 
28         {
29                 public FbDataAdapterTest() : base(false)
30                 {               
31                 }
32         
33                 [Test]
34                 public void FillTest()
35                 {
36                         FbTransaction   transaction = this.Connection.BeginTransaction();
37                         FbCommand               command = new FbCommand("select * from TEST", Connection, transaction);
38                         FbDataAdapter   adapter = new FbDataAdapter(command);
39                         
40                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
41
42                         DataSet ds = new DataSet();
43                         adapter.Fill(ds, "TEST");
44                         
45                         Assert.AreEqual(100, ds.Tables["TEST"].Rows.Count, "Incorrect row count");
46
47                         Console.WriteLine();
48                         Console.WriteLine("DataAdapter - Fill Method - Test");
49
50                         foreach (DataTable table in ds.Tables)
51                         {
52                                 foreach (DataColumn col in table.Columns)
53                                 {
54                                         Console.Write(col.ColumnName + "\t\t");
55                                 }
56                                 
57                                 Console.WriteLine();
58                                 
59                                 foreach (DataRow row in table.Rows)
60                                 {
61                                         for (int i = 0; i < table.Columns.Count; i++)
62                                         {
63                                                 Console.Write(row[i] + "\t\t");
64                                         }
65
66                                         Console.WriteLine("");
67                                 }
68                         }
69
70                         adapter.Dispose();
71                         builder.Dispose();
72                         command.Dispose();
73                         transaction.Commit();
74                 }
75
76                 [Test]
77                 public void FillMultipleTest()
78                 {
79                         FbTransaction   transaction = this.Connection.BeginTransaction();
80                         FbCommand               command = new FbCommand("select * from TEST", Connection, transaction);
81                         FbDataAdapter   adapter = new FbDataAdapter(command);
82                         
83                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
84
85                         DataSet ds1 = new DataSet();
86                         DataSet ds2 = new DataSet();
87                         
88                         adapter.Fill(ds1, "TEST");
89                         adapter.Fill(ds2, "TEST");
90
91                         Assert.AreEqual(100, ds1.Tables["TEST"].Rows.Count, "Incorrect row count (ds1)");
92                         Assert.AreEqual(100, ds2.Tables["TEST"].Rows.Count, "Incorrect row count (ds2)");
93                         
94                         adapter.Dispose();
95                         builder.Dispose();
96                         command.Dispose();
97                         transaction.Commit();
98                 }
99
100                 [Test]
101         public void FillMultipleWithImplicitTransactionTest()
102                 {
103                         FbCommand               command = new FbCommand("select * from TEST", Connection);
104                         FbDataAdapter   adapter = new FbDataAdapter(command);
105                         
106                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
107
108                         DataSet ds1 = new DataSet();
109                         DataSet ds2 = new DataSet();
110                         
111                         adapter.Fill(ds1, "TEST");
112                         adapter.Fill(ds2, "TEST");
113                         
114                         Assert.AreEqual(100, ds1.Tables["TEST"].Rows.Count, "Incorrect row count (ds1)");
115                         Assert.AreEqual(100, ds2.Tables["TEST"].Rows.Count, "Incorrect row count (ds2)");
116
117                         adapter.Dispose();
118                         builder.Dispose();
119                         command.Dispose();
120                 }
121
122                 [Test]
123                 public void InsertTest()
124                 {
125                         FbTransaction   transaction = this.Connection.BeginTransaction();
126                         FbCommand               command         = new FbCommand("select * from TEST", Connection, transaction);
127                         FbDataAdapter   adapter         = new FbDataAdapter(command);
128                         
129                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
130
131                         DataSet ds = new DataSet();
132                         adapter.Fill(ds, "TEST");
133
134                         Assert.AreEqual(100, ds.Tables["TEST"].Rows.Count, "Incorrect row count");
135
136                         DataRow newRow = ds.Tables["TEST"].NewRow();
137
138                         newRow["int_field"]                     = 101;
139                         newRow["CHAR_FIELD"]            = "ONE THOUSAND";
140                         newRow["VARCHAR_FIELD"]         = ":;,.{}`+^*[]\\!|@#$%&/()?_-<>";
141                         newRow["BIGint_field"]          = 100000;
142                         newRow["SMALLint_field"]        = 100;
143                         newRow["DOUBLE_FIELD"]          = 100.01;
144                         newRow["NUMERIC_FIELD"]         = 100.01;
145                         newRow["DECIMAL_FIELD"]         = 100.01;
146                         newRow["DATE_FIELD"]            = new DateTime(100, 10, 10);
147                         newRow["TIME_FIELD"]            = new DateTime(100, 10, 10, 10, 10, 10, 10);
148                         newRow["TIMESTAMP_FIELD"]       = new DateTime(100, 10, 10, 10, 10, 10, 10);
149                         newRow["CLOB_FIELD"]            = "ONE THOUSAND";
150
151                         ds.Tables["TEST"].Rows.Add(newRow);
152
153                         adapter.Update(ds, "TEST");
154
155                         adapter.Dispose();
156                         builder.Dispose();
157                         command.Dispose();
158                         transaction.Commit();
159                 }
160
161                 [Test]
162                 public void UpdateCharTest()
163                 {
164                         string                  sql             = "select * from TEST where int_field = @int_field";
165                         FbTransaction   transaction = this.Connection.BeginTransaction();
166                         FbCommand               command = new FbCommand(sql, Connection, transaction);
167                         FbDataAdapter   adapter = new FbDataAdapter(command);
168
169                         adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
170                         
171                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
172
173                         DataSet ds = new DataSet();
174                         adapter.Fill(ds, "TEST");
175
176                         Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");
177
178                         ds.Tables["TEST"].Rows[0]["CHAR_FIELD"] = "ONE THOUSAND";
179
180                         adapter.Update(ds, "TEST");
181
182                         adapter.Dispose();
183                         builder.Dispose();
184                         command.Dispose();
185
186                         transaction.Commit();
187
188                         transaction = Connection.BeginTransaction();
189
190                         sql             = "SELECT char_field FROM TEST WHERE int_field = @int_field";
191                         command = new FbCommand(sql, Connection, transaction);                  
192                         command.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
193
194                         string val = (string)command.ExecuteScalar();
195
196                         transaction.Commit();
197
198                         Assert.AreEqual("ONE THOUSAND", val.Trim(), "char_field has not correct value");
199                 }
200
201                 [Test]
202                 public void UpdateVarCharTest()
203                 {
204                         string                  sql             = "select * from TEST where int_field = @int_field";
205                         FbTransaction   transaction = this.Connection.BeginTransaction();
206                         FbCommand               command         = new FbCommand(sql, Connection, transaction);
207                         FbDataAdapter   adapter         = new FbDataAdapter(command);
208
209                         adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
210                         
211                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
212
213                         DataSet ds = new DataSet();
214                         adapter.Fill(ds, "TEST");
215
216                         Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");
217
218                         ds.Tables["TEST"].Rows[0]["VARCHAR_FIELD"]      = "ONE VAR THOUSAND";
219
220                         adapter.Update(ds, "TEST");
221
222                         adapter.Dispose();
223                         builder.Dispose();
224                         command.Dispose();
225
226                         transaction.Commit();
227
228                         transaction = Connection.BeginTransaction();
229
230                         sql             = "SELECT varchar_field FROM TEST WHERE int_field = @int_field";
231                         command = new FbCommand(sql, Connection, transaction);                  
232                         command.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
233
234                         string val = (string)command.ExecuteScalar();
235
236                         transaction.Commit();
237
238                         Assert.AreEqual("ONE VAR THOUSAND", val.Trim(), "varchar_field has not correct value");
239                 }
240
241                 [Test]
242                 public void UpdateSmallIntTest()
243                 {
244                         string                  sql             = "select * from TEST where int_field = @int_field";
245                         FbTransaction   transaction = this.Connection.BeginTransaction();
246                         FbCommand               command         = new FbCommand(sql, Connection, transaction);
247                         FbDataAdapter   adapter         = new FbDataAdapter(command);
248
249                         adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
250                         
251                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
252
253                         DataSet ds = new DataSet();
254                         adapter.Fill(ds, "TEST");
255
256                         Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");
257
258                         ds.Tables["TEST"].Rows[0]["SMALLint_field"] = System.Int16.MaxValue;
259
260                         adapter.Update(ds, "TEST");
261
262                         adapter.Dispose();
263                         builder.Dispose();
264                         command.Dispose();
265
266                         transaction.Commit();
267
268                         transaction = Connection.BeginTransaction();
269
270                         sql             = "SELECT smallint_field FROM TEST WHERE int_field = @int_field";
271                         command = new FbCommand(sql, Connection, transaction);                  
272                         command.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
273
274                         short val = (short)command.ExecuteScalar();
275
276                         transaction.Commit();
277
278                         Assert.AreEqual(System.Int16.MaxValue, val, "smallint_field has not correct value");
279                 }
280
281                 [Test]
282                 public void UpdateBigIntTest()
283                 {
284                         string                  sql             = "select * from TEST where int_field = @int_field";
285                         FbTransaction   transaction = this.Connection.BeginTransaction();
286                         FbCommand               command         = new FbCommand(sql, Connection, transaction);
287                         FbDataAdapter   adapter         = new FbDataAdapter(command);
288
289                         adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
290                         
291                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
292
293                         DataSet ds = new DataSet();
294                         adapter.Fill(ds, "TEST");
295
296                         Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");
297
298                         ds.Tables["TEST"].Rows[0]["BIGINT_FIELD"] = System.Int32.MaxValue;
299
300                         adapter.Update(ds, "TEST");
301
302                         adapter.Dispose();
303                         builder.Dispose();
304                         command.Dispose();
305
306                         transaction.Commit();
307
308                         transaction = Connection.BeginTransaction();
309
310                         sql             = "SELECT bigint_field FROM TEST WHERE int_field = @int_field";
311                         command = new FbCommand(sql, Connection, transaction);                  
312                         command.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
313
314                         long val = (long)command.ExecuteScalar();
315
316                         transaction.Commit();
317
318                         Assert.AreEqual(System.Int32.MaxValue, val, "bigint_field has not correct value");
319                 }
320
321                 [Test]
322                 public void UpdateDoubleTest()
323                 {
324                         string                  sql             = "select * from TEST where int_field = @int_field";
325                         FbTransaction   transaction = this.Connection.BeginTransaction();
326                         FbCommand               command         = new FbCommand(sql, Connection, transaction);
327                         FbDataAdapter   adapter         = new FbDataAdapter(command);
328
329                         adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
330                         
331                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
332
333                         DataSet ds = new DataSet();
334                         adapter.Fill(ds, "TEST");
335
336                         Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");
337
338                         ds.Tables["TEST"].Rows[0]["DOUBLE_FIELD"]       = System.Int32.MaxValue;
339
340                         adapter.Update(ds, "TEST");
341
342                         adapter.Dispose();
343                         builder.Dispose();
344                         command.Dispose();
345
346                         transaction.Commit();
347
348                         transaction = Connection.BeginTransaction();
349
350                         sql             = "SELECT double_field FROM TEST WHERE int_field = @int_field";
351                         command = new FbCommand(sql, Connection, transaction);
352                         command.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
353
354                         double val = (double)command.ExecuteScalar();
355
356                         transaction.Commit();
357
358                         Assert.AreEqual(System.Int32.MaxValue, val, "double_field has not correct value");
359                 }
360
361                 [Test]
362                 public void UpdateNumericTest()
363                 {
364                         string                  sql             = "select * from TEST where int_field = @int_field";
365                         FbTransaction   transaction = this.Connection.BeginTransaction();
366                         FbCommand               command         = new FbCommand(sql, Connection, transaction);
367                         FbDataAdapter   adapter         = new FbDataAdapter(command);
368
369                         adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
370                         
371                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
372
373                         DataSet ds = new DataSet();
374                         adapter.Fill(ds, "TEST");
375
376                         Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");
377
378                         ds.Tables["TEST"].Rows[0]["NUMERIC_FIELD"]      = System.Int32.MaxValue;
379
380                         adapter.Update(ds, "TEST");
381
382                         adapter.Dispose();
383                         builder.Dispose();
384                         command.Dispose();
385
386                         transaction.Commit();
387
388                         transaction = Connection.BeginTransaction();
389
390                         sql             = "SELECT numeric_field FROM TEST WHERE int_field = @int_field";
391                         command = new FbCommand(sql, Connection, transaction);
392                         command.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
393
394                         decimal val = (decimal)command.ExecuteScalar();
395
396                         transaction.Commit();
397
398                         Assert.AreEqual(System.Int32.MaxValue, val, "numeric_field has not correct value");
399                 }
400
401                 [Test]
402                 public void UpdateDecimalTest()
403                 {
404                         string                  sql             = "select * from TEST where int_field = @int_field";
405                         FbTransaction   transaction = this.Connection.BeginTransaction();
406                         FbCommand               command         = new FbCommand(sql, Connection, transaction);
407                         FbDataAdapter   adapter         = new FbDataAdapter(command);
408
409                         adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
410                         
411                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
412
413                         DataSet ds = new DataSet();
414                         adapter.Fill(ds, "TEST");
415
416                         Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");
417
418                         ds.Tables["TEST"].Rows[0]["DECIMAL_FIELD"]      = System.Int32.MaxValue;
419                         
420                         adapter.Update(ds, "TEST");
421
422                         adapter.Dispose();
423                         builder.Dispose();
424                         command.Dispose();
425
426                         transaction.Commit();
427
428                         transaction = Connection.BeginTransaction();
429
430                         sql             = "SELECT decimal_field FROM TEST WHERE int_field = @int_field";
431                         command = new FbCommand(sql, Connection, transaction);
432                         command.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
433
434                         decimal val = (decimal)command.ExecuteScalar();
435
436                         transaction.Commit();
437
438                         Assert.AreEqual(System.Int32.MaxValue, val, "decimal_field has not correct value");
439                 }
440
441                 [Test]
442                 public void UpdateDateTest()
443                 {
444                         string                  sql             = "select * from TEST where int_field = @int_field";
445                         FbTransaction   transaction = this.Connection.BeginTransaction();
446                         FbCommand               command         = new FbCommand(sql, Connection, transaction);
447                         FbDataAdapter   adapter         = new FbDataAdapter(command);
448
449                         adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
450                         
451                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
452
453                         DataSet ds = new DataSet();
454                         adapter.Fill(ds, "TEST");
455
456                         Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");
457
458                         DateTime dtValue = DateTime.Now;
459
460                         ds.Tables["TEST"].Rows[0]["DATE_FIELD"] = dtValue;
461
462                         adapter.Update(ds, "TEST");
463
464                         adapter.Dispose();
465                         builder.Dispose();
466                         command.Dispose();
467
468                         transaction.Commit();
469
470                         transaction = Connection.BeginTransaction();
471
472                         sql             = "SELECT date_field FROM TEST WHERE int_field = @int_field";
473                         command = new FbCommand(sql, Connection, transaction);
474                         command.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
475
476                         DateTime val = (DateTime)command.ExecuteScalar();
477
478                         transaction.Commit();
479
480                         Assert.AreEqual(dtValue.Day, val.Day, "date_field has not correct day");
481                         Assert.AreEqual(dtValue.Month, val.Month, "date_field has not correct month");
482                         Assert.AreEqual(dtValue.Year, val.Year, "date_field has not correct year");
483                 }
484
485                 [Test]
486                 public void UpdateTimeTest()
487                 {
488                         string                  sql             = "select * from TEST where int_field = @int_field";
489                         FbTransaction   transaction = this.Connection.BeginTransaction();
490                         FbCommand               command         = new FbCommand(sql, Connection, transaction);
491                         FbDataAdapter   adapter         = new FbDataAdapter(command);
492
493                         adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
494                         
495                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
496
497                         DataSet ds = new DataSet();
498                         adapter.Fill(ds, "TEST");
499
500                         Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");
501
502                         DateTime dtValue = DateTime.Now;
503
504                         ds.Tables["TEST"].Rows[0]["TIME_FIELD"] = dtValue;
505
506                         adapter.Update(ds, "TEST");
507
508                         adapter.Dispose();
509                         builder.Dispose();
510                         command.Dispose();
511
512                         transaction.Commit();
513
514                         transaction = Connection.BeginTransaction();
515
516                         sql             = "SELECT time_field FROM TEST WHERE int_field = @int_field";
517                         command = new FbCommand(sql, Connection, transaction);
518                         command.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
519
520                         DateTime val = (DateTime)command.ExecuteScalar();
521
522                         transaction.Commit();
523
524                         Assert.AreEqual(dtValue.Hour, val.Hour, "time_field has not correct hour");
525                         Assert.AreEqual(dtValue.Minute, val.Minute, "time_field has not correct minute");
526                         Assert.AreEqual(dtValue.Second, val.Second, "time_field has not correct second");
527                 }
528
529                 [Test]
530                 public void UpdateTimeStampTest()
531                 {
532                         string                  sql             = "select * from TEST where int_field = @int_field";
533                         FbTransaction   transaction = this.Connection.BeginTransaction();
534                         FbCommand               command         = new FbCommand(sql, Connection, transaction);
535                         FbDataAdapter   adapter         = new FbDataAdapter(command);
536
537                         adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
538                         
539                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
540
541                         DataSet ds = new DataSet();
542                         adapter.Fill(ds, "TEST");
543
544                         Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");
545
546                         DateTime dtValue = DateTime.Now;
547
548                         ds.Tables["TEST"].Rows[0]["TIMESTAMP_FIELD"] = dtValue;
549
550                         adapter.Update(ds, "TEST");
551
552                         adapter.Dispose();
553                         builder.Dispose();
554                         command.Dispose();
555
556                         transaction.Commit();
557
558                         transaction = Connection.BeginTransaction();
559
560                         sql             = "SELECT timestamp_field FROM TEST WHERE int_field = @int_field";
561                         command = new FbCommand(sql, Connection, transaction);
562                         command.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
563
564                         DateTime val = (DateTime)command.ExecuteScalar();
565
566                         transaction.Commit();
567
568                         Assert.AreEqual(dtValue.Day, val.Day, "timestamp_field has not correct day");
569                         Assert.AreEqual(dtValue.Month, val.Month, "timestamp_field has not correct month");
570                         Assert.AreEqual(dtValue.Year, val.Year, "timestamp_field has not correct year");
571                         Assert.AreEqual(dtValue.Hour, val.Hour, "timestamp_field has not correct hour");
572                         Assert.AreEqual(dtValue.Minute, val.Minute, "timestamp_field has not correct minute");
573                         Assert.AreEqual(dtValue.Second, val.Second, "timestamp_field has not correct second");
574                 }
575
576                 [Test]
577                 public void UpdateClobTest()
578                 {
579                         string                  sql             = "select * from TEST where int_field = @int_field";
580                         FbTransaction   transaction = this.Connection.BeginTransaction();
581                         FbCommand               command         = new FbCommand(sql, Connection, transaction);
582                         FbDataAdapter   adapter         = new FbDataAdapter(command);
583
584                         adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 1;
585                         
586                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
587
588                         DataSet ds = new DataSet();
589                         adapter.Fill(ds, "TEST");
590
591                         Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");
592
593                         ds.Tables["TEST"].Rows[0]["CLOB_FIELD"] = "ONE THOUSAND";
594
595                         adapter.Update(ds, "TEST");
596
597                         adapter.Dispose();
598                         builder.Dispose();
599                         command.Dispose();
600                         transaction.Commit();
601                 }
602         
603                 [Test]
604                 public void DeleteTest()
605                 {
606                         string                  sql             = "select * from TEST where int_field = @int_field";
607                         FbTransaction   transaction = this.Connection.BeginTransaction();
608                         FbCommand               command         = new FbCommand(sql, Connection, transaction);
609                         FbDataAdapter   adapter         = new FbDataAdapter(command);
610
611                         adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 10;
612                         
613                         FbCommandBuilder builder = new FbCommandBuilder(adapter);
614
615                         DataSet ds = new DataSet();
616                         adapter.Fill(ds, "TEST");
617
618                         Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");
619
620                         ds.Tables["TEST"].Rows[0].Delete();
621
622                         adapter.Update(ds, "TEST");
623
624                         adapter.Dispose();
625                         builder.Dispose();
626                         command.Dispose();
627                         transaction.Commit();
628                 }
629
630                 [Test]
631                 public void SubsequentDeletes()
632                 {
633                         string selectSql = "SELECT * FROM test";
634                         string deleteSql = "DELETE FROM test WHERE int_field = @id";
635
636                         // Set up conenction and select/delete commands
637                         FbConnection connection = new FbConnection(this.Connection.ConnectionString);
638                         FbCommand select = new FbCommand(selectSql, connection);
639                         FbCommand delete = new FbCommand(deleteSql, connection);
640                         delete.Parameters.Add("@id", FbDbType.Integer);
641                         delete.Parameters[0].SourceColumn = "INT_FIELD";
642                         
643                         // Set up the FbDataAdapter
644                         FbDataAdapter adapter = new FbDataAdapter(select);
645                         adapter.DeleteCommand = delete;
646
647                         // Set up dataset
648                         DataSet ds = new DataSet();
649                         adapter.Fill(ds);
650
651                         // Delete one row
652                         ds.Tables[0].Rows[0].Delete();
653                         adapter.Update(ds);
654
655                         // Delete another row
656                         ds.Tables[0].Rows[0].Delete();
657                         adapter.Update(ds);
658
659                         // Delete another row
660                         ds.Tables[0].Rows[0].Delete();
661                         adapter.Update(ds);
662                 }
663
664                 [Test]
665         [Ignore("Not supported")]
666         public void MultipleResultsetTest()
667                 {
668                         FbCommand command = new FbCommand("", this.Connection);
669
670                         command.CommandText = "select * from test;";
671                         command.CommandText += "select int_field from test;";
672                         command.CommandText += "select int_field, char_field from test;";
673
674                         FbDataAdapter adapter = new FbDataAdapter(command);
675
676                         DataSet ds = new DataSet();
677
678                         adapter.Fill(ds);
679
680             Assert.AreEqual(3, ds.Tables.Count, "Incorrect tables count");
681         }
682         }
683 }