403Webshell
Server IP : 103.119.228.120  /  Your IP : 18.118.144.109
Web Server : Apache
System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User : nobody ( 99)
PHP Version : 5.6.40
Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime
MySQL : ON |  cURL : ON |  WGET : ON |  Perl : ON |  Python : ON |  Sudo : ON |  Pkexec : ON
Directory :  /usr/local/ssl/local/ssl/local/share/perl5/DBIx/MyParsePP/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/local/ssl/local/ssl/local/share/perl5/DBIx/MyParsePP/Query.pm
package DBIx::MyParsePP::Query;
use strict;

use DBIx::MyParsePP::Lexer;
use DBIx::MyParsePP::Rule;

use constant MYPARSE_QUERY_LEXER		=> 0;
use constant MYPARSE_QUERY_ROOT			=> 1;
use constant MYPARSE_QUERY_EXPECTED		=> 2;
use constant MYPARSE_QUERY_ACTUAL		=> 3;

my %args = (
	lexer		=> MYPARSE_QUERY_LEXER,
	root		=> MYPARSE_QUERY_ROOT
);

1;

sub new {
	my $class = shift;

	my $query = bless([], $class);
	my $max_arg = (scalar(@_) / 2) - 1;

        foreach my $i (0..$max_arg) {
		if (exists $args{$_[$i * 2]}) {
			$query->[$args{$_[$i * 2]}] = $_[$i * 2 + 1];
		} else {
			warn("Unkown argument '$_[$i * 2]' to DBIx::MyParsePP::Query->new()");
		}
	}

	return $query;
}

sub getLexer {
	return $_[0]->[MYPARSE_QUERY_LEXER];
}

sub setRoot {
	$_[0]->[MYPARSE_QUERY_ROOT] = $_[1];
}	

sub getRoot {
	return $_[0]->[MYPARSE_QUERY_ROOT];
}

sub root {
	return $_[0]->[MYPARSE_QUERY_ROOT];
}

sub setExpected {
	my $query = shift;
	$query->[MYPARSE_QUERY_EXPECTED] = \@_;
}

sub getExpected {
	return $_[0]->[MYPARSE_QUERY_EXPECTED];
}

sub expected {
	return $_[0]->[MYPARSE_QUERY_EXPECTED];
}

sub setActual {
	$_[0]->[MYPARSE_QUERY_ACTUAL] = $_[1];
}

sub getActual {
	return $_[0]->[MYPARSE_QUERY_ACTUAL];
}

sub actual {
	return $_[0]->[MYPARSE_QUERY_ACTUAL];
}

sub line {
	$_[0]->getLine();
}
	
sub getLine {
	my $query = shift;
	my $lexer = $query->getLexer();
	return $lexer->getLine();
}

sub pos {
	$_[0]->getPos();
}
sub getPos {
	my $query = shift;
	my $lexer = $query->getLexer();
	return $lexer->getPos();
}

sub tokens {
	$_[0]->getTokens();
}

sub getTokens {
	my $query = shift;
	my $lexer = $query->getLexer();
	return $lexer->getTokens();	
}

sub toString() {
	my $query = shift;
	my $root = $query->root();
	return defined $root ? $root->toString() : undef;
}

sub print {
	return $_[0]->toString();
}

sub extract {
	my $query = shift;
	my $root = $query->root();
	return defined $root ? $root->extract(@_) : undef;
}

sub shrink {
	my $query = shift;
	my $root = $query->root();
	return defined $root ? $root->shrink() : undef;
}

sub getWhere {
	return $_[0]->extract('where_clause');
}

sub getGroupBy {
	return $_[0]->extract('group_clause');
}

sub getOrderBy {
	return $_[0]->extract('order_clause');
}

sub getLimit {
	return $_[0]->extract('limit_clause');
}

sub getFrom {
	return $_[0]->extract('table_factor','join_table','derived_table_list','select_from');
}

sub getSelectItems {
	return $_[0]->extract('select_item_list','select_part2','select_init');
}

sub getFields {
	my $root = $_[0]->root();
	return defined $root ? $root->getFields() : undef;
}

sub getTables {
	my $root = $_[0]->root();
	return defined $root ? $root->getTables() : undef;
}

1;

__END__

=pod

=head1 NAME

DBIx::MyParsePP::Query - Query produced by DBIx::MyParsePP

=head1 SYNOPSIS

	use DBIx::MyParsePP;

	my $parser = DBIx::MyParsePP->new();

	my $query = $parser->parse("SELECT 1");

	if (not defined $query->root()) {
		print "Error at pos ".$query->pos()", line ".$pos->line()."\n";
	} else {
		print "Query was ".$query->toString();
	}

=head1 METHODS

C<getLexer()> returns the L<DBIx::MyParsePP::Lexer> object for the string

C<getRoot()> returns a L<DBIx::MYParsePP::Rule> object representing the root of the parse tree

C<toString()> walks the parse tree reconstructs the query using the individual tokens.

C<tokens()> and C<getTokens()> returns a reference to an array containing all tokens parsed as L<DBIx::MyParsePP::Token>
objects. If the parsing failed, the list contains all tokens up to the failure point.

=head1 ERROR HANDLING

On error, C<getRoot()> will return C<undef>. You can call the following methods to determine the error:

C<getExpected()> returns a list of tokens the parser expected to find, whereas C<getActual()> returns the
actual token name that was encountered which caused the error. Please note that C<getActual()> returns a
L<DBIx::MyParsePP::Token> object, whereas C<getExpected()> returns a list of strings, containing
just the token types.

C<getLine()> returns the line number where the error occured. C<getPos()> returns the character position where the
error occured, counting from the beginning of the string, not the begining of the line.

C<getTokens()> can be used to reconstruct the query as it was up to the failure point.

=head1 UTILITY FUNCTIONS

C<getSelectItems()>, C<getFrom()>, C<getWhere()>, C<getGroupBy()>, C<getOrderBy()>, C<getHaving()> return the
respective parts of the parse tree as a L<DBIx::MyParsePP::Rule> object. Depending on the query, the part of the
tree that is being returned may look differently, e.g. C<getFrom()> will return widely different things depending
on how many tables are in the C<FROM> clause, whether there are joins or subqueries. You can then use C<shrink()> and
C<extract()> on the return value to further narrow down on the part of the query you are interested in.

=cut

Youez - 2016 - github.com/yon3zu
LinuXploit