~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/schema_reader.cc

  • Committer: Brian Aker
  • Date: 2010-02-07 01:33:54 UTC
  • Revision ID: brian@gaz-20100207013354-d2pg1n68u5c09pgo
Remove giant include header to its own file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2009 Sun Microsystems
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; version 2 of the License.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 */
 
19
 
1
20
#include <iostream>
2
21
#include <fstream>
3
22
#include <string>
4
 
#include "schema.pb.h"
 
23
#include <drizzled/message/schema.pb.h>
 
24
 
5
25
using namespace std;
6
 
 
7
 
/* 
 
26
using namespace drizzled;
 
27
 
 
28
 
 
29
/*
8
30
  Written from Google proto example
9
31
*/
10
32
 
11
 
void printSchema(const drizzle::Schema *schema) 
 
33
static void printSchema(const message::Schema *schema)
12
34
{
13
35
  cout << "CREATE SCHEMA `" << schema->name() << "` ";
14
36
  if (schema->has_collation())
15
37
    cout << "COLLATE `" << schema->collation() << "` ";
16
 
  if (schema->has_characterset())
17
 
    cout << "CHARACTER SET `" << schema->characterset() <<"` ";
18
38
  cout << ";" << endl;
19
39
}
20
40
 
21
 
int main(int argc, char* argv[]) 
 
41
int main(int argc, char* argv[])
22
42
{
23
43
  GOOGLE_PROTOBUF_VERIFY_VERSION;
24
44
 
27
47
    return -1;
28
48
  }
29
49
 
30
 
  drizzle::Schema schema;
 
50
  message::Schema schema;
31
51
 
32
52
  {
33
53
    // Read the existing address book.
34
54
    fstream input(argv[1], ios::in | ios::binary);
35
 
    if (!schema.ParseFromIstream(&input)) 
 
55
    if (!schema.ParseFromIstream(&input))
36
56
    {
37
57
      cerr << "Failed to parse schema." << endl;
38
58
      return -1;