Hi ..
I needed some help with the following loop. All I am doing here is dividing the 
record set into some fixed size chunks(25000 here) and then copyin the 25000 
records from the whole records-set($hvulnrecords(SIZE: APPROX 200000 
RECS..which is an associative array)  into  another array $parts. After that I 
insert 25000 records using some Sqlite (INSERT statements)....             
 
Output halts after ...
 
No. of hostvuln chunks7
Count of vuln recs:25000

 
 
 
 
Code::
---------------------
 
                $chunkcnt = intval(count($hvulnrecords)/25000);
                echo "\nNo. of hostvuln chunks" . $chunkcnt;
                if($chunkcnt>0)
                {
                        $begin = 0;
                        $end = 0;
                        for($k = 0; $k < $chunkcnt; $k++)
                        {
                                $end += 25000;
                                $i = 0;
                                $parts = array();
                                for($j = $begin;$j < $end; $j++)
                                {
                                        $parts[$i] = $hvulnrecords[$j];
                                        $i++;
                                }
                                
if($this->_hostvuln->insertTransaction($parts))//add it
                                {}
                                else
                                {
                                        echo "\nFailed insert for hostvuln: 
Chunk no-" . $k;
                                }
                                $begin = $j;
                        }
                        //copy remaining
                        $i = 0;
                        $parts = array();
                        for($j = $end;$j<count($hvulnrecords);$j++)
                        {
                                $parts[$i] = $hvulnrecords[$j];
                                $i++;
                        }
                        if($this->_hostvuln->insertTransaction($parts))//add it
                        {}
                        else
                        {
                               echo "\nFailed insert for hostvuln: remaining.";
                        }
                }
                else
                {
                        
if($this->_hostvuln->insertTransaction($hvulnrecords))//add it
                        {}
                        else
                        {
                               echo "\nFailed insert for hostvuln.";
                        }
                }
.
.
.
function insertTransaction($records)
{
                echo "\nCount of vuln recs:" . count($records);
                $sql = 'BEGIN;';
                foreach ($records as $num => $record)
                {
                           .//assign stmts and call Insertquery
                           db->query($sql);
                           //check for lastError..if none commit or rollback
                }
}

ps shows...program is sleeping 
And ..gdb shows it errored out...pasting the gdb output..below
 
No symbol table info available.
#12 0x08129561 in php_error_cb (type=7901952, error_filename=0x400 <Address 
0x400 out of bounds>, error_lineno=679586864,
    format=0xbfe9a83c "\036", args=0x4000000 <Address 0x4000000 out of bounds>) 
at /home/shruti/php-5.0.2/main/main.c:645
        buffer = 0x4e <Address 0x4e out of bounds>
        buffer_len = 33
        display = 0
Previous frame identical to this frame (corrupt stack?)

Could someone please help me? Will wait for a reply...
Thanks a lot!
 
Regards,
Shruti.
 


                
---------------------------------
Do you Yahoo!?
 Take Yahoo! Mail with you! Get it on your mobile phone.

Reply via email to