Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hello fellow monks. I have so many questions at this point and since they are related - I posted them all. Of course if you can help on just some of them - great!

For my own needs I wrote a modules that is used as some sort of Database abstraction. Sort of, as it doesn't do all the bells and whistles that SQL::Abstract and DBIx::Abstract do. But on the other hand, it's much simpler and it does a little bit more in some areas.

It can generate following SQL statements:

  • insert - you send it hash/hashref that you get from say CGI.pm or similar, and tell it in which table to insert it. It's "smart" enough to generate SQL that contains only fields that are in both places (in data you sent it, and table).

  • update - same as previous. Only thing that you send it too, is the primary key filed name. But I believe I can change that so that modules itself determines the primary key field.

  • select - but only a simple one, "SELECT _what_ FROM _table_ WHERE _key_field_ = ?". I seem to either need that simple queries, or much more complicated (several tables) that I dont know how to generate with *::Abstract modules - but I may add a little bit more functionality (to be able to specify more after WHERE)

It also has stuff like prepare and execute, connect, disconnect ...etc.

It was all written with MySQL in mind. But I'm now thinking to get it "in shape" and publish it on CPAN - so naturally I want it done that way so that it can be use with other RDBMS's and not just MySQL ...

So finally we got to the question : When you use DBI - are queries like insert/update/select always the same, no matter what DB you are using? And what about things like describe query which I plan to use to get primary key field name ...

Because if it's not - I have a little extra work. My plan is to make a "sub-module", say Module::MyModule is base one, and then Module::MyModule::mysql would be for mysql specific.

A suggestion of name for the module is also welcome. I was thinking of DBIx::Handy?

O and any suggestion on how to ensure that you can easily make an extension in the future. First thing that comes to my mind is that it can return results of SQL query in a form that is suited for HTML::Template LOOP as I need that often. I know that I can write something like DBIx::Handy::HtmlTemplate that would 'use base qw(DBIx::Handy);' and just add such a method - but I don't know how can I ensure that it would be possible to have several of those "plug-ins" at the same time ...

THANK YOU! PS. I already have the book : "Sam Tregar - Writing Perl Modules for CPAN"

In reply to Differences in SQL syntax when using DBI (are there any)? And help on publishing module on CPAN. by techcode

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-20 11:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found