~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/pbms/src/systab_util_ms.h

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#pragma once
2
 
#ifndef __SYSTAB_UTIL_H__
3
 
#define __SYSTAB_UTIL_H__
4
 
/* Copyright (C) 2009 PrimeBase Technologies GmbH, Germany
5
 
 *
6
 
 * PrimeBase Media Stream for MySQL
7
 
 *
8
 
 * This program is free software; you can redistribute it and/or modify
9
 
 * it under the terms of the GNU General Public License as published by
10
 
 * the Free Software Foundation; either version 2 of the License, or
11
 
 * (at your option) any later version.
12
 
 *
13
 
 * This program is distributed in the hope that it will be useful,
14
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 
 * GNU General Public License for more details.
17
 
 *
18
 
 * You should have received a copy of the GNU General Public License
19
 
 * along with this program; if not, write to the Free Software
20
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
 
 *
22
 
 *  Created by Barry Leslie on 3/20/09.
23
 
 *
24
 
 */
25
 
 
26
 
#include "cslib/CSLog.h"
27
 
 
28
 
 
29
 
class SysTabRec: public CSRefStringBuffer {     
30
 
        void logError(const char *text = NULL);
31
 
 
32
 
        bool findRecord();
33
 
 
34
 
        bool badRecord;
35
 
        
36
 
        uint32_t recordLength, start_of_record;
37
 
        
38
 
        public:
39
 
        const char *db_name, *file_name, *table_name;
40
 
        char *ptr, *end_of_record, *end_of_data;
41
 
 
42
 
        SysTabRec(const char *db_name_arg, const char *file_name_arg, const char *table_name_arg): 
43
 
                CSRefStringBuffer(64),
44
 
                badRecord(false),
45
 
                recordLength(0),
46
 
                start_of_record(0),
47
 
                db_name(db_name_arg),
48
 
                file_name(file_name_arg),
49
 
                table_name(table_name_arg),
50
 
                ptr(NULL),
51
 
                end_of_record(NULL),
52
 
                end_of_data(NULL)
53
 
        {
54
 
        }
55
 
        
56
 
        // Methods used to read records
57
 
        bool firstRecord();
58
 
        bool nextRecord();
59
 
        void resetRecord();
60
 
                
61
 
        uint8_t getInt1Field(); 
62
 
        uint32_t getInt4Field();        
63
 
        const char *getStringField();
64
 
                
65
 
        bool isValidRecord()
66
 
        {
67
 
                return ((ptr == end_of_record) && !badRecord);
68
 
        }
69
 
        
70
 
        // Methods used to write records
71
 
        void clear();
72
 
        void beginRecord();
73
 
        void endRecord();
74
 
        void setInt1Field(uint8_t val); 
75
 
        void setInt4Field(uint32_t val);        
76
 
        void setStringField(const char *val);
77
 
        void setStringField(const char *val, uint32_t len);
78
 
 
79
 
        
80
 
};
81
 
 
82
 
CSString *getPBMSPath(CSString *db_path);
83
 
CSPath *getSysFile(CSString *db_path, const char *name, size_t min_size);
84
 
 
85
 
#endif // __SYSTAB_UTIL_H__
86