Chris Hoefler
and 1 contributors

NAME

JsonSQL::Schemas::insert - JsonSQL 'insert' JSON schema.

VERSION

version 0.41

SYNOPSIS

This is a JSON schema describing an SQL INSERT statement. The main "inserts" property is an array, allowing support for batching of multiple INSERT statements into one query. For each INSERT, the table and values parameters are specified as separate properties. There is rudimentary support for the RETURNING clause if your database supports it.

You can instantiate this directly, but it is better to use the load_schema dispatcher from JsonSQL::Schemas::Schema.

To use this:

    my $schema = JsonSQL::Schemas::insert->new;
    if ( eval { $schema->is_error } ) {
        return "Could not load JSON schema: $schema->{message}";
    } else {
        my $schemaObj = parse_json($schema->{_json});
        ...
    }

For this to be useful, you will have to create a JSON::Validator object to validate parsed JSON strings, or just use JsonSQL::Validator.

ATTRIBUTES

$jsonSchema

The INSERT schema as a JSON string.

METHODS

Constructor new -> JsonSQL::Schemas::insert

Constructor method to return the $jsonSchema as a property of a new instance of this object.

AUTHOR

Chris Hoefler <bhoefler@draper.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Chris Hoefler.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.