Subject | time for 1600000 select |
---|---|
Author | pluto.pippo66 |
Post date | 2012-02-06T17:17:38Z |
Hi all
I have aproblem with select fuction
this is my function in C :
int ReadValDbase(ISC_STATUS_ARRAY status,char* namedb,char* selstr,char* value)
{
char empdb[128];
char __Ex_value[128];
SQL_VARCHAR(20) field_name;
isc_tr_handle trans = NULL; /* transaction handle */
isc_stmt_handle stmt = NULL; /* statement handle */
XSQLDA * sqlda;
long fetch_stat, blob_stat,long_field_name;
short flag0 = 0,
flag1 = 0,
flag2 = 0;
short nullind;
int int_field_name,success;
memset(__Ex_value,'\0',128);
memset(__value_stmt_rec,'\0',1024);
if (isc_start_transaction(status, &trans, 1, &DB, 0, NULL))
{
printf("Errore\n");
ERREXIT(status, 1);
}
isc_print_status(status);
if (isc_dsql_allocate_statement(status, &DB, &stmt))
{
printf("Errore\n");
ERREXIT(status, 1);
}
isc_print_status(status);
sqlda = NULL;
sqlda = (XSQLDA *) malloc(XSQLDA_LENGTH(1));
sqlda->sqln = 1;
sqlda->sqld = 1;
sqlda->version = 1;
if (isc_dsql_prepare(status, &trans, &stmt, 0, selstr, 1, sqlda))
{
printf("Errore\n");
ERREXIT(status, 1);
}
isc_print_status(status);
sqlda->sqlvar[0].sqldata = (char *)&long_field_name;
sqlda->sqlvar[0].sqltype = SQL_LONG + 1;
sqlda->sqlvar[0].sqlind = &nullind;
if(isc_dsql_execute(status, &trans, &stmt, 1, NULL))
{
printf("Errore\n");
ERREXIT(status, 1);
}
isc_print_status(status);
long_field_name = 0L;
sprintf(__value_stmt_rec,"%s",value);
sprintf(__Ex_value,"%s",value);
while ((fetch_stat = isc_dsql_fetch(status, &stmt, 1, sqlda)) == 0)
{
;
}
isc_print_status(status);
if( long_field_name ){
success = 0;
sprintf(__value_stmt_rec,"%7.7d",long_field_name);
}
else{
success = 1;
}
if ( fetch_stat != 100L )
{
printf("Errore\n");
ERREXIT(status, 1);
}
if ( isc_dsql_free_statement(status, &stmt, DSQL_close) )
{
printf("Errore\n");
ERREXIT(status, 1);
}
isc_print_status(status);
if (isc_commit_transaction(status, &trans) )
{
printf("Errore\n");
ERREXIT(status, 1);
}
isc_print_status(status);
sqlda = NULL;
free(sqlda);
return success;
}
the problem is 11 minuti for 1600000 select
do you think is the right time ?
thanks in advance.
Mike
I have aproblem with select fuction
this is my function in C :
int ReadValDbase(ISC_STATUS_ARRAY status,char* namedb,char* selstr,char* value)
{
char empdb[128];
char __Ex_value[128];
SQL_VARCHAR(20) field_name;
isc_tr_handle trans = NULL; /* transaction handle */
isc_stmt_handle stmt = NULL; /* statement handle */
XSQLDA * sqlda;
long fetch_stat, blob_stat,long_field_name;
short flag0 = 0,
flag1 = 0,
flag2 = 0;
short nullind;
int int_field_name,success;
memset(__Ex_value,'\0',128);
memset(__value_stmt_rec,'\0',1024);
if (isc_start_transaction(status, &trans, 1, &DB, 0, NULL))
{
printf("Errore\n");
ERREXIT(status, 1);
}
isc_print_status(status);
if (isc_dsql_allocate_statement(status, &DB, &stmt))
{
printf("Errore\n");
ERREXIT(status, 1);
}
isc_print_status(status);
sqlda = NULL;
sqlda = (XSQLDA *) malloc(XSQLDA_LENGTH(1));
sqlda->sqln = 1;
sqlda->sqld = 1;
sqlda->version = 1;
if (isc_dsql_prepare(status, &trans, &stmt, 0, selstr, 1, sqlda))
{
printf("Errore\n");
ERREXIT(status, 1);
}
isc_print_status(status);
sqlda->sqlvar[0].sqldata = (char *)&long_field_name;
sqlda->sqlvar[0].sqltype = SQL_LONG + 1;
sqlda->sqlvar[0].sqlind = &nullind;
if(isc_dsql_execute(status, &trans, &stmt, 1, NULL))
{
printf("Errore\n");
ERREXIT(status, 1);
}
isc_print_status(status);
long_field_name = 0L;
sprintf(__value_stmt_rec,"%s",value);
sprintf(__Ex_value,"%s",value);
while ((fetch_stat = isc_dsql_fetch(status, &stmt, 1, sqlda)) == 0)
{
;
}
isc_print_status(status);
if( long_field_name ){
success = 0;
sprintf(__value_stmt_rec,"%7.7d",long_field_name);
}
else{
success = 1;
}
if ( fetch_stat != 100L )
{
printf("Errore\n");
ERREXIT(status, 1);
}
if ( isc_dsql_free_statement(status, &stmt, DSQL_close) )
{
printf("Errore\n");
ERREXIT(status, 1);
}
isc_print_status(status);
if (isc_commit_transaction(status, &trans) )
{
printf("Errore\n");
ERREXIT(status, 1);
}
isc_print_status(status);
sqlda = NULL;
free(sqlda);
return success;
}
the problem is 11 minuti for 1600000 select
do you think is the right time ?
thanks in advance.
Mike