![]() Topic awaiting preservation: Need help with SQL Pronto!!!!!! Please... |
|
|---|---|
| Author | Thread |
|
Bipolar (III) Inmate From: you tell me |
posted 01-14-2008 12:27
Hi guys need help Pronto right here... I have ok two tables. One is basically an email repository and contains email messages - teh other table is an address book and well just contains email addresses. |
|
Maniac (V) Mad Scientist with Finglongers From: Germany |
posted 01-14-2008 13:14
yeah. Don't do this in pure sql. |
|
Paranoid (IV) Inmate From: Switzerland |
posted 01-14-2008 13:42
Have to disagree, having worked on large-large scale databases very recently : pre-fetch as much as possible inside the database engine itself. |
|
Maniac (V) Mad Scientist with Finglongers From: Germany |
posted 01-14-2008 14:11
I' assumed it to still be parity's roundcube project. code: $arrMails = query_db_fetch_array( "select header_to, header_from... from mails where Whatever");
$arrAddresses = [];
foreach ( $arrMails as $arrMail)
{
$arrTo = split($arrMail['to'],','); //and pray for merce there never is a , in an e-mail address... the rfc is to large for me to exclude it.
foreach ( $arrTo as $strAddress)
$arraddresses[$strAddress] = true;
}
$arrAddresses = array_keys($arrAddresses);
$arrAddresses = array_map('mysql_escape_string',$arrAddresses);
$strAddresses = add quoting to each field..., and implode on (',')
$strQuery = "select address, count(address) from addressbook where address in ({$strAddresses})";
...
do something for those with count == 0
|
|
Paranoid (IV) Inmate From: Switzerland |
posted 01-14-2008 14:43
What were Tao's words already? "Mellowest prowess mister Prime". [off topic]I'd certainly like to collaborate |
|
Bipolar (III) Inmate From: you tell me |
posted 01-15-2008 12:06
Hmmm.... |
|
Paranoid (IV) Inmate From: Switzerland |
posted 01-15-2008 12:54
I understood the original request incorrectly, but : |
|
Maniac (V) Mad Scientist with Finglongers From: Germany |
posted 01-15-2008 13:06
huh - why to arrays parity? |
|
Paranoid (IV) Inmate From: Switzerland |
posted 01-15-2008 14:10
I am not interested in any form of rivalry in my life - I am interested in trying to give options quote:
|
|
Bipolar (III) Inmate From: you tell me |
posted 01-15-2008 14:17
Well.. the thing is that since it is the same roundcubemail project... and thats why I'm actually trying to minimise if not avoid tampering with the roundcube db for fear of messing it somewhere else... apart from that I might give it a go on another version nwo that I've got tortoiseSVN up and running |
|
Paranoid (IV) Inmate From: Switzerland |
posted 01-15-2008 14:38
|