コード例 #1
0
		public void Attach(ServiceParameterBuffer spb, string dataSource, int port, string service)
		{
			GenericResponse response = null;

			lock (this)
			{
				try
				{
					_database.XdrStream.Write(IscCodes.op_service_attach);
					_database.XdrStream.Write(0);
					_database.XdrStream.Write(service);
					_database.XdrStream.WriteBuffer(spb.ToArray());
					_database.XdrStream.Flush();

					response = _database.ReadGenericResponse();

					_handle = response.ObjectHandle;
				}
				catch (IOException ex)
				{
					_database.Detach();
					throw IscException.ForErrorCode(IscCodes.isc_net_write_err, ex);
				}
			}
		}
コード例 #2
0
		public void Attach(ServiceParameterBuffer spb, string dataSource, int port, string service)
		{
			GenericResponse response = null;

			lock (this)
			{
				try
				{
					this.database.Write(IscCodes.op_service_attach);
					this.database.Write(0);
					this.database.Write(service);
					this.database.WriteBuffer(spb.ToArray());
					this.database.Flush();

					response = this.database.ReadGenericResponse();

					this.handle = response.ObjectHandle;
				}
				catch (IOException)
				{
					this.database.Detach();

					throw new IscException(IscCodes.isc_net_write_err);
				}
			}
		}
コード例 #3
0
		public void Attach(ServiceParameterBuffer spb, string dataSource, int port, string service)
		{
			lock (this)
			{
				try
				{
					if (this.connection == null)
					{
						this.connection = new GdsConnection();
					}

					this.connection.Connect(dataSource, port, 8192, Charset.DefaultCharset);

					this.connection.Send.Write(IscCodes.op_service_attach);
					this.connection.Send.Write(0);
					this.connection.Send.Write(service);
					this.connection.Send.WriteBuffer(spb.ToArray());
					this.connection.Send.Flush();

					try
					{
						this.handle = this.connection.ReadGenericResponse().ObjectHandle;
					}
					catch (IscException)
					{
						try
						{
							this.Detach();
						}
						catch
						{
						}

						throw;
					}
				}
				catch (IOException)
				{
					this.connection.Disconnect();

					throw new IscException(IscCodes.isc_net_write_err);
				}
			}
		}
コード例 #4
0
		public void Attach(ServiceParameterBuffer spb, string dataSource, int port, string service)
		{
			int[] statusVector = ExtConnection.GetNewStatusVector();
			int svcHandle = this.Handle;

			SafeNativeMethods.isc_service_attach(
				statusVector,
				(short)service.Length,
				service,
				ref	svcHandle,
				(short)spb.Length,
				spb.ToArray());

			// Parse status	vector
			this.ParseStatusVector(statusVector);

			// Update status vector
			this.handle = svcHandle;
		}
コード例 #5
0
		public void Attach(ServiceParameterBuffer spb, string dataSource, int port, string service)
		{
			// Clear the status vector
			this.ClearStatusVector();

			int svcHandle = this.Handle;

			fbClient.isc_service_attach(
				this.statusVector,
				(short)service.Length,
				service,
				ref	svcHandle,
				(short)spb.Length,
				spb.ToArray());

			// Parse status	vector
			this.ParseStatusVector(this.statusVector);

			// Update status vector
			this.handle = svcHandle;
		}
コード例 #6
0
		public void Query(
			ServiceParameterBuffer	spb,
			int						requestLength,
			byte[]					requestBuffer,
			int						bufferLength,
			byte[]					buffer)
		{
			lock (this)
			{
				try
				{
					this.database.Write(IscCodes.op_service_info);	//	operation
					this.database.Write(this.Handle);				//	db_handle
					this.database.Write(0);										//	incarnation
					this.database.WriteBuffer(spb.ToArray(), spb.Length);		//	Service parameter buffer
					this.database.WriteBuffer(requestBuffer, requestLength);	//	request	buffer
					this.database.Write(bufferLength);				//	result buffer length

					this.database.Flush();

					GenericResponse response = this.database.ReadGenericResponse();

					int responseLength = bufferLength;

					if (response.Data.Length < bufferLength)
					{
						responseLength = response.Data.Length;
					}

					Buffer.BlockCopy(response.Data, 0, buffer, 0, responseLength);
				}
				catch (IOException)
				{
					throw new IscException(IscCodes.isc_network_error);
				}
			}
		}
