List Info

Thread: Long Query in Perl




Long Query in Perl
country flaguser name
United Kingdom
2008-03-17 07:22:18
Hi,

Please let me know if there is any particular length of
query perl
supports.

E.g. I have to execute following 8 queries to do my task or
to execute main
single query.

insert_string = ();
        $insert_string[1]   =   "insert into
SID_FIELD_PERIODS (SURVEYID,
FIELD_PERIOD, OUTPUT_CODE, TLA, SURVEY_YEAR_CODE,
CALENDAR_YEAR_CODE)
values ($surveyid, $field_period, $output_code,
'$survey_tla',
'$survey_year_code', '$calendar_year_code')";
        $insert_string[2]   =   "update
SID_FIELD_PERIODS set
STAGE_CODE='$stage_code', SURV_SAMP=$surv_samp,
USED=$used,
QUOTAS=$quotas, ADDS=$adds, FIELD_STAR='$start_date',
FIELD_FIN='$end_date' where
FIELD_PERIOD=$field_period";
        $insert_string[3]   =   "update
SID_FIELD_PERIODS set
ADVANCE_LETTERS=$advance_letters, POST=$post,
RELEASE_DATE=$release_date,
READY_TO_GO=$ready_to_go, BLAISE_NAME=$blaise_name where
FIELD_PERIOD=$field_period";
        $insert_string[4]   =   "update
SID_FIELD_PERIODS set
BLAISE_VERSION=$blaise_version, COMPLETED=$completed,
SAMPLING_FRAME=$sampling_frame, SF_DATE=$sf_date,
SAMPLE=$sample where
FIELD_PERIOD=$field_period";
        $insert_string[5]   =   "update
SID_FIELD_PERIODS set
SAMPLE_DATE=$sample_date, ADDRESS_LIST=$address_list,
ADDRESS_LIST_DATE=$address_list_date, SAT_READY=$sat_ready
where
FIELD_PERIOD=$field_period";
        $insert_string[6]   =   "update
SID_FIELD_PERIODS set
SAT_DATE=$sat_date, RESPONSE=$response,
SADJ_SAMP=$sadj_samp,
SEFF_SAMP=$seff_samp, SCO_OP=$sco_op, SRESPONSE=$sresponse
where
FIELD_PERIOD=$field_period";
        $insert_string[7]   =   "update
SID_FIELD_PERIODS set
FADJ_SAMP=$fadj_samp, FEFF_SAMP=$feff_samp, FCO_OP=$fco_op,
FRESPONSE=$fresponse, FIELD_END=$field_end,
STAGE_NAME=$stage_name where
FIELD_PERIOD=$field_period";
        $insert_string[8]   =   "update
SID_FIELD_PERIODS set
REISSUES=$reissues, REISSUE_FF=$reissue_ff,
REISSUE_STAR=$reissue_star,
REISSUE_FIN=$reissue_fin,
ORIGSTATEATTEMPT=$origstateattempt,
RESISSTAGEATTEMPT=$resisstageattempt, ACTIVEFP=$activefp
where
FIELD_PERIOD=$field_period";

Then I execute query using a loop.

for ($x = 1; $x <= $num_inserts; $x++)
            {
                print "insert_string_$x =
$insert_string[$x] n" if $debug;
                $db->sql($insert_string[$x]);
                $db->sql("commit");
            }

Is there any way I can do it at one go instead of making so
many small
small queries.

Regards,
Hemant

Thanks & Regards,
Hemant Verma
Xansa, A Steria Company
Office for National Statistics, Southampton.
Mob: 07715759776, Direct CUG: 8889776
Ext: 0132-981-3575


For the latest data on the economy and society consult
National Statistics at http://www.statistics.go
v.uk

************************************************************
*********************


Please Note:  Incoming and outgoing email messages are
routinely monitored for compliance with our policy on the
use of electronic communications
************************************************************
*********************


Legal Disclaimer  :  Any views expressed by the sender of
this message are not necessarily those of the Office for
National Statistics
************************************************************
*********************


The original of this email was scanned for viruses by the
Government Secure Intranet virus scanning service supplied
by Cable&Wireless in partnership with MessageLabs. (CCTM
Certificate Number 2007/11/0032.) On leaving the GSi this
email was certified virus free.
Communications via the GSi may be automatically logged,
monitored and/or recorded for legal purposes.

Re: Long Query in Perl
user name
2008-03-17 09:52:12
On 17/03/2008, Hemant Verma <Hemant.Vermaons.gsi.gov.uk> wrote:

> Please let me know if there is any particular length of
query perl
> supports.


Not that I know of.

E.g. I have to execute following 8 queries to do my task or
to execute main

> single query.


This may or may not be true but unless you show us what you
are seeing that
is causing you to think it is true it is unlikely we can
help you.

BTW - it would look a lot neater (and have better resistance
to SQL
code-injection attacks) with place-holders.

Re: Long Query in Perl
user name
2008-03-17 11:51:54
On 3/17/08, Brian McCauley <nobull67gmail.com> wrote:
>
> On 17/03/2008, Hemant Verma <Hemant.Vermaons.gsi.gov.uk> wrote:
>
> > Please let me know if there is any particular
length of query perl
> > supports.


in the config file there is a variable max_allowed_packet .
i beleive this
is restricting mysql query length, but dont worry if i am
not wrong it is
quite huge.

-- 
> Thanks and kind Regards,
> Abhishek jain
> 07799 328 727
>

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )