Group
Extension

Matches 33

DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/lib/DBIx/QuickORM/Conflator/JSON.pm ( view source; MetaCPAN )
r::JSON;
use strict;
use warnings;

our $VERSION = '0.000004';

use Cpanel::JSON::XS qw/decode_json/;

use Role::Tiny::With qw/with/;
with 'DBIx::QuickORM::Role::Conflator';

my $JSON = Cpanel::JSON::
->allow_nonref(1);
sub JSON { $JSON }

sub qorm_sql_type {
    my $class = shift;
    my %params = @_;

    my $con = $params{connection};

    if (my $type = $con->supports_json) {
        return $ty
n decode_json($val);
}

sub qorm_deflate {
    my $class = shift;
    my %params = @_;

    my $val = $params{value} or return undef;
    return $val unless ref($val);
    return $class->JSON->encode(
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/lib/DBIx/QuickORM/Conflator/JSON/ASCII.pm ( view source; MetaCPAN )
ckORM::Conflator::JSON::ASCII;
use strict;
use warnings;

our $VERSION = '0.000004';

use parent 'DBIx::QuickORM::Conflator::JSON';

use Cpanel::JSON::XS();

my $ASCII = Cpanel::JSON::XS->new->ascii(1
)->convert_blessed(1)->allow_nonref(1);
sub JSON { $ASCII }

1;
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/lib/DBIx/QuickORM/Type/JSON.pm ( view source; MetaCPAN )
package DBIx::QuickORM::Type::JSON;
use strict;
use warnings;

our $VERSION = '0.000019';

use DBIx::QuickORM::Util qw/parse_conflate_args/;

use Carp qw/croak/;
use Scalar::Util qw/reftype blessed/;
ole::Type';

use Cpanel::JSON::XS qw/decode_json/;

my $JSON = Cpanel::JSON::XS->new->utf8(1)->convert_blessed(1)->allow_nonref(1);
sub JSON { $JSON }

my $CJSON = Cpanel::JSON::XS->new->utf8(1)->conv
ert_blessed(1)->allow_nonref(1)->canonical(1);
sub CJSON { $CJSON }

sub qorm_inflate {
    my $params = parse_conflate_args(@_);
    my $val    = $params->{value} or return undef;
    my $class  = $p
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/master/DBIx/QuickORM/Conflator/JSON/ASCII.pm ( view source; MetaCPAN )
ckORM::Conflator::JSON::ASCII;
use strict;
use warnings;

our $VERSION = '0.000005';

use parent 'DBIx::QuickORM::Conflator::JSON';

use Cpanel::JSON::XS();

my $ASCII = Cpanel::JSON::XS->new->ascii(1
)->convert_blessed(1)->allow_nonref(1);
sub JSON { $ASCII }

1;
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/master/DBIx/QuickORM/Conflator/JSON.pm ( view source; MetaCPAN )
r::JSON;
use strict;
use warnings;

our $VERSION = '0.000005';

use Cpanel::JSON::XS qw/decode_json/;

use Role::Tiny::With qw/with/;
with 'DBIx::QuickORM::Role::Conflator';

my $JSON = Cpanel::JSON::
->allow_nonref(1);
sub JSON { $JSON }

sub qorm_sql_type {
    my $class = shift;
    my %params = @_;

    my $con = $params{connection};

    if (my $type = $con->supports_json) {
        return $ty
n decode_json($val);
}

sub qorm_deflate {
    my $class = shift;
    my %params = @_;

    my $val = $params{value} or return undef;
    return $val unless ref($val);
    return $class->JSON->encode(
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/lib/DBIx/QuickORM/Select/Forked.pm ( view source; MetaCPAN )
 Carp qw/croak confess/;
use POSIX();
use IO::Select();
use Scope::Guard();

use Cpanel::JSON::XS qw/decode_json/;

use parent 'DBIx::QuickORM::Select';
use DBIx::QuickORM::Util::HashBase qw{
    +rea
{ POSIX::_exit(42) };

    my $guard = Scope::Guard->new(sub { POSIX::_exit(1) });
    my $json = Cpanel::JSON::XS->new->ascii(1)->convert_blessed(1)->allow_nonref(1);
    $wh->autoflush(1);

    $sel
 print $wh $json->encode({cols => $cols}), "\n";
        print $wh $json->encode({relmap => $cols}), "\n";

        while (my $data = $sth->fetchrow_arrayref) {
            print $wh $json->encode({ro
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/lib/DBIx/QuickORM/Util/SchemaBuilder.pm ( view source; MetaCPAN )
 = (
    uuid => 'DBIx::QuickORM::Conflator::UUID',
    json => 'DBIx::QuickORM::Conflator::JSON',
    jsonb => 'DBIx::QuickORM::Conflator::JSON',

    map {$_ => 'DBIx::QuickORM::Conflator::DateTime'
               conflate($conflate);

                if ($conflate eq 'DBIx::QuickORM::Conflator::JSON') {
                    omit();
                }
            }
            elsif ($col->{is_date
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/master/t/00-report.t ( view source; MetaCPAN )

    my @depends = qw{
        Class::Method::Modifiers
        Class::XSAccessor
        Cpanel::JSON::XS
        DBD::MariaDB
        DBD::Pg
        DBD::SQLite
        DBD::mysql
        DBI
     
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/lib/DBIx/QuickORM/DB/Percona.pm ( view source; MetaCPAN )
our $VERSION = '0.000004';

use parent 'DBIx::QuickORM::DB::MySQL';
use DBIx::QuickORM::Util::HashBase;

sub sql_spec_keys { qw/percona mysql/ }

sub supports_uuid { () }
sub supports_json { () }

1;
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/lib/DBIx/QuickORM/DB/PostgreSQL.pm ( view source; MetaCPAN )
b supports_json {
    my $self = shift;
    my ($dbh) = @_;

    return 'JSONB' unless $dbh;

    my $ver = $self->db_version($dbh);

    my ($maj, $min) = split /\./, $ver;
    return 'JSONB' if $maj

my %NORMALIZED_TYPES = (
    INT          => 'INTEGER',
    BINARY       => 'BYTEA',
    JSON         => 'JSONB',
    BIGINTEGER   => 'BIGINT',
    SMALLINTEGER => 'SMALLINT',
    TINYINTEGER  => 'TI
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/lib/DBIx/QuickORM/DB/MariaDB.pm ( view source; MetaCPAN )
b supports_json {
    my $self = shift;
    my ($dbh) = @_;

    return 'JSON' unless $dbh;

    my $ver = $self->db_version($dbh);

    my ($maj, $min) = split /\./, $ver;
    return 'JSON' if $maj >
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/lib/DBIx/QuickORM/DB/SQLite.pm ( view source; MetaCPAN )
b supports_json {
    my $self = shift;
    my ($dbh) = @_;

    return 'JSONB' unless $dbh;

    my $ver = $self->db_version($dbh);

    my ($maj, $min) = split /\./, $ver;
    return 'JSONB' if $maj
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/lib/DBIx/QuickORM/Row.pm ( view source; MetaCPAN )
ete $data->{$_} for $self->primary_key_field_list;

    # Use dclone in case there is an inflated json object or similar that we do not want shared
    $data = dclone($data);

    # Add in any overrid
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/lib/DBIx/QuickORM.pm ( view source; MetaCPAN )
 autotype 'UUID';    # Automatically handle UUID fields
                autotype 'JSON';    # Automatically handle JSON fields

                # Do not autofill these tables
                autoskip 
database connection fields.

This is mainly useful if you credentials are in an encrypted YAML or JSON file
and you have a method to decrypt and read it returning it as a hash.

    db mydb => sub {
 
ific hook points
    };

=item C<autotype $TYPE_CLASS>

=item C<autotype 'JSON'>

=item C<autotype '+DBIx::QuickORM::Type::JSON'>

=item C<autotype 'UUID'>

=item C<autotype '+DBIx::QuickORM::Type::UU
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/master/DBIx/QuickORM/DB.pm ( view source; MetaCPAN )
 temp_table_supported { 0 }
sub temp_view_supported  { 0 }

sub supports_uuid { () }
sub supports_json { () }
sub supports_datetime { 'DATETIME' }

sub supports_async  { 0 }
sub async_query_arg { croa
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/lib/DBIx/QuickORM/DB/MySQL.pm ( view source; MetaCPAN )
pports_json {
    my $self = shift;
    my ($dbh) = @_;

    return 'JSON' unless $dbh;

    my $ver = $self->db_version($dbh);

    my ($maj, $min, $rev) = split /[-\.]/, $ver;
    return 'JSON' if $
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/master/DBIx/QuickORM.pm ( view source; MetaCPAN )
RCHAR(36).

=back

=head3 JSON, JSON::ASCII

This conflator will inflate the JSON into a perl data structure and deflate it
back into a JSON string.

This uses L<Cpanel::JSON::XS> under the hood.

=ov
flator::JSON>

Defaults to C<< $json->utf8->encode_json >>

This produces a utf8 encoded json string.

=item L<DBIx::QuickORM::Conflator::JSON::ASCII>

Defaults to C<< $json->ascii->encode_json >>

Th
is produces an ASCII encoded json string with non-ascii characters escaped.

=back

=head3 DateTime - Will not leave a mess with Data::Dumper!

L<DBIx::QuickORM::Conflator::DateTime>

This conflator w
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/master/DBIx/QuickORM/Source.pm ( view source; MetaCPAN )
};
    }

    return $data;
}

# See the Cpanel::JSON::XS docs
sub FREEZE {
    my $self = shift;
    my ($serializer) = @_;
    return ($self->TO_JSON);
}

sub THAW {
    my $class = shift;
    my ($
serializer, $data) = @_;

    return $class->FROM_JSON($data);
}

sub FROM_JSON {
    my $class = shift;
    my ($data) = @_;

    return $data if $data->{error};

    if (my $locator = $data->{locato
my $found = DBIx::QuickORM::GlobalLookup->lookup(@$locator)) {
            my $check = $found->TO_JSON;

            return {error => "Source content mismatch between origin and local copy (Source obj
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/lib/DBIx/QuickORM/Handle.pm ( view source; MetaCPAN )
;

    my $json = Cpanel::JSON::XS->new->utf8(1)->convert_blessed(1)->allow_nonref(1);
    my $dbh = $con->aside_dbh;

    my ($sth, $res) = $self->_execute($dbh, $sql);
    print $wh $json->encode({r
sth, $res, $sql)) {
                while (my $row = $fetch->()) {
                    print $wh $json->encode($row), "\n";
                }
            }
        }

        close($wh);
        1;
  
DBIx-QuickORM ( E/EX/EXODIST/DBIx-QuickORM-0.000019.tar.gz, EXODIST, 2025; MetaCPAN )
DBIx-QuickORM/master/t/unit/QuickORM/Conflator/JSON.t ( view source; MetaCPAN )
use Test2::V0 -target => 'DBIx::QuickORM::Conflator::JSON';

use ok $CLASS;

done_testing;

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.