Locale: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
<source lang="c">
<source lang="c">
static char *base36enc(long unsigned int value) {
static char *base36enc(long unsigned int value) {
char base36[36] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    char base36[36] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
/* log(2**64) / log(36) = 12.38 => max 13 char + '\0' */
    /* log(2**64) / log(36) = 12.38 => max 13 char + '\0' */
char buffer[14];
    char buffer[14];
unsigned int offset = sizeof(buffer);
    unsigned int offset = sizeof(buffer);


buffer[--offset] = '\0';
    buffer[--offset] = '\0';
do {
    do {
buffer[--offset] = base36[value % 36];
        buffer[--offset] = base36[value % 36];
} while (value /= 36);
    } while (value /= 36);


return strdup(&buffer[offset]); // warning: this must be free-d by the user
    return strdup(&buffer[offset]); // warning: this must be free-d by the user
}
}


static long unsigned int base36dec(const char *text) {
static long unsigned int base36dec(const char *text) {
return strtoul(text, NULL, 36);
    return strtoul(text, NULL, 36);
}
}
</source>
</source>
Line 28: Line 28:
     data_type_code,
     data_type_code,
     data_type_name,
     data_type_name,
     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TM00X00
     M00TM00X00
Line 43: Line 43:
     error_type_code,
     error_type_code,
     error_type_name,
     error_type_name,
     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TM01X00
     M00TM01X00
Line 58: Line 58:
     mime_type_code,
     mime_type_code,
     mime_type_name,
     mime_type_name,
     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TM##X00
     M00TM##X00
Line 80: Line 80:




     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TM02X00
     M00TM02X00
Line 99: Line 99:
     base_flag,
     base_flag,
     base_form,
     base_form,
     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TM03X00
     M00TM03X00
Line 118: Line 118:




     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TM04X00
     M00TM04X00
Line 137: Line 137:




     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TM05X00
     M00TM05X00
Line 157: Line 157:
     field_order,
     field_order,
     field_name,
     field_name,
     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TM06X00
     M00TM06X00
Line 174: Line 174:
     label_name,
     label_name,
     label_value,
     label_value,
     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TM07X00
     M00TM07X00
Line 191: Line 191:
     label_name,
     label_name,
     label_value,
     label_value,
     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TM08X00
     M00TM08X00
Line 216: Line 216:


     lingo_name,
     lingo_name,
     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TL00X00
     M00TL00X00
Line 238: Line 238:


     country_name,
     country_name,
     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TL01X00
     M00TL01X00
Line 261: Line 261:
     crypto_flag,
     crypto_flag,
     notes_name,
     notes_name,
     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TL02X00
     M00TL02X00
Line 284: Line 284:
     iso_alpha2_state_code,
     iso_alpha2_state_code,
     translated_value,
     translated_value,
     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TL03X00
     M00TL03X00
Line 304: Line 304:
     iso_alpha2_state_code,
     iso_alpha2_state_code,
     translated_value,
     translated_value,
     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TL04X00
     M00TL04X00
Line 324: Line 324:
     iso_alpha2_state_code,
     iso_alpha2_state_code,
     translated_value,
     translated_value,
     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TL05X00
     M00TL05X00
Line 344: Line 344:
     iso_alpha2_state_code,
     iso_alpha2_state_code,
     translated_value,
     translated_value,
     entered,
     enter_at,
     enterer,
     enter_by,
     amended,
     amend_at,
     amender
     amend_by
FROM
FROM
     M00TL06X00
     M00TL06X00

Revision as of 16:32, 15 May 2020

static char *base36enc(long unsigned int value) {
    char base36[36] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    /* log(2**64) / log(36) = 12.38 => max 13 char + '\0' */
    char buffer[14];
    unsigned int offset = sizeof(buffer);

    buffer[--offset] = '\0';
    do {
        buffer[--offset] = base36[value % 36];
    } while (value /= 36);

    return strdup(&buffer[offset]); // warning: this must be free-d by the user
}

static long unsigned int base36dec(const char *text) {
    return strtoul(text, NULL, 36);
}

Types

Data

SELECT
    id,
    data_type_code,
    data_type_name,
    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TM00X00

Error

SELECT
    id,
    error_type_code,
    error_type_name,
    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TM01X00

Mime

SELECT
    id,
    mime_type_code,
    mime_type_name,
    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TM##X00

Objects

Tables

SELECT
    id,
    table_code,
    table_name,
    data_type_code,



    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TM02X00

Forms

SELECT
    id,
    form_code,
    form_name,
    data_type_code,
    apps_type,
    base_flag,
    base_form,
    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TM03X00

Reports

SELECT
    id,
    report_code,
    report_name,
    data_type_code,



    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TM04X00

Errors

SELECT
    id,
    error_code,
    error_name,
    error_type_code,



    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TM05X00

Labels

Fields

SELECT
    id,
    field_code,
    table_code,
    field_order,
    field_name,
    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TM06X00

Forms

SELECT
    id,
    label_code,
    form_code,
    label_name,
    label_value,
    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TM07X00

Reports

SELECT
    id,
    label_code,
    report_code,
    label_name,
    label_value,
    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TM08X00

Localizations

Languages

SELECT
    id,
    lingo_code,
    iso_alpha2_lingo_code,
    iso_alpha3_lingo_code,





    lingo_name,
    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TL00X00

Countries

SELECT
    id,
    country_code,
    iso_alpha2_country_code,
    iso_alpha3_country_code,
    longitude,
    latitude,
    altitude,


    country_name,
    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TL01X00

Currencies

SELECT
    id,
    notes_code,
    iso_alpha3_notes_code,
    iso_alpha3_state_code,
    iso_numeric_code,
    official_flag,
    decimal_point,
    notes_symbol,
    crypto_flag,
    notes_name,
    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TL02X00

Translations

Tables

SELECT
    id,
    translated_code,
    table_code,
    field_code,
    field_value,
    iso_alpha2_lingo_code,
    iso_alpha2_state_code,
    translated_value,
    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TL03X00

Forms

SELECT
    id,
    translated_code,
    form_code,
    label_code,

    iso_alpha2_lingo_code,
    iso_alpha2_state_code,
    translated_value,
    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TL04X00

Reports

SELECT
    id,
    translated_code,
    report_code,
    label_code,

    iso_alpha2_lingo_code,
    iso_alpha2_state_code,
    translated_value,
    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TL05X00

Errors

SELECT
    id,
    translated_code,
    error_code,


    iso_alpha2_lingo_code,
    iso_alpha2_state_code,
    translated_value,
    enter_at,
    enter_by,
    amend_at,
    amend_by
FROM
    M00TL06X00

References