$ip=getenv(REMOTE_ADDR);
?>
DBMaker Starting Guides
DBMaker Perl samples
This demo program will show you how to use the basic perl DBI method
to do create table, insert, update, delete and select data from the
table.
- Source: demo.pl
Copy sample program to your local directory:
$ cp ~dbmaker/3.5/samples/Perl/demo.pl .
- Start DBMaker database DBSAMPLE if it has not started yet:
If the "DBSAMPLE" database section has not existed in dbmaker/data/dmconfig.ini,
you need to copy or append the database section into the file dmconfig.ini
and put this file in the local directory.
$ dmserver -u SYSADM DBSAMPLE
- Test demo program
You can copy the demo program to your local directory, and type the
following command:
$ perl demo.pl
This full-text search program will show you how to use perl DBI's attribute
'LongReadLen' to specify the output length of a BLOB field , and it
will use DBMaker's match operator to search the BLOB content.
- Source: perlsearch.pl
Copy sample program to your local directory:
$ cp ~dbmaker/3.5/samples/Perl/perlsearch.pl .
- Start DBMaker database DBSAMPLE if it has not started yet:
If the "DBSAMPLE" database section has not existed in dbmaker/data/dmconfig.ini,
you need to copy or append the database section in the file dmconfig.ini
and put this file into the web server's cgi-bin directory.
$ dmserver -u SYSADM DBSAMPLE
- Install full-text search program on web server
You need to copy full-text search program into the web server's cgi-bin
directory, and change the mode to executable.
Example:
$ cp perlsearch.pl /home/httpd/cgi-bin/
$ chmod +x perlsearch.pl
- Test full-text search program
Steps:
- Type the following in your browser:
http://webserver_ip/cgi-bin/perlsearch.pl
- Type any keyword you want to query in the top frame input query
field, and press the button "Submit Query".
Example:
If you want to find which fortune contain "Necessity" keyword, you can
type "Necessity" in the input query field, and press "Submit Query"
to get the result.
- You will see matched fortune in the left frame, you can click
on the link to see the detailed fortune content in the right frame.
This sample program will show you how to store or fetch a file into
or from the database.
- Source: storefile.pl, fetchfile.pl
Copy sample program to your local directory:
$ cp ~dbmaker/3.5/samples/Perl/storefile.pl .
$ cp ~dbmaker/3.5/samples/Perl/fetchfile.pl .
- Start DBMaker database DBSAMPLE if it has not started yet:
If the "DBSAMPLE" database section has not existed in dbmaker/data/dmconfig.ini,
you need to copy or append the database section into the file dmconfig.ini
and put this file in the local directory.
$ dmserver -u SYSADM DBSAMPLE
- Test storefile.pl program
This program will store the input file into the database with two
different method, one will only store file name as data, the other
will store file content. You can copy the storefile.pl program to
your local directory, and type the following command:
Example:
If you have a file called "test.html" in your local directory, and you want to
store it into database.
$ perl storefile.pl test.html
- Test fetchfile.pl program
After you run "storefile.pl" to store a file into database, now you
can copy the fetchfile.pl program to your local directory, and fetch
the file from the database into another file:
Example:
If you want to fetch the file "test.html" and put it to another file called
"example.html", you can type the following command:
$ perl fetchfile.pl test.html example.html
You will see following message after you run this program:
Retrieve file test.html and Output to File : example.html
You can differ the output file with the original file by the following
command.
$ diff test.html example.html
[ Back To Manuals Index ]
|