(SQL Server) Generate a Random Firebase Push ID
Generates a random Firebase Push ID. (According to the algorithm described at https://gist.github.com/mikelehen/3596a30bd69384624c11, and at https://www.firebase.com/blog/2015-02-11-firebase-unique-identifiers.html)
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
-- Demonstrates how to generate a random Firebase Push ID.
-- This example requires the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @prng int
-- Use "Chilkat_9_5_0.Prng" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Prng', @prng OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @pushId nvarchar(4000)
DECLARE @i int
SELECT @i = 1
WHILE @i <= 10
BEGIN
EXEC sp_OAMethod @prng, 'FirebasePushId', @pushId OUT
PRINT @pushId
SELECT @i = @i + 1
END
EXEC @hr = sp_OADestroy @prng
END
GO
|