mIRC Home    About    Download    Register    News    Help

Print Thread
MySQL Help #137834 20/12/05 04:48 PM
Joined: Mar 2005
Posts: 20
E
Erebus Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Mar 2005
Posts: 20
Hello,

I'm trying to incorporate MySQL into my mIRC work to make it much easier to handle than the current flat-file based system I have at the moment.

I'm using Hammer's ADODB MySQL guidance on the forum as reference and have managed to come up with a system that works. However, there are a couple of things I can't work, and I'd greatly appreciate it if I could have some help with them.

1) How can I get the total number of records returned in a recordset object? (RecordCount doesn't work, presumably because the cursor is in the wrong mode, but I can't figure out how to change that)

2) How can I get the total number of fields returned in a recordset object, and hencel, how can I get the names of each field?

3) Is it possible to get a list of all com objects currently open? I'm sure this is either really simple or impossible, but I couldn't for the likes of me find it.

Thanks a lot smile

Re: MySQL Help #137835 20/12/05 05:50 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
If an object that you've dispatched to is a collection, then you can find the total amount of elements in the collection with $comval(<col>,0), although I must say, mIRC still doesn't always do this.

Often you can issue the count property like:

!.echo -q $com(<obj>,count,2 or 3)
echo -a $com(<obj>).result

Regarding the recordset, you're supposed to dispatch to a fields collection, something like:

!.echo -q $com(objset,fields,2,dispatch* fields)

Then:

if ($com(fields)) echo -a Total: $comval(fields,0)

or:

if ($com(fields)) { !.echo -q $com(fields,count,3) | echo -a Total: $com(fields).result }

This is of course untested, I have no motivation to get into ADO atm.


For a list of open objects:

alias listcoms var %i = 1 | while ($com(%i) != $null) { echo -a %i - $ifmatch | inc %i }

Anything you want to know about ADO, you will find at MSDN, more specifically take a look at the ADO object model. Check there before asking questions here, because you will find everything you need to know there.

I'd give you more help myself, but these days I must focus on uni instead of mIRC.

Btw, don't forget there are also DLL's to control databases. I mention it because I remember vaguely reading about there being a huge memory leak when using the mysql COM objects.


Gone.