473,387 Members | 3,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

php sql information extraction

Hello,

I am working on auditing interactions with a pgsql database using
php. So my question is how can i go about obtaining the following
information for by only being provided a pgsql query.

1. table(s) affected
2. column(s) affected
3. action performed on data (ie. update, insert, select, delete)
4. previous data for each row and column effected (if data changed or
deleted)
5. new data for each row and column effected (or existing data if data
is being selected)

Any help with this would be greatly appreciated.

Thanks,
Dan

Sep 9 '07 #1
5 1397
Dan99 wrote:
Hello,

I am working on auditing interactions with a pgsql database using
php. So my question is how can i go about obtaining the following
information for by only being provided a pgsql query.
Are you provided the query string, or a resource variable?

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Un ordenador no es un televisor ni un microondas, es una herramienta
compleja.
Sep 9 '07 #2
Dan99 wrote:
Hello,

I am working on auditing interactions with a pgsql database using
php. So my question is how can i go about obtaining the following
information for by only being provided a pgsql query.

1. table(s) affected
2. column(s) affected
3. action performed on data (ie. update, insert, select, delete)
4. previous data for each row and column effected (if data changed or
deleted)
5. new data for each row and column effected (or existing data if data
is being selected)

Any help with this would be greatly appreciated.

Thanks,
Dan
If you're presented with the query, you can parse it for the tables and
columns. You can also determine what the action is.

For the rest you would have to query the database itself - there's no
other way to get it in PHP.

Otherwise you need to check in a postgres group to see if that
information is available to you somewhere.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 9 '07 #3
On Sep 9, 6:15 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Dan99 wrote:
Hello,
I am working on auditing interactions with a pgsql database using
php. So my question is how can i go about obtaining the following
information for by only being provided a pgsql query.
1. table(s) affected
2. column(s) affected
3. action performed on data (ie. update, insert, select, delete)
4. previous data for each row and column effected (if data changed or
deleted)
5. new data for each row and column effected (or existing data if data
is being selected)
Any help with this would be greatly appreciated.
Thanks,
Dan

If you're presented with the query, you can parse it for the tables and
columns. You can also determine what the action is.

For the rest you would have to query the database itself - there's no
other way to get it in PHP.

Otherwise you need to check in a postgres group to see if that
information is available to you somewhere.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Yes, I am provided with the actual query (ex. "INSERT INTO table_bob
(column1, column2) VALUES ('value1', 'value2')"). How would I go
about doing the parsing in php?

Sep 9 '07 #4
Dan99 wrote:
On Sep 9, 6:15 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Dan99 wrote:
>>Hello,
I am working on auditing interactions with a pgsql database using
php. So my question is how can i go about obtaining the following
information for by only being provided a pgsql query.
1. table(s) affected
2. column(s) affected
3. action performed on data (ie. update, insert, select, delete)
4. previous data for each row and column effected (if data changed or
deleted)
5. new data for each row and column effected (or existing data if data
is being selected)
Any help with this would be greatly appreciated.
Thanks,
Dan
If you're presented with the query, you can parse it for the tables and
columns. You can also determine what the action is.

For the rest you would have to query the database itself - there's no
other way to get it in PHP.

Otherwise you need to check in a postgres group to see if that
information is available to you somewhere.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Yes, I am provided with the actual query (ex. "INSERT INTO table_bob
(column1, column2) VALUES ('value1', 'value2')"). How would I go
about doing the parsing in php?
Not easy, but you can check out regular expressions. Strcmp will also work.

Maybe check the library or bookstore for books on parsing strings?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 10 '07 #5
On 10.09.2007 01:03 Dan99 wrote:
On Sep 9, 6:15 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Dan99 wrote:
>>Hello,
I am working on auditing interactions with a pgsql database using
php. So my question is how can i go about obtaining the following
information for by only being provided a pgsql query.
1. table(s) affected
2. column(s) affected
3. action performed on data (ie. update, insert, select, delete)
4. previous data for each row and column effected (if data changed or
deleted)
5. new data for each row and column effected (or existing data if data
is being selected)
Any help with this would be greatly appreciated.
Thanks,
Dan
If you're presented with the query, you can parse it for the tables and
columns. You can also determine what the action is.

For the rest you would have to query the database itself - there's no
other way to get it in PHP.

Otherwise you need to check in a postgres group to see if that
information is available to you somewhere.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Yes, I am provided with the actual query (ex. "INSERT INTO table_bob
(column1, column2) VALUES ('value1', 'value2')"). How would I go
about doing the parsing in php?
You can try PDO_User and its parseSQL function

http://pecl.php.net/package/pdo_user
--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi
Sep 10 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kangol kangoll | last post by:
hi, i've been trying to figure out how to make visual basic start extracting text at a certain line to when i tell it to stop. I am making trying to make a program where it extracts text from a...
15
by: Adam H. Peterson | last post by:
I would like to make a stream or streambuf that tracks the number of lines that have been read and stuff like that (so, for example, when I get an error message, I can ask the stream for the line...
11
by: Khuong Dinh Pham | last post by:
How can i get more information about the exception when using catch(...)? Thx in advance
6
by: david epsom dot com dot au | last post by:
When I open the table directly, I can see "MS PhotoEd.3" Sometimes when the field is selected, I see "Microsoft Photo Editor 3.0 Picture" Is there anyway I can use VBA to get this information? ...
1
by: James Lehman | last post by:
Hello. I want to write a program that reads AutoCAD shape (font) files. They are written with the convention that hexadecimal values have a leading zero and decimal values do not. All numbers...
3
by: dec01louis | last post by:
Hi all, actually i'm now doing something on license plate recognition system for my project. The first step would be the license plate extraction algorithm which means it is needed to extract a...
16
by: EM.Bateman | last post by:
Working on Visual Studio .Net I've implemented a class: #ifndef CONTRIBUTOR_H #define CONTRIBUTOR_H enum Gender {male=1, female, unk}; #include <iostream> #include <iomanip> #include...
5
by: Taras_96 | last post by:
Hi all, Jesse Liberty writes: "cin.get() >>myVarOne >myVarTwo; // illegal The return value of (cin.get() >myVarOne) is an integer, not an iostream object." ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.