Hi; you might want to ping me directly for protobuf-net issues (this list
is the wider "protobuf" group, covering many implementations)

I have never tried using protobuf-net with SQL CLR, for the simple reason
that I very rarely use SQL CLR, however there is not, AFAK, and fundamental
reason it *shouldn't* work. Looking at the error dump, this ties into the 4
places where the code (conditionally) makes use of "unsafe" code to switch
floating point numbers to their constituent bytes. This can be avoided by
using the optional FEAT_SAFE build symbol, which results in slightly slower
transformation to/from floating point, but: verifiable.

The generated IL makes extensive use of PEVerify in the test suite, so any
dynamic assemblies should be verifiable; I do, however, wonder if SQL CLR
will restrict the use of meta-programming. We'll have to see, I guess. But
there are alternative protobuf-net builds for limited runtimes
(Silverlight, iOS, unity, etc), so it should work.

Before you get carried away, though, I should emphasise; in my opinion,
your DB server is a pretty hard place to scale. I would strongly recommend
you limit this type of activity to higher tiers, such as your app-server or
web-server. Databases should store data. This is a hotly contended subject,
and you'll have to make your own decision! I should also note that
DataTable, while usable in this way, is not a particularly strong model.
It'll work, but... just.

I've got your email - would you like me to send you a copy of the current
code compiled with FEAT_SAFE?

Marc Gravell
(protobuf-net)

On 19 December 2011 19:11, Scott Moore <scott.moor...@gmail.com> wrote:

> I readily admit that I am a bit of a novice developer (I work in a
> small business and we all help as much as possible).  I came across
> the protocolbuf-net and it saved the day.  We were not able to
> serialize our DataTable using .NET components because they were too
> large.  But your stuff did the trick beautifully.
>
> I need to register the protocolbuf-net dll with SQL CLR but I am
> getting an error and I am completely stumped.  Hopefully you can
> help.
>
> I am running the following command in SQL Server 2008 R2:
>
> CREATE ASSEMBLY ProtobufNet
> FROM N'C:\Software\protobuf-net_r480\net20\protobuf-net.dll'
> WITH PERMISSION_SET = SAFE
>
> I get the following error:
>
> Msg 6218, Level 16, State 2, Line 1
> CREATE ASSEMBLY for assembly 'protobuf-net' failed because assembly
> 'protobuf-net' failed verification. Check if the referenced assemblies
> are up-to-date and trusted (for external_access or unsafe) to execute
> in the database. CLR Verifier error messages if any will follow this
> message
> [ : ProtoBuf.ProtoReader::ReadDouble][mdToken=0x6000232][offset
> 0x00000020][found address of Long] Expected numeric type on the stack.
> [ : ProtoBuf.ProtoReader::ReadSingle][mdToken=0x600023d][offset
> 0x00000018][found address of Int32] Expected numeric type on the
> stack.
> [ : ProtoBuf.ProtoWriter::WriteDouble][mdToken=0x600027f][offset
> 0x00000032][found address of Double] Expected numeric type on the
> stack.
> [ : ProtoBuf.ProtoWriter::WriteSingle][mdToken=0x6000280][offset
> 0x00000011][found address of Single] Expected numeric type on the
> stack.
>
>
> How do I get this DLL to register?  The project is to create a SQL CLR
> stored procedure that executes a query into a DataTable and then
> serializes and compresses the results which are fed to a client which
> in turn decompresses and deserializes.  I can get all the code to work
> without fail, but the DLL has to be registered with SQL and I have to
> register protobuf-net, too.
>
> Thanks in advance!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>


-- 
Regards,

Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to