| 1 | # ----------------------------------------------------------------------------- | ||||||||||
| 2 | |||||||||||
| 3 | =encoding utf8 | ||||||||||
| 4 | |||||||||||
| 5 | =head1 NAME | ||||||||||
| 6 | |||||||||||
| 7 | Quiq::Sql::Analyzer - Analyse von SQL-Code | ||||||||||
| 8 | |||||||||||
| 9 | =head1 BASE CLASS | ||||||||||
| 10 | |||||||||||
| 11 | L<Quiq::Dbms> | ||||||||||
| 12 | |||||||||||
| 13 | =head1 SYNOPSIS | ||||||||||
| 14 | |||||||||||
| 15 | use Quiq::Sql::Analyzer; | ||||||||||
| 16 | |||||||||||
| 17 | my $aly = Quiq::Sql::Analyzer->new($dbms); | ||||||||||
| 18 | my $aly = Quiq::Sql::Analyzer->new($dbms,$version); | ||||||||||
| 19 | |||||||||||
| 20 | =cut | ||||||||||
| 21 | |||||||||||
| 22 | # ----------------------------------------------------------------------------- | ||||||||||
| 23 | |||||||||||
| 24 | package Quiq::Sql::Analyzer; | ||||||||||
| 25 | 2 | ▶ | use base qw/Quiq::Dbms/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | |||||||||||
| 27 | 2 | ▶ | use v5.10; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 30 | |||||||||||
| 31 | 2 | our $VERSION = '1.240'; | |||||||||
| 32 | |||||||||||
| 33 | # ----------------------------------------------------------------------------- | ||||||||||
| 34 | |||||||||||
| 35 | =head1 METHODS | ||||||||||
| 36 | |||||||||||
| 37 | =head2 Objektmethoden | ||||||||||
| 38 | |||||||||||
| 39 | =head3 isCreateFunction() - Prüfe auf CREATE FUNCTION | ||||||||||
| 40 | |||||||||||
| 41 | =head4 Synopsis | ||||||||||
| 42 | |||||||||||
| 43 | $bool = $aly->isCreateFunction($stmt); | ||||||||||
| 44 | |||||||||||
| 45 | =head4 Arguments | ||||||||||
| 46 | |||||||||||
| 47 | =over 4 | ||||||||||
| 48 | |||||||||||
| 49 | =item $stmt | ||||||||||
| 50 | |||||||||||
| 51 | SQL-Statement. | ||||||||||
| 52 | |||||||||||
| 53 | =back | ||||||||||
| 54 | |||||||||||
| 55 | =head4 Returns | ||||||||||
| 56 | |||||||||||
| 57 | Boolean | ||||||||||
| 58 | |||||||||||
| 59 | =head4 Description | ||||||||||
| 60 | |||||||||||
| 61 | Prüfe, ob SQL-Statement $stmt ein C<CREATE FUNCTION> oder C<CREATE OR | ||||||||||
| 62 | REPLACE FUNCTION> Statement enthält. Wenn ja, liefere 1, andernfalls 0. | ||||||||||
| 63 | |||||||||||
| 64 | =cut | ||||||||||
| 65 | |||||||||||
| 66 | # ----------------------------------------------------------------------------- | ||||||||||
| 67 | |||||||||||
| 68 | 4 | ▶ | sub isCreateFunction { | ||||||||
|
Subroutine
isCreateFunction: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 69 | 4 | my ($self,$stmt) = @_; | |||||||||
| 70 | 4 | ▶ | return $stmt =~ /CREATE\s+(OR\s+REPLACE\s+)?FUNCTION/i? 1: 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | # ----------------------------------------------------------------------------- | ||||||||||
| 74 | |||||||||||
| 75 | =head1 VERSION | ||||||||||
| 76 | |||||||||||
| 77 | 1.240 | ||||||||||
| 78 | |||||||||||
| 79 | =head1 AUTHOR | ||||||||||
| 80 | |||||||||||
| 81 | Frank Seitz, L<http://fseitz.de/> | ||||||||||
| 82 | |||||||||||
| 83 | =head1 COPYRIGHT | ||||||||||
| 84 | |||||||||||
| 85 | Copyright (C) 2026 Frank Seitz | ||||||||||
| 86 | |||||||||||
| 87 | =head1 LICENSE | ||||||||||
| 88 | |||||||||||
| 89 | This code is free software; you can redistribute it and/or modify | ||||||||||
| 90 | it under the same terms as Perl itself. | ||||||||||
| 91 | |||||||||||
| 92 | =cut | ||||||||||
| 93 | |||||||||||
| 94 | # ----------------------------------------------------------------------------- | ||||||||||
| 95 | |||||||||||
| 96 | 2 | 1; | |||||||||
| 97 | |||||||||||
| 98 | # eof | ||||||||||