00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "reGlobalsExtern.h"
00011 #include "genQuery.h"
00012 #include "reHelpers1.h"
00013 #include "rcMisc.h"
00014
00015 int _makeQuery( char *sel, char *cond, char **sql);
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 int msiExecStrCondQueryWithOptions(msParam_t* queryParam,
00056 msParam_t* zeroResultsIsOK,
00057 msParam_t* maxReturnedRowsParam,
00058 msParam_t* genQueryOutParam,
00059 ruleExecInfo_t *rei)
00060 {
00061 genQueryInp_t genQueryInp;
00062 int i;
00063 genQueryOut_t *genQueryOut = NULL;
00064 char *query;
00065 char *maxReturnedRowsStr;
00066 int maxReturnedRows;
00067
00068 query = (char *) malloc(strlen(queryParam->inOutStruct) + 10 + MAX_COND_LEN * 8);
00069 strcpy(query, queryParam->inOutStruct);
00070
00071 i = replaceVariablesAndMsParams("",query, rei->msParamArray, rei);
00072 if (i < 0)
00073 return(i);
00074 memset (&genQueryInp, 0, sizeof (genQueryInp_t));
00075 i = fillGenQueryInpFromStrCond(query, &genQueryInp);
00076 if (i < 0)
00077 return(i);
00078
00079 if(maxReturnedRowsParam != NULL) {
00080 maxReturnedRowsStr = (char *) maxReturnedRowsParam->inOutStruct;
00081 if(strcmp(maxReturnedRowsStr, "NULL") != 0)
00082 {
00083 maxReturnedRows = atoi (maxReturnedRowsStr);
00084 genQueryInp.maxRows= maxReturnedRows;
00085 }
00086 else
00087 genQueryInp.maxRows= MAX_SQL_ROWS;
00088 }
00089 else
00090 genQueryInp.maxRows= MAX_SQL_ROWS;
00091
00092 genQueryInp.continueInx=0;
00093
00094 i = rsGenQuery(rei->rsComm, &genQueryInp, &genQueryOut);
00095 if (zeroResultsIsOK !=NULL &&
00096 strcmp(zeroResultsIsOK->inOutStruct, "zeroOK") == 0 )
00097 {
00098 if (i < 0 && i != CAT_NO_ROWS_FOUND)
00099 return(i);
00100 else if (i == CAT_NO_ROWS_FOUND)
00101 {
00102 genQueryOutParam->type = strdup(STR_MS_T);
00103 fillStrInMsParam (genQueryOutParam,"emptySet");
00104 return(0);
00105 }
00106 }
00107 else
00108 {
00109 if (i < 0)
00110 return(i);
00111 }
00112 if (i < 0)
00113 return(i);
00114 genQueryOutParam->type = strdup(GenQueryOut_MS_T);
00115 genQueryOutParam->inOutStruct = genQueryOut;
00116 return(0);
00117 }
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152 int msiExecStrCondQuery(msParam_t* queryParam, msParam_t* genQueryOutParam, ruleExecInfo_t *rei)
00153 {
00154 genQueryInp_t genQueryInp;
00155 int i;
00156 genQueryOut_t *genQueryOut = NULL;
00157 char *query;
00158
00159 query = (char *) malloc(strlen(queryParam->inOutStruct) + 10 + MAX_COND_LEN * 8);
00160
00161 strcpy(query, queryParam->inOutStruct);
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176 i = replaceVariablesAndMsParams("",query, rei->msParamArray, rei);
00177 if (i < 0)
00178 return(i);
00179 memset (&genQueryInp, 0, sizeof (genQueryInp_t));
00180 i = fillGenQueryInpFromStrCond(query, &genQueryInp);
00181 if (i < 0)
00182 return(i);
00183 genQueryInp.maxRows= MAX_SQL_ROWS;
00184 genQueryInp.continueInx=0;
00185
00186 i = rsGenQuery(rei->rsComm, &genQueryInp, &genQueryOut);
00187 if (i < 0)
00188 return(i);
00189 genQueryOutParam->type = strdup(GenQueryOut_MS_T);
00190 genQueryOutParam->inOutStruct = genQueryOut;
00191 return(0);
00192 }
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228 int msiExecGenQuery(msParam_t* genQueryInParam, msParam_t* genQueryOutParam, ruleExecInfo_t *rei)
00229 {
00230 genQueryInp_t *genQueryInp;
00231 int i;
00232 genQueryOut_t *genQueryOut = NULL;
00233
00234
00235 genQueryInp = genQueryInParam->inOutStruct;
00236
00237 i = rsGenQuery(rei->rsComm, genQueryInp, &genQueryOut);
00238 if (i < 0)
00239 return(i);
00240 genQueryOutParam->type = strdup(GenQueryOut_MS_T);
00241 genQueryOutParam->inOutStruct = genQueryOut;
00242 return(0);
00243 }
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281 int
00282 msiGetContInxFromGenQueryOut(msParam_t* genQueryOutParam, msParam_t* continueInx, ruleExecInfo_t *rei)
00283 {
00284 genQueryOut_t *genQueryOut;
00285
00286 RE_TEST_MACRO (" Calling msiGetContInxFromGenQueryOut")
00287
00288 if ( !genQueryOutParam)
00289 {
00290 rodsLog (LOG_ERROR, "msiGetContInxFromGenQueryOut: Missing parameter(s)");
00291 return (USER__NULL_INPUT_ERR);
00292 }
00293
00294 if (strcmp(genQueryOutParam->type, GenQueryOut_MS_T))
00295 {
00296 rodsLog (LOG_ERROR,
00297 "msiGetContInxFromGenQueryOut: genQueryOutParam type is %s, should be GenQueryOut_MS_T",
00298 genQueryOutParam->type);
00299 return (USER_PARAM_TYPE_ERR);
00300 }
00301
00302 genQueryOut = genQueryOutParam->inOutStruct;
00303 fillIntInMsParam(continueInx, genQueryOut->continueInx);
00304 return(0);
00305 }
00306
00307
00308 int
00309 _makeQuery( char *sel, char *cond, char **sql)
00310 {
00311 *sql = (char *) malloc(strlen(sel) + strlen(cond) + 20);
00312 if (strlen(cond) > 0)
00313 sprintf(*sql, "SELECT %s WHERE %s", sel, cond);
00314 else
00315 sprintf(*sql, "SELECT %s ", sel);
00316 return(0);
00317 }
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352 int
00353 msiMakeQuery(msParam_t* selectListParam, msParam_t* conditionsParam,
00354 msParam_t* queryOutParam, ruleExecInfo_t *rei)
00355 {
00356 char *sql, *sel, *cond;
00357 int i;
00358 sel = (char *) selectListParam->inOutStruct;
00359 cond = (char *) conditionsParam->inOutStruct;
00360 i = _makeQuery(sel,cond,&sql);
00361 queryOutParam->type = strdup(STR_MS_T);
00362 queryOutParam->inOutStruct = sql;
00363 return(i);
00364 }
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403 int
00404 msiGetMoreRows(msParam_t *genQueryInp_msp, msParam_t *genQueryOut_msp, msParam_t *continueInx, ruleExecInfo_t *rei)
00405 {
00406 genQueryInp_t *genQueryInp;
00407 genQueryOut_t *genQueryOut;
00408
00409
00410 RE_TEST_MACRO (" Calling msiGetMoreRows")
00411
00412 if (rei == NULL || rei->rsComm == NULL) {
00413 rodsLog (LOG_ERROR, "msiGetMoreRows: input rei or rsComm is NULL.");
00414 return (SYS_INTERNAL_NULL_INPUT_ERR);
00415 }
00416
00417
00418
00419 if (!genQueryInp_msp || !genQueryOut_msp)
00420 {
00421 rodsLog (LOG_ERROR, "msiGetMoreRows: Missing parameter(s)");
00422 return (USER__NULL_INPUT_ERR);
00423 }
00424
00425
00426
00427 if (strcmp(genQueryOut_msp->type, GenQueryOut_MS_T))
00428 {
00429 rodsLog (LOG_ERROR, "msiGetMoreRows: genQueryOut_msp type is %s, should be GenQueryOut_MS_T", genQueryOut_msp->type);
00430 return (USER_PARAM_TYPE_ERR);
00431 }
00432
00433 if (strcmp(genQueryInp_msp->type, GenQueryInp_MS_T))
00434 {
00435 rodsLog (LOG_ERROR, "msiGetMoreRows: query_msp type is %s, should be GenQueryInp_MS_T", genQueryInp_msp->type);
00436 return (USER_PARAM_TYPE_ERR);
00437 }
00438
00439
00440
00441 genQueryOut = genQueryOut_msp->inOutStruct;
00442 genQueryInp = genQueryInp_msp->inOutStruct;
00443
00444
00445
00446 genQueryInp->continueInx = genQueryOut->continueInx;
00447
00448 if (genQueryInp->continueInx > 0)
00449 {
00450
00451 genQueryInp->maxRows = MAX_SQL_ROWS;
00452 }
00453 else
00454 {
00455
00456 genQueryInp->maxRows = -1;
00457 }
00458
00459
00460
00461 freeGenQueryOut (&genQueryOut);
00462
00463
00464
00465 rei->status = rsGenQuery(rei->rsComm, genQueryInp, &genQueryOut);
00466
00467
00468 if (rei->status == 0)
00469 {
00470
00471 genQueryOut_msp->inOutStruct = genQueryOut;
00472
00473
00474 resetMsParam(continueInx);
00475 fillIntInMsParam(continueInx, genQueryOut->continueInx);
00476 }
00477
00478 return (rei->status);
00479 }
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519 int
00520 msiMakeGenQuery(msParam_t* selectListStr, msParam_t* condStr, msParam_t* genQueryInpParam, ruleExecInfo_t *rei)
00521 {
00522 genQueryInp_t *genQueryInp;
00523 char *sel, *cond, *rawQuery, *query;
00524
00525
00526 RE_TEST_MACRO (" Calling msiMakeGenQuery")
00527
00528 if (rei == NULL || rei->rsComm == NULL) {
00529 rodsLog (LOG_ERROR, "msiMakeGenQuery: input rei or rsComm is NULL.");
00530 return (SYS_INTERNAL_NULL_INPUT_ERR);
00531 }
00532
00533
00534
00535 if ((sel = parseMspForStr(selectListStr)) == NULL)
00536 {
00537 rodsLog (LOG_ERROR, "msiMakeGenQuery: input selectListStr is NULL.");
00538 return (USER__NULL_INPUT_ERR);
00539 }
00540
00541
00542
00543 if ((cond = parseMspForStr(condStr)) == NULL)
00544 {
00545 rodsLog (LOG_ERROR, "msiMakeGenQuery: input condStr is NULL.");
00546 return (USER__NULL_INPUT_ERR);
00547 }
00548
00549
00550
00551
00552
00553 rei->status = _makeQuery(sel, cond, &rawQuery);
00554
00555
00556 query = (char *)malloc(strlen(rawQuery) + 10 + MAX_COND_LEN * 8);
00557 strcpy(query, rawQuery);
00558
00559
00560 rei->status = replaceVariablesAndMsParams("", query, rei->msParamArray, rei);
00561 if (rei->status < 0)
00562 {
00563 rodsLog (LOG_ERROR, "msiMakeGenQuery: replaceVariablesAndMsParams failed.");
00564 free( rawQuery );
00565 return(rei->status);
00566 }
00567
00568
00569 genQueryInp = (genQueryInp_t*)malloc(sizeof(genQueryInp_t));
00570 memset (genQueryInp, 0, sizeof (genQueryInp_t));
00571
00572
00573 genQueryInp->maxRows = MAX_SQL_ROWS;
00574 genQueryInp->continueInx = 0;
00575 rei->status = fillGenQueryInpFromStrCond(query, genQueryInp);
00576 if (rei->status < 0)
00577 {
00578 rodsLog (LOG_ERROR, "msiMakeGenQuery: fillGenQueryInpFromStrCond failed.");
00579 free( rawQuery );
00580 return(rei->status);
00581 }
00582
00583
00584
00585 genQueryInpParam->type = strdup(GenQueryInp_MS_T);
00586 genQueryInpParam->inOutStruct = genQueryInp;
00587
00588
00589
00590 free(rawQuery);
00591 free(query);
00592
00593 return(rei->status);
00594 }
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629 int
00630 msiPrintGenQueryInp( msParam_t *where, msParam_t* genQueryInpParam, ruleExecInfo_t *rei)
00631 {
00632 genQueryInp_t *genQueryInp;
00633 int i, j;
00634 char *writeId;
00635 char writeStr[MAX_NAME_LEN * 2];
00636 int len;
00637 int *ip1, *ip2;
00638 char *cp;
00639 char **cpp;
00640
00641 RE_TEST_MACRO (" Calling msiPrintGenQueryInp");
00642
00643 if (rei == NULL || rei->rsComm == NULL) {
00644 rodsLog (LOG_ERROR, "msiPrintGenQueryInp: input rei or rsComm is NULL.");
00645 return (SYS_INTERNAL_NULL_INPUT_ERR);
00646 }
00647 if (!where) {
00648 rodsLog (LOG_ERROR, "msiPrintGenQueryInp: No destination provided for writing.");
00649 return (USER__NULL_INPUT_ERR);
00650 }
00651
00652 if (where->inOutStruct != NULL) {
00653 writeId = where->inOutStruct;
00654 }
00655 else {
00656 writeId = where->label;
00657 }
00658
00659 genQueryInp = (genQueryInp_t *) strtol((char *)genQueryInpParam->inOutStruct,
00660 (char **) NULL,0);
00661
00662
00663
00664 len = genQueryInp->selectInp.len;
00665 ip1 = genQueryInp->selectInp.inx;
00666 ip2 = genQueryInp->selectInp.value;
00667 for (i=0;i<len;i++) {
00668 sprintf(writeStr,"Selected Column %d With Option %d\n",*ip1, *ip2);
00669 j = _writeString(writeId, writeStr, rei);
00670 if (j < 0)
00671 return(j);
00672 ip1++;
00673 ip2++;
00674 }
00675
00676 len = genQueryInp->sqlCondInp.len;
00677 ip1 = genQueryInp->sqlCondInp.inx;
00678 cpp = genQueryInp->sqlCondInp.value;
00679 cp = *cpp;
00680 for (i=0;i<len;i++) {
00681 sprintf(writeStr,"Condition Column %d %s\n", *ip1, cp);
00682 j = _writeString(writeId, writeStr, rei);
00683 if (j < 0)
00684 return(j);
00685 ip1++;
00686 cpp++;
00687 cp = *cpp;
00688 }
00689 return(0);
00690 }
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733 int
00734 msiAddSelectFieldToGenQuery(msParam_t *select, msParam_t *function, msParam_t *queryInput, ruleExecInfo_t *rei)
00735 {
00736 char *column_str;
00737 int column_inx, function_inx;
00738 genQueryInp_t *genQueryInp;
00739
00740
00741
00742
00743 RE_TEST_MACRO (" Calling msiAddSelectFieldToGenQuery")
00744
00745
00746 if (rei == NULL || rei->rsComm == NULL)
00747 {
00748 rodsLog (LOG_ERROR, "msiAddSelectFieldToGenQuery: input rei or rsComm is NULL.");
00749 return (SYS_INTERNAL_NULL_INPUT_ERR);
00750 }
00751
00752
00753
00754
00755
00756 if ((column_str = parseMspForStr(select)) == NULL)
00757 {
00758 rodsLog (LOG_ERROR, "msiAddSelectFieldToGenQuery: input select is NULL.");
00759 return (USER__NULL_INPUT_ERR);
00760 }
00761
00762
00763 function_inx = getSelVal(parseMspForStr(function));
00764
00765
00766 if (queryInput->type && strcmp(queryInput->type, GenQueryInp_MS_T))
00767 {
00768 rodsLog (LOG_ERROR, "msiAddSelectfieldToGenQuery: queryInput is not of type GenQueryInp_MS_T.");
00769 return (USER_PARAM_TYPE_ERR);
00770 }
00771
00772
00773 if (!queryInput->inOutStruct)
00774 {
00775
00776 genQueryInp = (genQueryInp_t*)malloc(sizeof(genQueryInp_t));
00777 memset(genQueryInp, 0, sizeof(genQueryInp_t));
00778 genQueryInp->maxRows = MAX_SQL_ROWS;
00779 queryInput->inOutStruct = (void*)genQueryInp;
00780
00781
00782 if (!queryInput->type)
00783 {
00784 queryInput->type = strdup(GenQueryInp_MS_T);
00785 }
00786 }
00787 else
00788 {
00789 genQueryInp = (genQueryInp_t*)queryInput->inOutStruct;
00790 }
00791
00792
00793
00794
00795
00796 column_inx = getAttrIdFromAttrName(column_str);
00797
00798
00799 if (column_inx < 0) {
00800 rodsLog (LOG_ERROR, "msiAddSelectfieldToGenQuery: Unable to get valid ICAT column index.");
00801 return(column_inx);
00802 }
00803
00804
00805 addInxIval (&genQueryInp->selectInp, column_inx, function_inx);
00806
00807
00808
00809 return 0;
00810 }
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851 int
00852 msiAddConditionToGenQuery(msParam_t *attribute, msParam_t *operator, msParam_t *value, msParam_t *queryInput, ruleExecInfo_t *rei)
00853 {
00854 genQueryInp_t *genQueryInp;
00855 char condStr[MAX_NAME_LEN];
00856 char *att_str, *op_str, *val_str;
00857 int att_inx;
00858
00859
00860
00861
00862 RE_TEST_MACRO (" Calling msiAddConditionToGenQuery")
00863
00864
00865 if (rei == NULL || rei->rsComm == NULL)
00866 {
00867 rodsLog (LOG_ERROR, "msiAddConditionToGenQuery: input rei or rsComm is NULL.");
00868 return (SYS_INTERNAL_NULL_INPUT_ERR);
00869 }
00870
00871
00872
00873
00874
00875 if ((att_str = parseMspForStr(attribute)) == NULL)
00876 {
00877 rodsLog (LOG_ERROR, "msiAddConditionToGenQuery: input attribute is NULL.");
00878 return (USER__NULL_INPUT_ERR);
00879 }
00880
00881
00882 if ((op_str = parseMspForStr(operator)) == NULL)
00883 {
00884 rodsLog (LOG_ERROR, "msiAddConditionToGenQuery: input operator is NULL.");
00885 return (USER__NULL_INPUT_ERR);
00886 }
00887
00888
00889 if ((val_str = parseMspForStr(value)) == NULL)
00890 {
00891 rodsLog (LOG_ERROR, "msiAddConditionToGenQuery: input value is NULL.");
00892 return (USER__NULL_INPUT_ERR);
00893 }
00894
00895
00896 if (queryInput->type && strcmp(queryInput->type, GenQueryInp_MS_T))
00897 {
00898 rodsLog (LOG_ERROR, "msiAddConditionToGenQuery: queryInput is not of type GenQueryInp_MS_T.");
00899 return (USER_PARAM_TYPE_ERR);
00900 }
00901
00902
00903 if (!queryInput->inOutStruct)
00904 {
00905 rodsLog (LOG_ERROR, "msiAddConditionToGenQuery: input queryInput is NULL.");
00906 return (USER__NULL_INPUT_ERR);
00907 }
00908 else
00909 {
00910 genQueryInp = (genQueryInp_t*)queryInput->inOutStruct;
00911 }
00912
00913
00914
00915
00916
00917 att_inx = getAttrIdFromAttrName(att_str);
00918
00919
00920 if (att_inx < 0) {
00921 rodsLog (LOG_ERROR, "msiAddConditionToGenQuery: Unable to get valid ICAT column index.");
00922 return(att_inx);
00923 }
00924
00925
00926 snprintf (condStr, MAX_NAME_LEN, " %s '%s'", op_str, val_str);
00927
00928
00929 addInxVal (&genQueryInp->sqlCondInp, att_inx, condStr);
00930
00931
00932
00933 return 0;
00934 }
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972 int
00973 msiPrintGenQueryOutToBuffer(msParam_t *queryOut, msParam_t *format, msParam_t *buffer, ruleExecInfo_t *rei)
00974 {
00975 genQueryOut_t *genQueryOut;
00976 char *format_str;
00977 bytesBuf_t *bytesBuf;
00978 FILE *stream;
00979 char readbuffer[MAX_NAME_LEN];
00980
00981
00982
00983
00984 RE_TEST_MACRO (" Calling msiPrintGenQueryOutToBuffer")
00985
00986
00987 if (rei == NULL || rei->rsComm == NULL)
00988 {
00989 rodsLog (LOG_ERROR, "msiPrintGenQueryOutToBuffer: input rei or rsComm is NULL.");
00990 return (SYS_INTERNAL_NULL_INPUT_ERR);
00991 }
00992
00993
00994
00995
00996
00997 if (!queryOut || !queryOut->inOutStruct || !queryOut->type || strcmp(queryOut->type, GenQueryOut_MS_T))
00998 {
00999 rodsLog (LOG_ERROR, "msiPrintGenQueryOutToBuffer: Invalid input for queryOut.");
01000 return(USER_PARAM_TYPE_ERR);
01001 }
01002 genQueryOut = (genQueryOut_t *)queryOut->inOutStruct;
01003
01004
01005
01006 format_str = parseMspForStr(format);
01007
01008
01009
01010
01011
01012 stream = tmpfile();
01013 if (!stream)
01014 {
01015 rodsLog (LOG_ERROR, "msiPrintGenQueryOutToBuffer: tmpfile() failed.");
01016 return(FILE_OPEN_ERR);
01017 }
01018
01019
01020 rei->status = printGenQueryOut(stream, format_str, NULL, genQueryOut);
01021 if (rei->status < 0)
01022 {
01023 rodsLog (LOG_ERROR, "msiPrintGenQueryOutToBuffer: printGenQueryOut() failed, status = %d", rei->status);
01024 return(rei->status);
01025 }
01026
01027
01028 bytesBuf = (bytesBuf_t *)malloc(sizeof(bytesBuf_t));
01029 memset (bytesBuf, 0, sizeof (bytesBuf_t));
01030
01031
01032 rewind(stream);
01033 while (fgets(readbuffer, MAX_NAME_LEN, stream) != NULL)
01034 {
01035 appendToByteBuf(bytesBuf, readbuffer);
01036 }
01037
01038
01039
01040
01041
01042 if (buffer && buffer->inpOutBuf)
01043 {
01044 freeBBuf(buffer->inpOutBuf);
01045 }
01046 resetMsParam(buffer);
01047
01048
01049 fillBufLenInMsParam (buffer, bytesBuf->len, bytesBuf);
01050
01051 return 0;
01052
01053 }
01054
01055
01056