Commit 6d019948 authored by Nigel Kukard's avatar Nigel Kukard

Merge branch 'nkwork1' into 'master'

More work on DataObj

See merge request !20
parents 26d09a12 81ead811
Pipeline #1246 passed with stages
in 3 minutes
......@@ -36,7 +36,7 @@ WriteMakefile(
'MAN3PODS' => {
'lib/AWITPT/DataObj.pm' => '$(INST_MAN3DIR)/AWITPT::DataObj.3',
'lib/AWITPT/DB/DataObj.pm' => '$(INST_MAN3DIR)/AWITPT::DB::DataObj.3',
'lib/AWITPT/DataObj/Backend/DBLayer.pm' => '$(INST_MAN3DIR)/AWITPT::DataObj::Backend::DBLayer.3',
'lib/AWITPT/Util/ConvertTSQL.pm' => '$(INST_MAN3DIR)/AWITPT::Util::ConvertTSQL.3',
'lib/AWITPT/Util/ConvertTSQL/client.pm' => '$(INST_MAN3DIR)/AWITPT::Util::ConvertTSQL::client.3',
'lib/AWITPT/Util/ConvertTSQL/MySQL.pm' => '$(INST_MAN3DIR)/AWITPT::Util::ConvertTSQL::MySQL.3',
......
This diff is collapsed.
# Database independent layer module
# Copyright (C) 2009-2014, AllWorldIT
# Copyright (C) 2009-2017, AllWorldIT
# Copyright (C) 2008, LinuxRulz
# Copyright (C) 2005-2007 Nigel Kukard <nkukard@lbsd.net>
#
......@@ -28,7 +28,7 @@ package AWITPT::DB::DBILayer;
use strict;
use warnings;
our $VERSION = "1.00";
our $VERSION = 1.01;
use DBI;
......
# Common database layer module
# Copyright (C) 2009-2014, AllWorldIT
# Copyright (C) 2009-2017, AllWorldIT
# Copyright (C) 2008, LinuxRulz
# Copyright (C) 2005-2007 Nigel Kukard <nkukard@lbsd.net>
#
......@@ -22,12 +22,14 @@
## @class AWITPT::DB::DBLayer
# Database layer module which makes life a bit esier
package AWITPT::DB::DBLayer;
use parent 'Exporter';
use strict;
use warnings;
our $VERSION = '2.000';
use parent 'Exporter';
our $VERSION = 2.01;
# Exporter stuff
our (@EXPORT);
......@@ -384,7 +386,7 @@ sub DBLastInsertID
}
my $res;
if (!($res = $dbh->lastInsertID(undef,undef,$table,$column))) {
if (!($res = $dbh->lastInsertID($table,$column))) {
_error("Error getting last inserted id: ".$dbh->error());
return;
}
......
This diff is collapsed.
# AWIT Data Object Relation Base Class
# Copyright (C) 2014, AllWorldIT
# Copyright (C) 2014-2017, AllWorldIT
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -32,12 +32,15 @@ The AWITPT::DataObj::Relation class provides a base class for relation classes.
package AWITPT::DataObj::Relation;
use parent 'Exporter';
use strict;
use warnings;
our $VERSION = "1.000";
use AWITPT::Object 1.01;
use parent -norequire, 'AWITPT::Object';
our $VERSION = 1.01;
our (@EXPORT,@EXPORT_OK);
@EXPORT = qw(
......@@ -66,56 +69,53 @@ The C<new> method is used to instantiate the object, in this case a root relatio
=cut
# Class instantiation
sub new
{
my ($class,$parent,$childClass) = @_;
# The new() method is inherited from AWITPT::Object
# Check if we firstly have a parent object
if (!defined($parent)) {
die "Parent object is required for DataObj::Relation";
}
# If there is no child class defined, we need to abort
if (!defined($childClass)) {
die "Child class is required for DataObj::Relation";
}
=head2 _init
# These are our internal properties
my $self = {
'_parent' => $parent,
'_child' => undef,
'_child_class_name' => $childClass
};
sub _init
{
my ($self,@params) = @_;
# Build our class
bless($self, $class);
$self->SUPER::_init(@params);
# Initialize the object
$self->init($parent,$childClass);
$self->{'_myinternal'} = "hello";
return $self;
}
return $self;
}
The internal C<_init> method is overridden in child objects to perform initialization tasks;
=cut
# Object initialization
sub _init
{
my ($self,@params) = @_;
my ($parent,$childClass) = @params;
=head2 init
sub init
{
my $self = shift;
# Check if we firstly have a parent object
if (!defined($parent)) {
die "Parent object is required for DataObj::Relation";
}
$self->{'_myinternal'} = "hello";
# If there is no child class defined, we need to abort
if (!defined($childClass)) {
die "Child class is required for DataObj::Relation";
}
The C<init> method is overridden in child objects to perform initialization tasks;
# Call parent initialization
$self->SUPER::_init(@params);
=cut
# These are our internal properties
$self->{'_parent'} = $parent,
$self->{'_child'} = undef;
$self->{'_child_class_name'} = $childClass;
# Object initialization
sub init
{
return $self;
}
......@@ -221,7 +221,7 @@ L<http://gitlab.devlabs.linuxassist.net/awit-frameworks/awit-perl-toolkit/issues
=head1 LICENSE AND COPYRIGHT
Copyright (C) 2014, AllWorldIT
Copyright (C) 2014-2017, AllWorldIT
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
# AWIT Data Object Direct Relation
# Copyright (C) 2014, AllWorldIT
# Copyright (C) 2014-2017, AllWorldIT
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -39,13 +39,15 @@ The AWITPT::DataObj::Relation::Direct class provides a direct relation between D
package AWITPT::DataObj::Relation::Direct;
use AWITPT::DataObj::Relation 1.000;
use base 'AWITPT::DataObj::Relation';
use strict;
use warnings;
our $VERSION = "1.000";
use AWITPT::DataObj::Relation 1.01;
use parent -norequire, 'AWITPT::DataObj::Relation';
our $VERSION = 1.01;
use AWITPT::DataObj;
......@@ -93,7 +95,7 @@ L<http://gitlab.devlabs.linuxassist.net/awit-frameworks/awit-perl-toolkit/issues
=head1 LICENSE AND COPYRIGHT
Copyright (C) 2014, AllWorldIT
Copyright (C) 2014-2017, AllWorldIT
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
# AWIT Data Object List Relation
# Copyright (C) 2014, AllWorldIT
# Copyright (C) 2014-2017, AllWorldIT
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -43,13 +43,15 @@ The AWITPT::DataObj::Relation::List class provides a list relation between DataO
package AWITPT::DataObj::Relation::List;
use AWITPT::DataObj::Relation 1.00;
use base 'AWITPT::DataObj::Relation';
use strict;
use warnings;
our $VERSION = "1.00";
use AWITPT::DataObj::Relation 1.01;
use parent -norequire, 'AWITPT::DataObj::Relation';
our $VERSION = 1.01;
use AWITPT::DataObj;
......@@ -64,17 +66,20 @@ C<AWITPT::DataObj::Relation::List> provides the below methods.
=head2 init
=head2 _init
The C<init> method is used internally by AWITPT::DataObj;
The C<_init> method is used internally by AWITPT::DataObj;
=cut
# Class initialization
sub init
sub _init
{
my $self = shift;
my ($self,@params) = @_;
# Call parent initialization
$self->SUPER::_init(@params);
# Initialize our child list
$self->{'_childList'} = { };
......@@ -196,7 +201,7 @@ L<http://gitlab.devlabs.linuxassist.net/awit-frameworks/awit-perl-toolkit/issues
=head1 LICENSE AND COPYRIGHT
Copyright (C) 2014, AllWorldIT
Copyright (C) 2014-2017, AllWorldIT
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
# Network IP Address Handling
# Copyright (C) 2009-2014, AllWorldIT
# Copyright (C) 2009-2017, AllWorldIT
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
......@@ -23,6 +23,8 @@
# - Robert Anderson <randerson@lbsd.net>
# * * *
# TODO: Needs to inherit AWITPT::Object
# TODO: Needs documentation
package AWITPT::NetIP;
......
# AWIT Object
# Copyright (C) 2016, AllWorldIT
# Copyright (C) 2016-2017, AllWorldIT
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -27,7 +27,7 @@ AWITPT::Object - AWITPT Object
#
package myobject;
use AWITPT::Object 1.00;
use base 'AWITPT::Object';
use parent -norequire, 'AWITPT::Object';
use strict;
use warnings;
......@@ -55,12 +55,14 @@ The AWITPT::Object class provides a basic abstraction layer to Perl objects.
package AWITPT::Object;
use parent 'Exporter';
use strict;
use warnings;
our $VERSION = "1.000";
use parent 'Exporter';
our $VERSION = 1.01;
our (@EXPORT,@EXPORT_OK);
@EXPORT = qw(
......@@ -95,6 +97,7 @@ sub new
{
my ($class,@params) = @_;
# These are our internal properties
my $self = {
};
......@@ -156,7 +159,7 @@ L<http://gitlab.devlabs.linuxassist.net/awit-frameworks/awit-perl-toolkit/issues
=head1 LICENSE AND COPYRIGHT
Copyright (C) 2016, AllWorldIT
Copyright (C) 2016-2017, AllWorldIT
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
# Copyright (c) 2014, AllWorldIT
# Copyright (c) 2010 Dominik Schulz (dominik.schulz@gauner.org). All rights reserved.
# Copyright (c) 2014-2017, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -17,15 +16,19 @@
#
#
# Based off of work from http://www.vboxadm.net/
# Copyright (c) 2010 Dominik Schulz (dominik.schulz@gauner.org). All rights reserved.
#
# TODO: Needs to inherit AWITPT::Object
# TODO: Needs documentation
package AWITPT::PWLib;
use parent 'Exporter';
use strict;
use warnings;
our $VERSION = "1.000";
our $VERSION = 1.01;
our (@EXPORT,@EXPORT_OK);
@EXPORT = qw(
......
......@@ -24,7 +24,7 @@ use parent 'Exporter';
use strict;
use warnings;
our $VERSION = "2.000";
our $VERSION = 2.01;
# Exporter stuff
our (@EXPORT,@EXPORT_OK);
......@@ -602,7 +602,7 @@ sub parseMacro
my $res = "";
# Loop with macro items
while ((my $match = $rest) =~ /([^%]+)?(?:\%{([a-zA-Z_0-9]+)(?:\(([0-9]+)(?:,([0-9]+))?\))?})(.*)/) {
while ((my $match = $rest) =~ /([^%]+)?(?:\%\{([a-zA-Z_0-9]+)(?:\(([0-9]+)(?:,([0-9]+))?\))?\})(.*)/) {
my ($before,$macro,$n,$m) = ($1,$2,$3,$4);
$rest = $5;
......
# TSQL conversion
# Copyright (C) 2016, AllWorldIT
# Copyright (C) 2016-2017, AllWorldIT
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -38,9 +38,11 @@ package AWITPT::Util::ConvertTSQL;
use strict;
use warnings;
use base 'AWITPT::Object';
use AWITPT::Object 1.01;
use parent -norequire, 'AWITPT::Object';
our $VERSION = "1.000";
our $VERSION = 1.01;
......@@ -169,6 +171,9 @@ sub _init
my ($self,@params) = @_;
# Call parent initialization
$self->SUPER::_init(@params);
# If we have uneven number of params, the first will be our sub-class
if (@params % 2) {
my $subClass = shift(@params);
......@@ -182,7 +187,7 @@ sub _init
};
# Check if the eval succeeded
if ($@) {
warn "AWITPT::Util::ConvertTSQL::$subClass not found";
warn "AWITPT::Util::ConvertTSQL::$subClass could not be loaded: $@";
return;
};
......
# TSQL conversion to MySQL
# Copyright (C) 2016, AllWorldIT
# Copyright (C) 2016-2017, AllWorldIT
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -38,9 +38,12 @@ package AWITPT::Util::ConvertTSQL::MySQL;
use strict;
use warnings;
use base 'AWITPT::Util::ConvertTSQL';
use AWITPT::Util::ConvertTSQL 1.01;
use parent -norequire, 'AWITPT::Util::ConvertTSQL';
our $VERSION = 1.01;
our $VERSION = "1.000";
our (@EXPORT,@EXPORT_OK);
@EXPORT = qw(
......
# TSQL conversion to PgSQL
# Copyright (C) 2016, AllWorldIT
# Copyright (C) 2016-2017, AllWorldIT
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -38,7 +38,9 @@ package AWITPT::Util::ConvertTSQL::PgSQL;
use strict;
use warnings;
use base 'AWITPT::Util::ConvertTSQL';
use AWITPT::Util::ConvertTSQL 1.01;
use parent -norequire, 'AWITPT::Util::ConvertTSQL';
our $VERSION = "1.000";
......@@ -119,7 +121,7 @@ L<http://gitlab.devlabs.linuxassist.net/awit-frameworks/awit-perl-toolkit/issues
=head1 LICENSE AND COPYRIGHT
Copyright (C) 2016, AllWorldIT
Copyright (C) 2016-2017, AllWorldIT
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
# TSQL conversion to SQLite
# Copyright (C) 2016, AllWorldIT
# Copyright (C) 2016-2017, AllWorldIT
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -38,9 +38,11 @@ package AWITPT::Util::ConvertTSQL::SQLite;
use strict;
use warnings;
use base 'AWITPT::Util::ConvertTSQL';
use AWITPT::Util::ConvertTSQL 1.01;
use parent -norequire, 'AWITPT::Util::ConvertTSQL';
our $VERSION = "1.000";
our $VERSION = 1.01;
our (@EXPORT,@EXPORT_OK);
@EXPORT = qw(
......@@ -121,7 +123,7 @@ L<http://gitlab.devlabs.linuxassist.net/awit-frameworks/awit-perl-toolkit/issues
=head1 LICENSE AND COPYRIGHT
Copyright (C) 2016, AllWorldIT
Copyright (C) 2016-2017, AllWorldIT
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
# TSQL conversion client
# Copyright (C) 2007-2016, AllWorldIT
# Copyright (C) 2007-2017, AllWorldIT
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -39,14 +39,17 @@ package AWITPT::Util::ConvertTSQL::client;
use strict;
use warnings;
use base 'AWITPT::Object';
use AWITPT::Object 1.01;
use parent -norequire, 'AWITPT::Object';
our $VERSION = 1.01;
use AWITPT::Util::ConvertTSQL;
use Getopt::Long qw( GetOptionsFromArray );
our $VERSION = "1.000";
=head1 METHODS
......@@ -171,7 +174,7 @@ L<http://gitlab.devlabs.linuxassist.net/awit-frameworks/awit-perl-toolkit/issues
=head1 LICENSE AND COPYRIGHT
Copyright (C) 2016, AllWorldIT
Copyright (C) 2007-2017, AllWorldIT
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment