Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aix-pm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerhard Gonter
aix-pm
Commits
aa8d3149
Commit
aa8d3149
authored
5 years ago
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
module to read data from mysql and postrgesql listings
parent
21f5756f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/util/Util/Data_Listing.pm
+57
-0
57 additions, 0 deletions
modules/util/Util/Data_Listing.pm
with
57 additions
and
0 deletions
modules/util/Util/Data_Listing.pm
0 → 100644
+
57
−
0
View file @
aa8d3149
package
Util::
Data_Listing
;
use
strict
;
sub
new
{
my
$class
=
shift
;
bless
[]
,
$class
;
}
sub
read
{
my
$self
=
shift
;
my
$fnm
=
shift
;
open
(
FI
,
'
<:utf8
',
$fnm
)
or
die
"
can't read [
$fnm
]
";
my
$rec
=
undef
;
my
$lnr
=
0
;
while
(
<
FI
>
)
{
chop
;
$lnr
++
;
# print __LINE__, " $lnr=[$_]\n";
if
(
m#^\*+ (\d+)\. row \*+$#
# MySQL \G
||
m#^-+\[ RECORD (\d+) \][\-\+]+$#
# PostgreSQL \x
)
{
my
$num
=
$
1
;
push
(
@$self
,
$rec
)
if
(
defined
(
$rec
));
$rec
=
{
_record
=>
$num
,
_file
=>
$fnm
};
}
elsif
(
m#^$#
)
{}
# ignore empty lines
elsif
(
defined
(
$rec
))
{
if
(
m#^\s*([^:]+): (.*)#
# MySQL \G
||
m#^([^ ]+) *\| (.*)#
# PostgreSQL \x
)
{
$rec
->
{
$
1
}
=
$
2
;
}
else
{
die
"
invalid format
";
}
}
else
{
die
"
no record defined
";
}
}
push
(
@$self
,
$rec
)
if
(
defined
(
$rec
));
close
(
FI
);
}
1
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment