LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-02-2007, 05:45 PM   #1
mschrank99
LQ Newbie
 
Registered: Jun 2006
Posts: 20

Rep: Reputation: 0
Postgresql- non-savable 'sandbox' database?


My boss wants me to make a version of our company's web app that allows a guest user to look around inside the system to see the product features.

Would it be possible to set up a duplicate database to in Postgresql so you cannot really save changes? I would like to have it so I do not have to reprogram anything, the database will accept commands like add and update but it would just be unable to actually save them- the changes would just go nowhere.

Possible?
 
Old 01-02-2007, 05:56 PM   #2
bitva
Member
 
Registered: Dec 2002
Location: Los Angeles
Distribution: Debian
Posts: 72

Rep: Reputation: 15
Gosh, don't know. Somone else may.

You could restore a snapshot of the production database every X number of hours or once a day or something and get it back that way. Just a thought.
 
Old 01-03-2007, 10:06 AM   #3
mschrank99
LQ Newbie
 
Registered: Jun 2006
Posts: 20

Original Poster
Rep: Reputation: 0
Anyone? I need help here- if a knowledgeable person thinks this is impossible, please let me know and I will go with my plan B idea, static HTML output captures of my web application.
 
Old 01-04-2007, 01:50 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
I don't know how big or complex your database is, but maybe you can make temporary copies of the database, or a scaled-down version of it, for use by the web app. I just tried using postgresql's creatdb command to make a copy of a database containing 16 tables each having about 5000 - 10000 rows of 4 to 12 columns. It took 4 seconds on a 2 GHz P4, which might be acceptable on a web server that is not too heavily loaded. The temporary databases could be pruned on a scheduled basis, or tied to your web app's session management system for deletion, or both. Just a thought.

--- rod.
 
Old 01-04-2007, 07:31 PM   #5
mschrank99
LQ Newbie
 
Registered: Jun 2006
Posts: 20

Original Poster
Rep: Reputation: 0
I implemented this solution by adding an IF clause in PHP to the part of my script that actually processed the SQL query, if the $_SESSION['demo'] variable is set to TRUE, then the query does not run.

Somewhat inelegant, since I had to add this clause to three seperate pages, but still it works fine. Good thing I run all my regular queries through one function!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML Form for a postgresql database Evan P. Linux - Software 1 02-12-2007 07:43 AM
postgresql tomcat database connectivity error dsids Linux - General 1 04-20-2006 01:19 AM
Unable to connect To Database...PostgreSQL and PHP Manashi Programming 8 04-05-2006 06:57 AM
LDAP, PostgreSQL Access Control Database PrimusXPrimus Linux - Networking 0 04-12-2004 05:48 PM
postgresql jdbc database server...????????? Sridhar Guntur Linux - Software 1 10-17-2002 02:42 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration