Updated Firebird provider sources to 1.7.1 RC1 version
[mono.git] / mcs / class / FirebirdSql.Data.Firebird / FirebirdSql.Data.Common / DatabaseParameterBuffer.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, 2005 Carlos Guzman Alvarez
16  *  All Rights Reserved.
17  */
18
19 using System;
20 using System.IO;
21 using System.Text;
22 using System.Net;
23
24 namespace FirebirdSql.Data.Common
25 {
26         internal sealed class DatabaseParameterBuffer : ParameterBuffer
27         {
28                 #region Constructors
29
30                 public DatabaseParameterBuffer() : base()
31                 {
32                 }
33
34                 public DatabaseParameterBuffer(bool isLittleEndian) : base(isLittleEndian)
35                 {
36                 }
37
38                 #endregion
39
40                 #region Methods
41
42                 public void Append(int type, byte value)
43                 {
44                         this.WriteByte(type);
45                         this.WriteByte(1);
46                         this.Write(value);
47                 }
48
49                 public void Append(int type, short value)
50                 {
51                         this.WriteByte(type);
52                         this.WriteByte(2);
53                         this.Write(value);
54                 }
55
56                 public void Append(int type, int value)
57                 {
58                         this.WriteByte(type);
59                         this.WriteByte((byte)4);
60                         this.Write(value);
61                 }
62
63                 public void Append(int type, string content)
64                 {
65                         this.Append(type, Encoding.Default.GetBytes(content));
66                 }
67
68                 public void Append(int type, byte[] buffer)
69                 {
70                         this.WriteByte(type);
71                         this.WriteByte(buffer.Length);
72                         this.Write(buffer);
73                 }
74
75                 #endregion
76         }
77 }