Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 10th, 2003, 05:38 PM
bkroeker bkroeker is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 1 bkroeker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ibserver using a lot of resources

I am trying to connect to a firebird database and execute a stored procedure which returns multiple rows. I could not get this to

work with EXECUTE PROCEDURE so I am using a SELECT * FROM (PROCEDURE NAME). My problem is that my method seems to be using a lot of

system resources. Anyone know if this is correct? After this I use a isc_dsql_fetch call to get all of the data and then I free the

statement and close the transaction.


Brian


To Connect:
{
char m_dpb_buffer[256];
ISC_STATUS m_connStatus[20];
isc_db_handle m_database = NULL;

char *dpb = m_dpb_buffer;

*dpb++ = isc_dpb_version1;

// Set the db user name
*dpb++ = isc_dpb_user_name;
*dpb++ = strlen(DB_USER);
strcpy(dpb, DB_USER);
dpb += strlen(DB_USER);

// set the db password
*dpb++ = isc_dpb_password;
*dpb++ = strlen(DB_PASS);
strcpy(dpb, DB_PASS);
dpb += strlen(DB_PASS);

isc_attach_database(m_connStatus, strlen(DB_NAME), DB_NAME, &m_database, dpb - m_dpb_buffer, m_dpb_buffer);
if(m_connStatus[0] == 1 && m_connStatus[1] != 0)
{
//error here
}
}

To Exec Procedure:
{
ISC_STATUS m_transStatus[20];
isc_stmt_handle m_stmt = NULL;
isc_tr_handle m_trans = NULL;
XSQLDA *m_out_sqlda;

isc_start_transaction(m_status, &m_trans, 1, &m_database, 0, NULL);
isc_dsql_allocate_statement(m_status, &m_database, &m_stmt);

m_out_sqlda = (XSQLDA *)(malloc(XSQLDA_LENGTH(numOParams)));
memset(m_out_sqlda, 0, (XSQLDA_LENGTH(numOParams)));

m_out_sqlda->version = SQLDA_VERSION1;
m_out_sqlda->sqln = numOParams;

isc_dsql_prepare(m_status, &m_trans, &m_stmt, 0, "SELECT * FROM [STORED PROC NAME] (param1, param2, ....)", 1, m_out_sqlda))

if(m_out_sqlda->sqld > m_out_sqlda->sqln)
{
int n = m_out_sqlda->sqld;

FreeOutputData();

m_out_sqlda = (XSQLDA *)(malloc(XSQLDA_LENGTH(n)));
memset(m_out_sqlda, 0, XSQLDA_LENGTH(n));

m_out_sqlda->sqln = n;
m_out_sqlda->version = SQLDA_VERSION1;

isc_dsql_describe(m_status, &m_stmt, 1, m_out_sqlda);
}

for(i=0, var = m_out_sqlda->sqlvar;i<m_out_sqlda->sqld; i++, var++)
{
var->sqldata = (char *)malloc(var->sqllen);
memset(var->sqldata, 0, var->sqllen);

if(var->sqltype & 1)
{
var->sqlind = (short *)malloc(sizeof(short));
*var->sqlind = 0;
}
}

isc_dsql_execute(m_status, &m_trans, &m_stmt, 1, NULL);
}

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > ibserver using a lot of resources

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap