~mordred/drizzle-interface/cython-interface

« back to all changes in this revision

Viewing changes to interface/libdrizzle/result_client_buffered.i

  • Committer: Monty Taylor
  • Date: 2009-10-28 02:20:39 UTC
  • mfrom: (113.1.2 c-transition)
  • Revision ID: mordred@inaugust.com-20091028022039-a202c33y8nm06x5n
Merged in transition to C.

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
 
 * drizzle-interface: Interface Wrappers for Drizzle
5
 
 * Copyright (c) 2009 Sun Microsystems
6
 
 * All rights reserved.
7
 
 *
8
 
 * Redistribution and use in source and binary forms, with or without
9
 
 * modification, are permitted provided that the following conditions are met:
10
 
 *
11
 
 * 1. Redistributions of source code must retain the above copyright
12
 
 *    notice, this list of conditions and the following disclaimer.
13
 
 * 2. Redistributions in binary form must reproduce the above copyright
14
 
 *    notice, this list of conditions and the following disclaimer in the
15
 
 *    documentation and/or other materials provided with the distribution.
16
 
 * 3. The name of the author may not be used to endorse or promote products
17
 
 *    derived from this software without specific prior written permission.
18
 
 *
19
 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
 
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
 
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
 
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23
 
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
 
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
 
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
 
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
 
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
 
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
 
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
 
 */
31
 
 
32
 
%rename(ResultClientBuffered) result_client_buffered;
33
 
 
34
 
 
35
 
class result_client_buffered : public result_client {};
36
 
 
37
 
 
38
 
%extend result_client_buffered {
39
 
 
40
 
  /**
41
 
   * Get an array of all field sizes for buffered rows.
42
 
   */
43
 
  size_t *row_field_sizes()
44
 
  {
45
 
    return drizzle_row_field_sizes($self);
46
 
  }
47
 
 
48
 
  /**
49
 
   * Get next buffered row from a fully buffered result.
50
 
   */
51
 
  drizzle_row_t row_next(row_buffered *buffer)
52
 
  {
53
 
    buffer->row= drizzle_row_next($self);
54
 
    buffer->field_count= drizzle_result_column_count($self);
55
 
    buffer->result= $self;
56
 
    return (buffer->row);
57
 
  }
58
 
 
59
 
  /**
60
 
   * Get previous buffered row from a fully buffered result.
61
 
   */
62
 
  drizzle_row_t row_prev(row_buffered *buffer)
63
 
  {
64
 
    buffer->row= drizzle_row_prev($self);
65
 
    buffer->field_count= drizzle_result_column_count($self);
66
 
    buffer->result= $self;
67
 
    return (buffer->row);
68
 
  }
69
 
 
70
 
  /**
71
 
   * Get a field at the specified position from the given row.
72
 
   */
73
 
  char *get_row_field(drizzle_row_t row, int pos)
74
 
  {
75
 
    if (pos > drizzle_result_column_count($self))
76
 
      return NULL;
77
 
    return row[pos];
78
 
  }
79
 
 
80
 
  /**
81
 
   * Seek to the given buffered row in a fully buffered result.
82
 
   */
83
 
  void row_seek(uint64_t row)
84
 
  {
85
 
    drizzle_row_seek($self, row);
86
 
  }
87
 
 
88
 
  /**
89
 
   * Get the given buffered row from a fully buffered result.
90
 
   */
91
 
  void row_index(row_buffered *buffer, uint64_t row)
92
 
  {
93
 
    buffer->row= drizzle_row_index($self, row);
94
 
    buffer->field_count= drizzle_result_column_count($self);
95
 
    buffer->result= $self;
96
 
  }
97
 
 
98
 
  /**
99
 
   * Get current row number.
100
 
   */
101
 
  uint64_t row_current()
102
 
  {
103
 
    return drizzle_row_current($self);
104
 
  }
105
 
 
106
 
}