The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,262 other subscribers

Archive for May 18th, 2021

Plastic SCM: add the current directory recursively

Posted by jpluimers on 2021/05/18

Since I always forget the command (I do not use it often enough) [WayBack] Plastic SCM – Branch per task guide:

cm add -R .

That adds the current directory (.) recursively, taking into account the ignore.conf file.

–jeroen

Posted in Development, PlasticSCM, Software Development, Source Code Management | Leave a Comment »

SQL Server: RowVersion is not the same format as BigInt

Posted by jpluimers on 2021/05/18

A while ago, I needed to get RowVersion binary data out of SQL Server. People around me told me it is stored as BigInt.

I luckily bumped into [WayBack] sql server – Cast rowversion to bigint – Stack Overflow.

That post explains RowVersion is not stored as BigInt. Both RowVersion and BigInt take up 8 bytes of storage, but RowVersion is big-endian and unsigned, whereas BigInt is little-endian and signed.

A few quotes from it:

In my C# program I don’t want to work with byte array, therefore I cast rowversion data type to bigint:

SELECT CAST([version] AS BIGINT) FROM [dbo].[mytable]

So I receive a number instead of byte array. Is this conversion always successful and are there any possible problems with it? If so, in which data type should I cast rowversion instead?

and

You can convert in C# also, but if you want to compare them you should be aware that rowversion is apparently stored big-endian, so you need to do something like:

byte[] timestampByteArray = ... // from datareader/linq2sql etc...
var timestampInt = BitConverter.ToInt64(timestampByteArray, 0);
timestampInt = IPAddress.NetworkToHostOrder(timestampInt);

It’d probably be more correct to convert it as ToUInt64, but then you’d have to write your own endian conversion as there’s no overload on NetworkToHostOrder that takes uint64. Or just borrow one from Jon Skeet (search page for ‘endian’).

Code: [WayBack] Jon Skeet: Miscellaneous Utility Library

Related:

–jeroen

 

Posted in .NET, Database Development, Delphi, Development, Software Development, SQL Server | Leave a Comment »

JclRTTI: type has not type info

Posted by jpluimers on 2021/05/18

[WayBack] Any idea why we get this error, or even better, how to fix it : [dcc32 Error] JclRTTI.pas(663): E2134 Type ‘<void>’ has no type info We compile same c… – Tommi Prami – Google+

So the JCL needs to have the compiler setting Emit runtime type information set to true (which is the default for projects, but can be turned off).

Thanks Stefan Glienke for reporting the fix.

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »