Sample code for 30+ languages & platforms
SQL Server Requires Chilkat v11.7.0+

Get the QR Code Capabilities of the Chilkat Version in Use

See more QR Code Examples

Demonstrates the capabilities operation, which describes what the installed version of Chilkat can do: the range of QR versions, the error-correction levels, the operations, the image formats and the limits. A program can check for a feature here instead of testing for a Chilkat version number. The request can be an empty JSON object.

Chilkat SQL Server Downloads

SQL Server
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    DECLARE @iTmp1 int
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @success int
    SELECT @success = 0

    --  This example requires the Chilkat API to have been previously unlocked.
    --  See Global Unlock Sample for sample code.

    DECLARE @json int
    EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @fmt int
    EXEC @hr = sp_OACreate 'Chilkat.Formats', @fmt OUT

    DECLARE @jsonOut int
    EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jsonOut OUT

    EXEC sp_OAMethod @fmt, 'QrCode', @success OUT, 'capabilities', @json, @jsonOut
    IF @success = 0
      BEGIN
        EXEC sp_OAGetProperty @fmt, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @json
        EXEC @hr = sp_OADestroy @fmt
        EXEC @hr = sp_OADestroy @jsonOut
        RETURN
      END


    EXEC sp_OAMethod @jsonOut, 'StringOf', @sTmp0 OUT, 'productVersion'
    PRINT 'Chilkat version: ' + @sTmp0

    EXEC sp_OAMethod @jsonOut, 'StringOf', @sTmp0 OUT, 'symbologies[0].id'
    PRINT 'symbology: ' + @sTmp0

    EXEC sp_OAMethod @jsonOut, 'IntOf', @iTmp0 OUT, 'symbologies[0].encoding.version.min'

    EXEC sp_OAMethod @jsonOut, 'IntOf', @iTmp1 OUT, 'symbologies[0].encoding.version.max'
    PRINT 'QR versions: ' + @iTmp0 + ' to ' + @iTmp1

    EXEC sp_OAMethod @jsonOut, 'IntOf', @iTmp0 OUT, 'symbologies[0].structuredAppend.maxSymbols'
    PRINT 'structured append, most symbols: ' + @iTmp0

    DECLARE @i int

    DECLARE @n int

    EXEC sp_OAMethod @jsonOut, 'SizeOfArray', @n OUT, 'symbologies[0].encoding.errorCorrection'
    SELECT @i = 0
    WHILE @i <= @n - 1
      BEGIN
        EXEC sp_OASetProperty @jsonOut, 'I', @i

        EXEC sp_OAMethod @jsonOut, 'StringOf', @sTmp0 OUT, 'symbologies[0].encoding.errorCorrection[i]'
        PRINT 'error correction: ' + @sTmp0
        SELECT @i = @i + 1
      END

    --  The operations this version implements.
    EXEC sp_OAMethod @jsonOut, 'SizeOfArray', @n OUT, 'operations'
    SELECT @i = 0
    WHILE @i <= @n - 1
      BEGIN
        EXEC sp_OASetProperty @jsonOut, 'I', @i
        EXEC sp_OAMethod @jsonOut, 'BoolOf', @iTmp0 OUT, 'operations[i].available'
        IF @iTmp0 = 1
          BEGIN

            EXEC sp_OAMethod @jsonOut, 'StringOf', @sTmp0 OUT, 'operations[i].name'
            PRINT 'operation: ' + @sTmp0
          END
        SELECT @i = @i + 1
      END

    EXEC sp_OAMethod @jsonOut, 'SizeOfArray', @n OUT, 'imageFormats.output'
    SELECT @i = 0
    WHILE @i <= @n - 1
      BEGIN
        EXEC sp_OASetProperty @jsonOut, 'I', @i

        EXEC sp_OAMethod @jsonOut, 'StringOf', @sTmp0 OUT, 'imageFormats.output[i]'
        PRINT 'image format: ' + @sTmp0
        SELECT @i = @i + 1
      END


    EXEC sp_OAMethod @jsonOut, 'IntOf', @iTmp0 OUT, 'limits.timeoutMs.default'

    PRINT 'default timeout: ' + @iTmp0 + ' ms'

    EXEC sp_OAMethod @jsonOut, 'IntOf', @iTmp0 OUT, 'limits.maxPixels.default'

    PRINT 'default largest image: ' + @iTmp0 + ' pixels'

    --  Sample output:

    --  Chilkat version: 11.7.0
    --  symbology: qr
    --  QR versions: 1 to 40
    --  structured append, most symbols: 16
    --  error correction: auto
    --  error correction: L
    --  error correction: M
    --  error correction: Q
    --  error correction: H
    --  operation: generate
    --  operation: measure
    --  operation: validate
    --  operation: capabilities
    --  image format: png
    --  image format: svg
    --  default timeout: 10000 ms
    --  default largest image: 16777216 pixels

    EXEC @hr = sp_OADestroy @json
    EXEC @hr = sp_OADestroy @fmt
    EXEC @hr = sp_OADestroy @jsonOut


END
GO