CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI:
Which DBI to use for this project?

 



miniCruzer
Novice

Oct 8, 2010, 5:33 PM

Post #1 of 4 (3570 views)
Which DBI to use for this project? Can't Post

A few friends and I are writing an IRC Bot in Perl, and want to incorporate a database file. At the moment, its using text files to read and write, which can become very slow when reading large databases. We need something that is quick, and light (not bucketloads of code).

The database (as of now) includes 4 keys, that are: Channel, Admin, Owner, "ATS".

Channels are prefixed with "#". Admins are prefixed with "A:", Owners are prefixed with "O:", and "ATS" is prefixed with "ATS".

For example, if someone adds a channel runtime, it writes that channel to the database, as

Code
C:#NewChannel

If someone adds an ATS command, it writes as

Code
ATS:Call:Response can be more than 1 word

It deletes these keys by matching with the prefix, and loads the keys for runtime use with prefixes into arrays and/or hashes.

It would be nice to be able to attach extra data to these values, perhaps in the following way:

Code
channels { 
"#chan1" {
createdby = "user",
createdon = "date",
bans = {
"*!*@host1.com",
"*!*@host2.com",
},
autoop = {
"this!user@*",
"thisother!user@*",
},
"#chan2" {
createdby = "user",
createdon = "user",
modes = "tnsirz",
},
}



FishMonger
Veteran / Moderator

Oct 9, 2010, 7:54 AM

Post #2 of 4 (3563 views)
Re: [miniCruzer] Which DBI to use for this project? [In reply to] Can't Post

DBI - Database independent interface for Perl
http://search.cpan.org/~timb/DBI-1.615/DBI.pm

DBD::mysql - MySQL driver for the Perl5 Database Interface (DBI)
http://search.cpan.org/~capttofu/DBD-mysql-4.017/lib/DBD/mysql.pm

Tie::Hash::DBD, tie a plain hash to a database table
http://search.cpan.org/~hmbrand/Tie-Hash-DBD-0.07/lib/Tie/Hash/DBD.pm

Tie::DBI - Tie hashes to DBI relational databases
http://search.cpan.org/~toddr/Tie-DBI-1.05/lib/Tie/DBI.pm


(This post was edited by FishMonger on Oct 9, 2010, 7:56 AM)


miniCruzer
Novice

Oct 10, 2010, 1:20 PM

Post #3 of 4 (3523 views)
Re: [FishMonger] Which DBI to use for this project? [In reply to] Can't Post

Thanks for the reply. SQLite seems to be doing the trick, though!


FishMonger
Veteran / Moderator

Oct 10, 2010, 1:28 PM

Post #4 of 4 (3521 views)
Re: [miniCruzer] Which DBI to use for this project? [In reply to] Can't Post


In Reply To
Thanks for the reply. SQLite seems to be doing the trick, though!


Do you mean DBD::SQLite - Self-contained RDBMS in a DBI Driver http://search.cpan.org/~adamk/DBD-SQLite-1.31/lib/DBD/SQLite.pm?
Since your opening post didn't say which database you were using or planning on using, I couldn't be sure which DBD module to point out.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives