sqlcxt/malloc error


 
Thread Tools Search this Thread
Top Forums Programming sqlcxt/malloc error
# 1  
Old 10-29-2004
sqlcxt/malloc error

Bit of a long one this

I am running the code below and I am getting a bus error when trying to make a struct member equal a variable. I stepped through the program in dbx and got the following. The structs of interest is raw_txns and la_ins_bkhead

Entered while loop in process()
t@1 (l@1) stopped in process at line 748 in file "normalise_raw_data.c"
748 sqlstm.sqpadto = sqlstm.sqadto;
(dbx) print raw_txns
raw_txns = {
h_store_id = 0x1003e47a0
h_txn_time = 0x1003e95d0
h_trans_date = 0x1003ed080
h_till_bank_indicator = 0x1003f6310
h_location_id = 0x1003fb140
h_cashier_id = 0xffffffff7d406cd8
h_trans_void = 0xffffffff7ce00b98
h_no_sale = 0xffffffff7ce00030
i_item_code = 0xffffffff7ce00db0
i_cancel_item = (nil)
i_subtract_item = 0xffffffff7ce00b98
i_unknwn_item = 0xffffffff7d600a68
i_complntry_item = (nil)
i_linked_item_ind = (nil)
i_department_mode = 0xf00000000
i_extend_price = (nil)
i_quantity = 0xffffffff7fffff97
i_unit_price = 0x500000002
i_at_for_qty = 0xffffffff7f724908
i_price_from_plu = 0x11c3a0
i_keyed_price = 0x2000
i_system_reduction = 0xffffffff7f7249d8
i_reduction_indicator = (nil)
i_refund_flag = (nil)
i_refund_reason_code = (nil)
i_item_entry_indicator = 0x18
dept = (nil)
class = (nil)
sku = (nil)
joint_venture_ind = (nil)
catchweight_ind = (nil)
}
(dbx) print la_ins_bkhead
la_ins_bkhead = {
txn_key = 0x100343c10
h_store_id = 0x100348a40
h_txn_time = 0x10034d870
h_trans_date = 0x100351320
h_till_bank_indicator = 0x10035a5b0
h_location_id = 0x10035f3e0
pos_txn_no = 0x100364210
h_cashier_id = 0x100369040
h_trans_void = 0x10036de70
h_no_sale = 0x10036f210
}
(dbx) step
t@1 (l@1) stopped in process at line 750 in file "normalise_raw_data.c"
750 sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
(dbx) print raw_txns
raw_txns = {
h_store_id = 0x1003e47a0
h_txn_time = 0x1003e95d0
h_trans_date = 0x1003ed080
h_till_bank_indicator = 0x1003f6310
h_location_id = 0x1
h_cashier_id = 0x1
h_trans_void = 0x1
h_no_sale = 0x1
i_item_code = 0x1
i_cancel_item = 0x1
i_subtract_item = 0x1
i_unknwn_item = 0x1
i_complntry_item = 0x1
i_linked_item_ind = 0x1
i_department_mode = 0x1
i_extend_price = 0x1
i_quantity = 0x1
i_unit_price = 0x1
i_at_for_qty = 0x1
i_price_from_plu = 0x1
i_keyed_price = 0x1
i_system_reduction = 0x1
i_reduction_indicator = 0x1
i_refund_flag = 0x1
i_refund_reason_code = 0x1
i_item_entry_indicator = 0x1
dept = 0x1
class = 0x1
sku = 0x1
joint_venture_ind = 0x1
catchweight_ind = 0x1
}
(dbx) print la_ins_bkhead
la_ins_bkhead = {
txn_key = 0x1
h_store_id = 0x1
h_txn_time = 0x1
h_trans_date = 0x1
h_till_bank_indicator = 0x1
h_location_id = 0x1
pos_txn_no = 0x1
h_cashier_id = 0x1
h_trans_void = 0x1
h_no_sale = 0x1
}


Does anyone know why the memory address for the most part are invalid after the sqlcxt statement. The raw_txns is a wierd one as only part of the struct is errored as the first four members are fine.

