зеркало из https://github.com/mono/mail-archives.git
309 строки
7.2 KiB
HTML
309 строки
7.2 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Mono-bugs] [Bug 424897] New: Assignment to OracleLob throws exception
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20424897%5D%20New%3A%20Assignment%20to%20OracleLob%20throws%0A%09exception&In-Reply-To=">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
|
<LINK REL="Previous" HREF="079133.html">
|
|
<LINK REL="Next" HREF="079509.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Mono-bugs] [Bug 424897] New: Assignment to OracleLob throws exception</H1>
|
|
<B>bugzilla_noreply at novell.com</B>
|
|
<A HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20424897%5D%20New%3A%20Assignment%20to%20OracleLob%20throws%0A%09exception&In-Reply-To="
|
|
TITLE="[Mono-bugs] [Bug 424897] New: Assignment to OracleLob throws exception">bugzilla_noreply at novell.com
|
|
</A><BR>
|
|
<I>Tue Sep 9 14:58:38 EDT 2008</I>
|
|
<P><UL>
|
|
<LI>Previous message: <A HREF="079133.html">[Mono-bugs] [Bug 424896] SLE ignores type argument constraints
|
|
</A></li>
|
|
<LI>Next message: <A HREF="079509.html">[Mono-bugs] [Bug 424897] Assignment to OracleLob throws exception
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#79129">[ date ]</a>
|
|
<a href="thread.html#79129">[ thread ]</a>
|
|
<a href="subject.html#79129">[ subject ]</a>
|
|
<a href="author.html#79129">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE><A HREF="https://bugzilla.novell.com/show_bug.cgi?id=424897">https://bugzilla.novell.com/show_bug.cgi?id=424897</A>
|
|
|
|
|
|
Summary: Assignment to OracleLob throws exception
|
|
Product: Mono: Class Libraries
|
|
Version: 2.0
|
|
Platform: x86-64
|
|
OS/Version: SLES 10
|
|
Status: NEW
|
|
Severity: Blocker
|
|
Priority: P5 - None
|
|
Component: Sys.Data
|
|
AssignedTo: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">bnc-blr-team-mono at forge.provo.novell.com</A>
|
|
ReportedBy: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">webservices at landmarkdigital.com</A>
|
|
QAContact: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs at lists.ximian.com</A>
|
|
Found By: Development
|
|
|
|
|
|
In the example below, when the assignment is made to p1.Value, an exception is
|
|
thrown. This code works in .NET 2.0. There appears to be no way to create a
|
|
blob oracle input paramter for a stored procedure call.
|
|
|
|
using System;
|
|
using System.Data;
|
|
using System.Data.OracleClient;
|
|
|
|
namespace BlobTest
|
|
{
|
|
class MainClass
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
checkTNS();
|
|
InsertBlob();
|
|
}
|
|
|
|
public static void checkTNS()
|
|
{
|
|
string tnsAdmin =
|
|
System.Environment.GetEnvironmentVariable("TNS_ADMIN");
|
|
if ( (tnsAdmin == null)
|
|
|| (string.Empty.Equals(tnsAdmin)) )
|
|
{
|
|
System.Environment.SetEnvironmentVariable("TNS_ADMIN",
|
|
"/home/tns");
|
|
}
|
|
}
|
|
|
|
|
|
public static decimal InsertBlob()
|
|
{
|
|
byte[] ByteArray = new byte[2000];
|
|
decimal retVal = -1;
|
|
|
|
string sproc = "MyPackage" + ".InsertBlob";
|
|
|
|
OracleCommand cmd = new OracleCommand();
|
|
|
|
cmd.CommandText = sproc;
|
|
|
|
cmd.CommandType = CommandType.StoredProcedure;
|
|
|
|
cmd.Connection = new OracleConnection(@"Data Source=mysource;User
|
|
Id=myuser;Password=mypass");
|
|
|
|
cmd.Connection.Open();
|
|
|
|
cmd.Transaction = cmd.Connection.BeginTransaction();
|
|
|
|
try
|
|
{
|
|
|
|
|
|
|
|
OracleParameter p1 = new OracleParameter("i_Sig_File",
|
|
OracleType.Blob);
|
|
|
|
|
|
p1.Direction = ParameterDirection.Input;
|
|
|
|
//EXCEPTION thrown here
|
|
p1.Value = GetOracleLob(cmd.Transaction, ByteArray);
|
|
|
|
cmd.Parameters.Add(p1);
|
|
|
|
|
|
|
|
cmd.ExecuteNonQuery();
|
|
|
|
cmd.Transaction.Commit();
|
|
|
|
}
|
|
|
|
catch(Exception ex)
|
|
{
|
|
Console.WriteLine("I exploded:" + ex.ToString());
|
|
cmd.Transaction.Rollback();
|
|
|
|
}
|
|
|
|
return retVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static OracleLob GetOracleLob(OracleTransaction transaction,
|
|
byte[] blob)
|
|
{
|
|
|
|
string BLOB_CREATE = "DECLARE dpBlob BLOB; BEGIN "
|
|
|
|
+ "DBMS_LOB.CREATETEMPORARY(dpBlob , False, 0); :tempBlob :=
|
|
dpBlob; "
|
|
|
|
+ "END;";
|
|
|
|
OracleLob tempLob = OracleLob.Null;
|
|
|
|
if (blob != null)
|
|
{
|
|
|
|
// Create a new command using the same connection
|
|
|
|
OracleCommand command = transaction.Connection.CreateCommand();
|
|
|
|
// Assign the transaction to the command
|
|
|
|
command.Transaction = transaction;
|
|
|
|
// Create blob storage on the Oracle server
|
|
|
|
command.CommandText = BLOB_CREATE;
|
|
|
|
// Add a new output paramter to accept the blob storage
|
|
reference
|
|
|
|
command.Parameters.Add(
|
|
|
|
new OracleParameter("tempBlob", OracleType.Blob)).Direction =
|
|
|
|
ParameterDirection.Output;
|
|
|
|
// Fire as your guns bear...
|
|
|
|
command.ExecuteNonQuery();
|
|
|
|
// Retrieve the blob stream from the OracleLob parameter
|
|
|
|
tempLob = (OracleLob)command.Parameters[0].Value;
|
|
|
|
// Prevent server side events from firing while we write to the
|
|
stream
|
|
|
|
tempLob.BeginBatch(OracleLobOpenMode.ReadWrite);
|
|
|
|
// Write bytes to the stream
|
|
|
|
tempLob.Write(blob, 0, blob.Length);
|
|
|
|
// Resume firing server events
|
|
|
|
tempLob.EndBatch();
|
|
|
|
}
|
|
|
|
return tempLob;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
--
|
|
Configure bugmail: <A HREF="https://bugzilla.novell.com/userprefs.cgi?tab=email">https://bugzilla.novell.com/userprefs.cgi?tab=email</A>
|
|
------- You are receiving this mail because: -------
|
|
You are the QA contact for the bug.
|
|
</PRE>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI>Previous message: <A HREF="079133.html">[Mono-bugs] [Bug 424896] SLE ignores type argument constraints
|
|
</A></li>
|
|
<LI>Next message: <A HREF="079509.html">[Mono-bugs] [Bug 424897] Assignment to OracleLob throws exception
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#79129">[ date ]</a>
|
|
<a href="thread.html#79129">[ thread ]</a>
|
|
<a href="subject.html#79129">[ subject ]</a>
|
|
<a href="author.html#79129">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
|
|
<hr>
|
|
<a href="http://lists.ximian.com/mailman/listinfo/mono-bugs">More information about the mono-bugs
|
|
mailing list</a><br>
|
|
</body></html>
|