FLAT DB
This
README file regards Flat DB users and this is all information you need to
get Flat DB up!
Installation:
Before you can use Flat DB you may need to install only
one standart module:
That is DBI
(you need
it to run proper DBD::Sprite. On most systems DBI module is already installed!)
After successful installation you have to make your own database:
You have system database with webtools installation(don't use it...create
new one comply to your OS):
Database: webtoolsdb
User: user
Password: pass
Because Password is crypted you can't change it, so you must create your own
database when you use this DB engine for professionl purposes!
To
create your own DB you have to follow next steps:
cd to_your_webtools/db/
rename or move
system DB: webtoolsdb.sdb and it's tables: webtools_sessions.stb
webtools_users.stb to some other place/directory
(we need to use the same names for DB and tables)
cd to_your_webtools/db/structures_directory
and remove old webtoolsdb.sdb (if any)
NOTE: You can choose your own names for database and/or tables, but
you must change that names where is needful! I.e. you need to edit config.pl
and don't forgot to change $sql_user and $sql_pass.
User name and password in config.pl MUST be the same as
webtools_user
and its_password
in code below!
Please
configure follow sections of '../../conf/config.pl':
#[Name_Of_Project]
$projectname = 'webtools'; #
Name of project! (be careful what you write here!)
#[SQL]
$db_support = 'db_flat';
# Driver for Flat DB support
$sql_host = 'localhost'; #
Your address to SQL server.
$sql_port = '3306'; #
Your port of SQL server.
$sql_user = 'webtools_user';
# Don't forget user!
$sql_pass = 'its_password';
# and password
$mysqlbequiet = '1';
# MySQL be QUIET?
#[DataBase]
$sql_database_sessions = $projectname.'db';
# Database name.
$sql_sessions_table = $projectname.'_sessions';
# Session table.
$sql_user_table = $projectname.'_users'; #
Contain all users (and admin too).
NOTE:
Before countinue you must edit webtoolsdb-flat.pl
file, because it contain default admin user name and password.
Now run perl makesdb.pl and insert next
data:
Database name:
webtoolsdb
Database user:
webtools_user
( user)
User
password: its_password
( pass)
Database
path: /full_path_to_webtools/db/
(eg: '/usr/local/apache/cgi-bin/webtools/db/')
Table
file extension (default .stb): ENTER
Record delimiter
(default \r\n): ENTER
Field delimiter
(default ::): ENTER
Press ENTER again to leave script (sometimes ctr+d
and enter) or continue with entering another
DB users.
Now you have to create webtools_sessions and
webtools_users tables, so first copy new database
webtoolsdb.sdb to ../
directory (i.e. to db directory) and then:
run perl webtoolsdb-flat.pl and this must create
for you wished tables!
(please be
convinced that variable $check_module_functions
in config.pl has 'off' value. After execution
of line above please turn $check_module_functions
to 'on' again)
That's all!
--------------------------------------------------------------------------------
Configuration,
step by step example:
Installation of webtools I assume is in /usr/local/apache/cgi-bin/whtml
cd /usr/local/apache/cgi-bin/whtml/
pico conf/config.pl
edit
follow vars to:
$projectname = 'webhtml';
$sql_user = 'mynewuser';
$sql_pass = 'mynewpass';
rm db/webtoolsdb.sdb
rm db/webtools_sessions.stb
rm db/webtools_users.stb
cd db/structures/
perl makesdb.pl
Database
name: webhtmldb (must
be same as $projectname plus 'db' at the end!!!)
Database user: mynewuser
Database password: mynewpass
Database path: /usr/local/apache/cgi-bin/whtml/
Table file ext: ENTER
Record delimit: ENTER
Field delimite: ENTER
Database user: ENTER
cp webhtmldb.sdb ../
pico webtoolsdb-flat.pl
edit
follow vars to:
$admin_user = 'myadmin';
$admin_pass = 'mysecretadminpassword';
pico ../../conf/config.pl
edit follow var to:
$check_module_functions =
'off';
perl webtoolsdb-flat.pl
pico ../../conf/config.pl
edit
follow var to:
$check_module_functions =
'on';
Ok, now write down in your browser:
http://www.your_host.com/cgi-bin/whtml/process.cgi
and see what process.cgi with $check_module_functions = 'on' will show to
you.
You should see "Test DB Engine...looks good" : This line mean that
webtools can connect, insert, select, update and delete rows from your database
throught driver you selected in your config.pl
Note: If you don't configure you config.pl file before you will get errors
and warnnings!
If your config.pl is properly configured you can turn off "check"
variable:
pico ../../conf/config.pl
edit
follow var to:
$check_module_functions =
'off';
Unix/Linux-WIN/DOS
Legend:
cp <-> copy
rm <-> del
pico/vi/mcedit <-> notepad.exe/edit.exe
/ <-> \
--------------------------------------------------------------------------------
Evrything is ok and now you can run your tests/examples...enjoy!
Author:
julian@proscriptum.com