2 * Firebird ADO.NET Data provider for .NET and Mono
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
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.
15 * Copyright (c) 2002, 2004 Carlos Guzman Alvarez
16 * All Rights Reserved.
21 using FirebirdSql.Data.Firebird;
22 using NUnit.Framework;
24 namespace FirebirdSql.Data.Firebird.Tests
27 /// All the test in this TestFixture are using implicit transaction support.
30 public class FbStoredProcCallsTest : BaseTest
32 public FbStoredProcCallsTest() : base(false)
37 public void FirebirdLikeTest00()
39 FbCommand command = new FbCommand("EXECUTE PROCEDURE GETVARCHARFIELD(?)", Connection);
41 command.CommandType = CommandType.StoredProcedure;
43 command.Parameters.Add("@ID", FbDbType.VarChar).Direction = ParameterDirection.Input;
44 command.Parameters.Add("@VARCHAR_FIELD", FbDbType.VarChar).Direction = ParameterDirection.Output;
46 command.Parameters[0].Value = 1;
48 // This will fill output parameters values
49 command.ExecuteNonQuery();
52 Assert.AreEqual("IRow Number 1", command.Parameters[1].Value);
54 // Dispose command - this will do a transaction commit
59 public void FirebirdLikeTest01()
61 FbCommand command = new FbCommand("SELECT * FROM GETVARCHARFIELD(?)", Connection);
62 command.CommandType = CommandType.StoredProcedure;
64 command.Parameters.Add("@ID", FbDbType.VarChar).Direction = ParameterDirection.Input;
65 command.Parameters[0].Value = 1;
67 // This will fill output parameters values
68 FbDataReader reader = command.ExecuteReader();
72 Console.WriteLine("Output Parameters - Result of SELECT command");
73 Console.WriteLine(reader[0]);
77 // Dispose command - this will do a transaction commit
82 public void SqlServerLikeTest00()
84 FbCommand command = new FbCommand("GETVARCHARFIELD", Connection);
86 command.CommandType = CommandType.StoredProcedure;
88 command.Parameters.Add("@ID", FbDbType.VarChar).Direction = ParameterDirection.Input;
89 command.Parameters.Add("@VARCHAR_FIELD", FbDbType.VarChar).Direction = ParameterDirection.Output;
91 command.Parameters[0].Value = 1;
93 // This will fill output parameters values
94 command.ExecuteNonQuery();
97 Console.WriteLine("Output Parameters");
98 Console.WriteLine(command.Parameters[1].Value);
100 // Dispose command - this will do a transaction commit
105 public void SqlServerLikeTest01()
107 FbCommand command = new FbCommand("GETRECORDCOUNT", Connection);
108 command.CommandType = CommandType.StoredProcedure;
110 command.Parameters.Add("@RECORDCOUNT", FbDbType.Integer).Direction = ParameterDirection.Output;
112 // This will fill output parameters values
113 command.ExecuteNonQuery();
115 // Print output value
116 Console.WriteLine("Output Parameters - Record Count");
117 Console.WriteLine(command.Parameters[0].Value);
119 // Dispose command - this will do a transaction commit
124 public void SqlServerLikeTest02()
126 FbCommand command = new FbCommand("GETVARCHARFIELD", Connection);
128 command.CommandType = CommandType.StoredProcedure;
130 command.Parameters.Add("@ID", FbDbType.VarChar).Value = 1;
132 // This will fill output parameters values
133 FbDataReader r = command.ExecuteReader();
144 // Dispose command - this will do a transaction commit
147 Assert.AreEqual(1, count);