The sql the fetch pulls back is fine as I have checked this by running the sql myself.

Code is attached. Note the CALLOC functions are just wrappers for malloc. Any help is much appreciated.
# 2  
Old 10-29-2004
Your code is not attached.

Are you using indicator variables for the fetch?
ie.,
Code:
EXEC SQL 
  FETCH mycursor into 
      :raw_tns :indicatorstruct;

# 3  
Old 10-29-2004
I used,

EXEC SQL
FOR :PL_COMMIT_MAX_CTR
FETCH c_fetch_raw_txn INTO
:raw_txns.h_store_id,
etc


I attached the code. Or at least I think I did.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help with malloc()

Good day! I'm a newbie in C. I'm trying to get an unlimited input from the user using malloc then printing the inputs after the user presses enter. My code works, but there's a warning that I don't know how to fix. Please help me. Thank you. Here's my code: #include <stdio.h> #include... (6 Replies)
Discussion started by: eracav
6 Replies

2. Programming

help with malloc [solved]

Hi i found code in google how to malloc an 2D array and i tried that : #include<stdio.h> #include<stdlib.h> int **A; int **B; int main(int argc,char *argv) { printf("name of text : %s\n",argv); //read arrays int i,j; int l,m; int M,n; FILE *fp; fp=fopen(argv,"r"); ... (0 Replies)
Discussion started by: giampoul
0 Replies

3. Programming

Segmentation Fault at sqlcxt

Hi all, After compiling my Pro-c program, while trying to run it I am receving segmentation violation at- sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn); The exact error is- Program received signal SIGSEGV, Segmentation fault. 0x7af99090 in _sigfillset+0x5c0 () from /usr/lib/libc.2 ... (4 Replies)
Discussion started by: justarrived
4 Replies

4. UNIX for Advanced & Expert Users

database connection (unresolved sqlcxt)

i have a little pro*c code (as shown below) to connect an oracle database. (in unix solaris platform) in the preprocessor compilation step everything is ok. but when i try to compile the code using cc i get the error below: ld: Unresolved: sqlcxt i think there is a problem while linking... (3 Replies)
Discussion started by: gfhgfnhhn
3 Replies

5. Programming

malloc()

Some one please explain me what is Dynamic memory allocation and the use of malloc() function.How do we allocate memory dynamically and also the other way? (3 Replies)
Discussion started by: rash123
3 Replies

6. AIX

Catastrophe in malloc: sbrk() error 1b

Hi , I am facing some problem with C++ compiler ( version 5.0 ) on AIX machine ( 4.3 version). When i run the following compile command, cc -v -D< CONDITIONAL COMPILATION MACROS > -I< HEADER FILES SEARCH PATH >-qlanglvl=extended -g -qnoro -qnoroconst -c test_suman.cpp For security... (0 Replies)
Discussion started by: suman_jakkula
0 Replies

7. Programming

When to use Malloc?

Hi! I hope this is the correct forum to post the question even if I'm a newbie... I am a C-newbie (and really on the edge to be a C-addict ;) ) and have a question. When should I use malloc? To state it differently, when should I NOT use malloc? For instance, if I have an array of... (5 Replies)
Discussion started by: Tonje
5 Replies

8. UNIX for Dummies Questions & Answers

catastrophe in malloc error

Can someone tell me what this means????? :confused: Catastrophe in malloc: sbrk()error 1b IOT/Abort trap (coredump) Thanks! (1 Reply)
Discussion started by: PAUL_ETTE
1 Replies

9. Programming

malloc for 1 Mb error.

Hi All! Does some one know I am under UNIX system can not allocate more then 1 Mb memory? It broke program down. Any information would be greatly appreciated. Thanks. (2 Replies)
Discussion started by: prodigal
2 Replies

10. Programming

malloc

hello sir since by mentioning a integer pointer and storing the integers by incrementing the pointer value then what is the purpose of malloc? u can decalre it as in t *p; several integers can be stored by incrementing the value of p, hence what is the diffrence between this... (2 Replies)
Discussion started by: rajashekaran
2 Replies
Login or Register to Ask a Question