~pbxt-core/pbxt/rc4

« back to all changes in this revision

Viewing changes to src/myxt_xt.cc

  • Committer: Barry.Leslie at PrimeBase
  • Date: 2009-07-27 22:39:29 UTC
  • mto: This revision was merged to the branch mainline in revision 678.
  • Revision ID: barry.leslie@primebase.com-20090727223929-jc283putlzctt5ps
PBMS compatibility changes for PBMS version 0.5.09-alpha and later.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
#include "myxt_xt.h"
53
53
#include "strutil_xt.h"
54
54
#include "database_xt.h"
55
 
#ifdef XT_STREAMING
56
 
#include "streaming_xt.h"
57
 
#endif
58
55
#include "cache_xt.h"
59
56
#include "datalog_xt.h"
60
57
 
2945
2942
        return &my_charset_utf8_general_ci;
2946
2943
}
2947
2944
 
2948
 
#ifdef XT_STREAMING
2949
 
xtPublic xtBool myxt_use_blobs(XTOpenTablePtr ot, void **ret_pbms_table, xtWord1 *rec_buf)
2950
 
{
2951
 
        void    *pbms_table;
2952
 
        XTTable *tab = ot->ot_table;
2953
 
        u_int   idx = 0;
2954
 
        Field   *field;
2955
 
        char    *blob_ref;
2956
 
        xtWord4 len;
2957
 
        char    in_url[PBMS_BLOB_URL_SIZE];
2958
 
        char    *out_url;
2959
 
 
2960
 
        if (!xt_pbms_open_table(&pbms_table, tab->tab_name->ps_path))
2961
 
                return FAILED;
2962
 
 
2963
 
        for (idx=0; idx<tab->tab_dic.dic_blob_count; idx++) {
2964
 
                field = tab->tab_dic.dic_blob_cols[idx];
2965
 
                if ((blob_ref = mx_get_length_and_data(field, (char *) rec_buf, &len)) && len) {
2966
 
                        xt_strncpy(PBMS_BLOB_URL_SIZE, in_url, blob_ref, len);
2967
 
 
2968
 
                        if (!xt_pbms_use_blob(pbms_table, &out_url, in_url, field->field_index)) {
2969
 
                                xt_pbms_close_table(pbms_table);
2970
 
                                return FAILED;
2971
 
                        }
2972
 
 
2973
 
                        if (out_url) {
2974
 
                                len = strlen(out_url);
2975
 
                                mx_set_length_and_data(field, (char *) rec_buf, len, out_url);
2976
 
                        }
2977
 
                }
2978
 
        }
2979
 
        *ret_pbms_table = pbms_table;
2980
 
        return OK;
2981
 
}
2982
 
 
2983
 
xtPublic void myxt_unuse_blobs(XTOpenTablePtr XT_UNUSED(ot), void *pbms_table)
2984
 
{
2985
 
        xt_pbms_close_table(pbms_table);
2986
 
}
2987
 
 
2988
 
xtPublic xtBool myxt_retain_blobs(XTOpenTablePtr XT_UNUSED(ot), void *pbms_table, xtRecordID rec_id)
2989
 
{
2990
 
        xtBool                          ok;
2991
 
        PBMSEngineRefRec        eng_ref;
2992
 
 
2993
 
        memset(&eng_ref, 0, sizeof(PBMSEngineRefRec));
2994
 
        XT_SET_DISK_8(eng_ref.er_data, rec_id);
2995
 
        ok = xt_pbms_retain_blobs(pbms_table, &eng_ref);
2996
 
        xt_pbms_close_table(pbms_table);
2997
 
        return ok;
2998
 
}
2999
 
 
3000
 
xtPublic void myxt_release_blobs(XTOpenTablePtr ot, xtWord1 *rec_buf, xtRecordID rec_id)
3001
 
{
3002
 
        void                            *pbms_table;
3003
 
        XTTable                         *tab = ot->ot_table;
3004
 
        u_int                           idx = 0;
3005
 
        Field                           *field;
3006
 
        char                            *blob_ref;
3007
 
        xtWord4                         len;
3008
 
        char                            in_url[PBMS_BLOB_URL_SIZE];
3009
 
        PBMSEngineRefRec        eng_ref;
3010
 
 
3011
 
        memset(&eng_ref, 0, sizeof(PBMSEngineRefRec));
3012
 
        XT_SET_DISK_8(eng_ref.er_data, rec_id);
3013
 
 
3014
 
        if (!xt_pbms_open_table(&pbms_table, tab->tab_name->ps_path))
3015
 
                return;
3016
 
 
3017
 
        for (idx=0; idx<tab->tab_dic.dic_blob_count; idx++) {
3018
 
                field = tab->tab_dic.dic_blob_cols[idx];
3019
 
                if ((blob_ref = mx_get_length_and_data(field, (char *) rec_buf, &len)) && len) {
3020
 
                        xt_strncpy(PBMS_BLOB_URL_SIZE, in_url, blob_ref, len);
3021
 
 
3022
 
                        xt_pbms_release_blob(pbms_table, in_url, field->field_index, &eng_ref);
3023
 
                }
3024
 
        }
3025
 
 
3026
 
        xt_pbms_close_table(pbms_table);
3027
 
}
3028
 
#endif // XT_STREAMING
3029
 
 
3030
2945
xtPublic void *myxt_create_thread()
3031
2946
{
3032
2947
#ifdef DRIZZLED