Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Do you see a reason why this would not work?

Without seeing what's going on down in CWT::Site_DB, it's hard to say.

A flag goes up when I see code that mixes direct queries with queries that are abstracted away behind classes. It's hard to get a grip on what your connections and statement handles are up to unless they're either all exposed, or all abstracted away behind well unit-tested classes (or at least that's been my experience).

Scanning the code, it shows that you're starting off with an id, querying first to get the corresponding username, then querying and iterating over a session table to look for (a non-expired session?) with the same username

Is that something you could arrange to do in a single query, using JOINs or OUTER JOINs?

Also, it's generally bad form to "SELECT *" in production code unless you're going to use all of the fields. Better to name the field explicitly.


In reply to Re: Sessions, Perl and MySQL by dws
in thread Sessions, Perl and MySQL by powerhouse

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 rifling through the Monastery: (5)
As of 2024-04-23 22:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found