コード例 #7
0
		public void Start(ServiceParameterBuffer spb)
		{
			lock (this)
			{
				try
				{
					this.database.Write(IscCodes.op_service_start);
					this.database.Write(this.Handle);
					this.database.Write(0);
					this.database.WriteBuffer(spb.ToArray(), spb.Length);
					this.database.Flush();

					try
					{
						this.database.ReadResponse();
					}
					catch (IscException)
					{
						throw;
					}
				}
				catch (IOException)
				{
					throw new IscException(IscCodes.isc_net_write_err);
				}
			}
		}
コード例 #8
0
		public void Start(ServiceParameterBuffer spb)
		{
			int[] statusVector = ExtConnection.GetNewStatusVector();
			int svcHandle = this.Handle;
			int reserved = 0;

			SafeNativeMethods.isc_service_start(
				statusVector,
				ref	svcHandle,
				ref	reserved,
				(short)spb.Length,
				spb.ToArray());

			// Parse status	vector
			this.ParseStatusVector(statusVector);
		}
コード例 #9
0
		public void Query(
			ServiceParameterBuffer spb,
			int requestLength,
			byte[] requestBuffer,
			int bufferLength,
			byte[] buffer)
		{
			int[] statusVector = ExtConnection.GetNewStatusVector();
			int svcHandle = this.Handle;
			int reserved = 0;

			SafeNativeMethods.isc_service_query(
				statusVector,
				ref	svcHandle,
				ref	reserved,
				(short)spb.Length,
				spb.ToArray(),
				(short)requestLength,
				requestBuffer,
				(short)buffer.Length,
				buffer);

			// Parse status	vector
			this.ParseStatusVector(statusVector);
		}
コード例 #10
0
		public void Query(
			ServiceParameterBuffer spb,
			int requestLength,
			byte[] requestBuffer,
			int bufferLength,
			byte[] buffer)
		{
			// Clear the status vector
			this.ClearStatusVector();

			int svcHandle = this.Handle;
			int reserved = 0;

			fbClient.isc_service_query(
				this.statusVector,
				ref	svcHandle,
				ref	reserved,
				(short)spb.Length,
				spb.ToArray(),
				(short)requestLength,
				requestBuffer,
				(short)buffer.Length,
				buffer);

			// Parse status	vector
			this.ParseStatusVector(this.statusVector);
		}
コード例 #11
0
		public void Start(ServiceParameterBuffer spb)
		{
			// Clear the status vector
			this.ClearStatusVector();

			int svcHandle = this.Handle;
			int reserved = 0;

			fbClient.isc_service_start(
				this.statusVector,
				ref	svcHandle,
				ref	reserved,
				(short)spb.Length,
				spb.ToArray());

			// Parse status	vector
			this.ParseStatusVector(this.statusVector);
		}
コード例 #12
0
		public void Start(ServiceParameterBuffer spb)
		{
			lock (this)
			{
				try
				{
					_database.XdrStream.Write(IscCodes.op_service_start);
					_database.XdrStream.Write(Handle);
					_database.XdrStream.Write(0);
					_database.XdrStream.WriteBuffer(spb.ToArray(), spb.Length);
					_database.XdrStream.Flush();

					try
					{
						_database.ReadResponse();
					}
					catch (IscException)
					{
						throw;
					}
				}
				catch (IOException ex)
				{
					throw IscException.ForErrorCode(IscCodes.isc_net_write_err, ex);
				}
			}
		}
コード例 #13
0
		public void Query(
			ServiceParameterBuffer	spb,
			int						requestLength,
			byte[]					requestBuffer,
			int						bufferLength,
			byte[]					buffer)
		{
			lock (this)
			{
				try
				{
					this.connection.Send.Write(IscCodes.op_service_info);	//	operation
					this.connection.Send.Write(this.Handle);				//	db_handle
					this.connection.Send.Write((int)0);						//	incarnation					
					this.connection.Send.WriteTyped(
						IscCodes.isc_spb_version, spb.ToArray());			//	Service parameter buffer
					this.connection.Send.WriteBuffer(
						requestBuffer, requestLength);						//	request	buffer
					this.connection.Send.Write(bufferLength);				//	result buffer length

					this.connection.Send.Flush();

					GdsResponse r = this.connection.ReadGenericResponse();

					Buffer.BlockCopy(r.Data, 0, buffer, 0, bufferLength);
				}
				catch (IOException)
				{
					throw new IscException(IscCodes.isc_network_error);
				}
			}
		}