Skip to Main Content

Berkeley DB Family

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

comparison function returns incorrect data

3333809Oct 21 2016 — edited Nov 1 2016

i have modified the examples/c/ex_heap.c to read from one db and insert/delete in another.  For some reason one of the keys that the comparison function receives is either truncated or doesn't match any records in the db.  This is my comparison function

int compare_cmid(dbp, a, b, lob)

        DB *dbp;

        const DBT *a, *b;

        size_t *lob;

{

       //char* temp_a = (char*)a->data;

       //char* temp_b = (char*)b->data;

       //printf("temp_a = %s\n", temp_a);

       //printf("temp_b = %s\n", temp_b);

        char key_a[25];

        char key_b[25];

        memset(key_a,'\0',sizeof(key_a));

        memset(key_b,'\0',sizeof(key_b));

       int ascii_a[256];

       int ascii_b[256];

       int i;

       memset(ascii_a, 0, sizeof(ascii_a));

       memset(ascii_b, 0, sizeof(ascii_b));

       strcpy(key_a, a->data);

       strcpy(key_b, b->data);

       printf("key_a = %s\n", key_a);

       printf("key_b = %s\n", key_b);

       int l_a;

       l_a =  strlen(key_a);

       int l_b;

       l_b = strlen(key_b);

       int value;

       for (i=0; i<l_a; i++) {

         value = key_a[i];

         ascii_a[value]++;

       }

       for(i=0; i<l_b; i++) {

         value = key_b[i];

         ascii_b[value]++;

        }

       for(i=0; i<256; i++) {

         if(ascii_a[i] > ascii_b[i]) {

             return 1;

         } else if (ascii_a[i] < ascii_b[i]) {

             return -1;

         }

       }

       return 0;

}

b is often messed up.  I'm setting the comparison function before opening the db and it gets called fine but just not with the expected keys.  Please assist.

This post has been answered by userBDBDMS-Oracle on Oct 21 2016
Jump to Answer

Comments

Try setting REPORTS_ENHANCED_BIDIHANDLING=YES to use the new BIDI mechanism.
Thanks, Suresh

User_AWHMX

Dear Mr. Suresh,
thanks for your reply. do i need to keep the above 2 parameters also or above as you mentioned that is enough?
REPORTS_ENHANCED_BIDIHANDLING=YES

User_AWHMX, Include all 3 parameters

User_AWHMX

Mr. Suresh,
After i did also its changing for all the fields as per attachment. actually i just want to change the price field only in arabic numbers and others should be normal only. But if i add all 3 its changing whole invoice.
image.png

Has the report been built in that way to show ONLY Price field in Arabic and others are in English Numerical?
Is the value database derived or static/computed in Reports?
What is the NLS_LANG used during Build/recompile and runtime?
Checking if PDF subsetting is already enabled.
https://docs.oracle.com/cd/E48391_01/doc.11120/e24479/pbr_pdf004.htm#RSPUB23427
Thanks, Suresh

User_AWHMX

Dear Mr. Suresh,
Has the report been built in that way to show ONLY Price field in Arabic and others are in English Numerical?
No thats what i want to know that how can i do that.
Is the value database derived or static/computed in Reports?
these values from the database only.
What is the NLS_LANG used during Build/recompile and runtime?
AMERICAN_AMERICA.AR8MSWIN1256
Checking if PDF subsetting is already enabled. Yes its enabled.

When you say database columns, are the values stored as multibyte/Arabic in the database?
What are the font mappings for PDF subsetting?
Thanks, Suresh

User_AWHMX

no its not stored in arabic. its numeric numbers only.
i think if we add new arabic font its working in test environment. i will test in produstion also.
helvetica..Oblique.Medium = "Sadvocra.ttf"
helvetica..Plain.Medium = "Sadc128d.ttf"
helvetica...Bold = "CarolinaBar-B39-25F2-Normal.ttf"

1 - 8
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 29 2016
Added on Oct 21 2016
23 comments
1,118 views