deibyz has asked for the wisdom of the Perl Monks concerning the following question:

Hello Folks,

I'm working on a few scripts that work against a Sybase DB. I'm using Sybase::DBlib, beacuse I don't have acces to DBD::Sybase modules. I use the nsql wrapper function, that returns an AoH with all the results from the query passed as argument. The problem is that I don't have permissions for more than a few views/procs that don't return exactly what I want.

Currently I have some subs that return hashes whithout duplicates, only a phew columns, etc... What I'd like is be able to execute some simple pseudo-SQL queries against those AoH. Is there anything already done? Do you think it's going to worth the effort of writing a module if there isn't anything?

Thanks in advance and sorry for my poor English.
deibyz

Replies are listed 'Best First'.
Re: SQL against a AoH?
by jZed (Prior) on Jul 26, 2004 at 15:05 UTC
    I don't have acces to DBD::Sybase modules
    It's difficult for me to imagine a situation in which this couldn't be solved, if you can tell us what the problem is, perhaps we can offer suggestions.
    What I'd like is be able to execute some simple pseudo-SQL queries against those AoH.
    DBD::AnyData supports SQL queries on an AoA, so a line or two of code would allow it to work on AoH. It's a pure perl module so installation is a simple matter of copying files.
Re: SQL against a AoH?
by mpeppler (Vicar) on Jul 26, 2004 at 15:11 UTC
    In your case using DBD::Sybase vs. Sybase::DBlib is pretty much irrelevant - both will return the same data for you.

    jZed's suggestion to use DBD::AnyData is a good one, but remember that you will need to have DBI installed for this to work.

    Michael

      but remember that you will need to have DBI installed for this to work
      Although if there's some unsolvable reason you can't compile DBI, you can use DBI::PurePerl which comes in the DBI distribution and can be installed by simply copying files and, as far as DBD::AnyData goes, behaves pretty much identically to the compiled DBI.
      jZed's suggestion to use DBD::AnyData is a good one, but remember that you will need to have DBI installed for this to work.

      I think I can get DBI installed, and maybe DBD::AnyDate. The issue with DBD::Sybase was that Sybase::DBlib is the "standard", so SysAdmin dind't want to install anything else. Thanks for the soon reply and for pointing me to that module, I think I have to improve my CPAN search abilities =(.

        DBD::Sybase vs. Sybase::DBlib...
        You should really be using Sybase::CTlib if you are not using DBD::Sybase. The reason is that it is based on Sybase's Client Library API, rather than the older DB-Library. While DB-Library is "supported", it is no longer enhanced, and you may be running into problems if your dataservers start using some of the newer features (such as wide varchar support, for example.)

        Michael