| 1 | ##---------------------------------------------------------------------------- | ||||||||||
| 2 | ## Database Object Interface - ~/lib/DB/Object/Fields/Overloaded.pm | ||||||||||
| 3 | ## Version v0.2.0 | ||||||||||
| 4 | ## Copyright(c) 2023 DEGUEST Pte. Ltd. | ||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||
| 6 | ## Created 2020/01/01 | ||||||||||
| 7 | ## Modified 2026/03/22 | ||||||||||
| 8 | ## All rights reserved | ||||||||||
| 9 | ## | ||||||||||
| 10 | ## This program is free software; you can redistribute it and/or modify it | ||||||||||
| 11 | ## under the same terms as Perl itself. | ||||||||||
| 12 | ##---------------------------------------------------------------------------- | ||||||||||
| 13 | package DB::Object::Fields::Overloaded; | ||||||||||
| 14 | BEGIN | ||||||||||
| 15 | 4 | ▶ | { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 4 | warnings::register_categories( 'DB::Object' ); | |||||||||
| 19 | 4 | ▶ | use parent qw( DB::Object::Query::Element ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 4 | ▶ | use vars qw( $VERSION $EXCEPTION_CLASS ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 4 | ▶ | use overload ( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 20 | ▶ | '""' => sub{ return( $_[0]->{expression} ) }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 60 | ▶ | 'bool' => sub{1}, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 4 | fallback => 1, | |||||||||
| 25 | 4 | ); | |||||||||
| 26 | 4 | our $EXCEPTION_CLASS = $DB::Object::EXCEPTION_CLASS; | |||||||||
| 27 | 4 | our $VERSION = 'v0.2.0'; | |||||||||
| 28 | }; | ||||||||||
| 29 | |||||||||||
| 30 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 31 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 32 | |||||||||||
| 33 | sub init | ||||||||||
| 34 | 20 | ▶ | { | ||||||||
|
Subroutine
init: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 35 | 20 | my $self = shift( @_ ); | |||||||||
| 36 | 20 | $self->{expression} = undef; | |||||||||
| 37 | 20 | $self->{_init_strict_use_sub} = 1; | |||||||||
| 38 | 20 | $self->{_exception_class} = $EXCEPTION_CLASS; | |||||||||
| 39 | 20 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 20 | return( $self ); | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | # sub binded { return( shift->{binded} ); } | ||||||||||
| 44 | |||||||||||
| 45 | # For example, if a placeholder was $1 (PostgreSQL), or ?1 (SQLite), the binded_offset value would be 1 | ||||||||||
| 46 | # sub binded_offset { return( shift->{binded_offset} ); } | ||||||||||
| 47 | |||||||||||
| 48 | 20 | ▶ | sub expression { return( shift->_set_get_scalar( 'expression', @_ ) ); } | ||||||||
|
Subroutine
expression: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 49 | |||||||||||
| 50 | 4 | 1; | |||||||||
| 51 | # NOTE: POD | ||||||||||
| 52 | __END__ | ||||||||||