# HG changeset patch # User i7tiol # Date 1369029997 0 # Node ID ee2b229640700995210674872151e371fdb43c9c # Parent f4c52c68f74469d5a07a6a1b95549279abd6dbe7 Make some functions of class 'command' non-members. diff -r f4c52c68f744 -r ee2b22964070 main/database/DESCRIPTION --- a/main/database/DESCRIPTION Sun May 19 18:47:32 2013 +0000 +++ b/main/database/DESCRIPTION Mon May 20 06:06:37 2013 +0000 @@ -1,6 +1,6 @@ Name: database Version: 2.1.1 -Date: 2013-05-19 +Date: 2013-05-20 Author: Olaf Till Maintainer: Olaf Till Title: Database. diff -r f4c52c68f744 -r ee2b22964070 main/database/src/command.cc --- a/main/database/src/command.cc Sun May 19 18:47:32 2013 +0000 +++ b/main/database/src/command.cc Mon May 20 06:06:37 2013 +0000 @@ -26,12 +26,7 @@ #include #include "command.h" - -#define ERROR_RETURN_NO_PG_TYPE \ - { \ - error ("could not determine postgresql type for Octave parameter"); \ - return NULL; \ - } +#include "converters.h" #define COPY_HEADER_SIZE 19 @@ -93,14 +88,14 @@ } else { - oct_type_t oct_type; + pq_oct_type_t oct_type; oct_pq_conv_t *conv; if (ptypes(i).is_empty ()) { oct_type = simple; - if (! (conv = pgtype_from_octtype (params(i)))) + if (! (conv = pgtype_from_octtype (conn, params(i)))) { valid = 0; break; @@ -120,7 +115,7 @@ break; } - if (! (conv = pgtype_from_spec (s, oct_type))) + if (! (conv = pgtype_from_spec (conn, s, oct_type))) { valid = 0; break; @@ -190,10 +185,10 @@ for (int i = 0; i < nel; i++) { oct_pq_conv_t *el_conv; - oct_type_t oct_type; + pq_oct_type_t oct_type; - if (! (el_conv = pgtype_from_spec (conv->el_oids[i], conv->conv_cache[i], - oct_type))) + if (! (el_conv = pgtype_from_spec (conn, conv->el_oids[i], + conv->conv_cache[i], oct_type))) { err = true; return ret; @@ -225,101 +220,6 @@ return ret; } -oct_pq_conv_t *command::pgtype_from_spec (std::string &name, - oct_type_t &oct_type) -{ - oct_pq_conv_t *conv = NULL; - - // printf ("pgtype_from_spec(%s): simple ", name.c_str ()); - - oct_type = simple; // default - int l; - while (name.size () >= 2 && ! name.compare (l = name.size () - 2, 2, "[]")) - { - name.erase (l, 2); - oct_type = array; - - // printf ("array "); - } - - oct_pq_name_conv_map_t::iterator iter; - - if ((iter = conn.name_conv_map.find (name.c_str ())) == - conn.name_conv_map.end ()) - error ("%s: no converter found for type %s", caller.c_str (), - name.c_str ()); - else - { - // printf ("(looked up in name map) "); - - conv = iter->second; - - if (oct_type == array && ! conv->aoid) - { - error ("%s: internal error, type %s, specified as array, has no array type in system catalog", name.c_str ()); - return conv; - } - - if (! (oct_type == array) && conv->is_composite) - { - oct_type = composite; - - // printf ("composite "); - } - } - - // printf ("\n"); - - return conv; -} - -oct_pq_conv_t *command::pgtype_from_spec (Oid oid, oct_type_t &oct_type) -{ - // printf ("pgtype_from_spec(%u): ", oid); - - oct_pq_conv_t *conv = NULL; - - oct_pq_conv_map_t::iterator iter; - - if ((iter = conn.conv_map.find (oid)) == conn.conv_map.end ()) - { - error ("%s: no converter found for element oid %u", - caller.c_str (), oid); - return conv; - } - conv = iter->second; - // printf ("(looked up %s in oid map) ", conv->name.c_str ()); - - if (conv->aoid == oid) - oct_type = array; - else if (conv->is_composite) - oct_type = composite; - else - oct_type = simple; - - // printf ("oct_type: %i\n", oct_type); - - return conv; -} - -oct_pq_conv_t *command::pgtype_from_spec (Oid oid, oct_pq_conv_t *&c_conv, - oct_type_t &oct_type) -{ - if (c_conv) - { - if (c_conv->aoid == oid) - oct_type = array; - else if (c_conv->is_composite) - oct_type = composite; - else - oct_type = simple; - } - else - c_conv = pgtype_from_spec (oid, oct_type); - - return c_conv; -} - octave_value command::process_single_result (const std::string &infile, const std::string &outfile, const Cell &cdata, @@ -420,7 +320,7 @@ oct_pq_conv_t *conv = NULL; // silence inadequate warning by // initializing it here - oct_type_t oct_type; + pq_oct_type_t oct_type; if (rtypes_given) // for internal reading of system tables { @@ -429,7 +329,7 @@ error ("%s: could not convert given type to string", caller.c_str ()); else - conv = pgtype_from_spec (type, oct_type); + conv = pgtype_from_spec (conn, type, oct_type); if (error_state) { @@ -438,7 +338,7 @@ } } else - if (! (conv = pgtype_from_spec (PQftype (res, j), oct_type))) + if (! (conv = pgtype_from_spec (conn, PQftype (res, j), oct_type))) { valid = 0; break; @@ -446,15 +346,15 @@ if (f) { - array_to_octave = &command::to_octave_bin_array; - composite_to_octave = &command::to_octave_bin_composite; + array_to_octave = &to_octave_bin_array; + composite_to_octave = &to_octave_bin_composite; // will be NULL for non-simple converters simple_type_to_octave = conv->to_octave_bin; } else { - array_to_octave = &command::to_octave_str_array; - composite_to_octave = &command::to_octave_str_composite; + array_to_octave = &to_octave_str_array; + composite_to_octave = &to_octave_str_composite; // will be NULL for non-simple converters simple_type_to_octave = conv->to_octave_str; } @@ -502,12 +402,12 @@ break; case array: - if ((this->*array_to_octave) (conn, v, ov, nb, conv)) + if (array_to_octave (conn, v, ov, nb, conv)) valid = 0; break; case composite: - if ((this->*composite_to_octave) (conn, v, ov, nb, conv)) + if (composite_to_octave (conn, v, ov, nb, conv)) valid = 0; break; @@ -764,7 +664,7 @@ { oct_pq_conv_t *convs [c]; memset (convs, 0, sizeof (convs)); - oct_type_t oct_types [c]; + pq_oct_type_t oct_types [c]; for (octave_idx_type i = 0; i < r; i++) // i is row { @@ -801,7 +701,8 @@ if ((j == 0) && oids) { std::string t ("oid"); - convs[0] = pgtype_from_spec (t, oct_types[0]); + convs[0] = pgtype_from_spec (conn, t, + oct_types[0]); } else { @@ -810,7 +711,8 @@ oct_types[j] = simple; if (! (convs[j] = - pgtype_from_octtype (data(i, j)))) + pgtype_from_octtype (conn, + data(i, j)))) { error ("could not determine type in column %i for copy-in", j); @@ -829,7 +731,8 @@ } if (! (convs[j] = - pgtype_from_spec (s, oct_types[j]))) + pgtype_from_spec (conn, s, + oct_types[j]))) { error ("invalid column type specification"); @@ -927,82 +830,3 @@ return octave_value (std::string ("copy in")); } - -oct_pq_conv_t *command::pgtype_from_octtype (const octave_value ¶m) -{ - // printf ("pgtype_from_octtype: "); - - if (param.is_bool_scalar ()) - { - // printf ("bool\n"); - return conn.name_conv_map["bool"]; - } - else if (param.is_real_scalar ()) - { - if (param.is_double_type ()) - { - // printf ("float8\n"); - return conn.name_conv_map["float8"]; - } - else if (param.is_single_type ()) - { - // printf ("float4\n"); - return conn.name_conv_map["float4"]; - } - } - - if (param.is_scalar_type ()) - { - if (param.is_int16_type ()) - { - // printf ("int2\n"); - return conn.name_conv_map["int2"]; - } - else if (param.is_int32_type ()) - { - // printf ("int4\n"); - return conn.name_conv_map["int4"]; - } - else if (param.is_int64_type ()) - { - // printf ("int8\n"); - return conn.name_conv_map["int8"]; - } - else if (param.is_uint32_type ()) - { - // printf ("oid\n"); - return conn.name_conv_map["oid"]; - } - } - - if (param.is_uint8_type ()) - { - // printf ("bytea\n"); - return conn.name_conv_map["bytea"]; - } - else if (param.is_string ()) - { - // printf ("text\n"); - return conn.name_conv_map["text"]; - } - - // is_real_type() is true for strings, so is_numeric_type() would - // still be needed if strings were not recognized above - if (param.is_real_type ()) - { - switch (param.numel ()) - { - case 2: - // printf ("point\n"); - return conn.name_conv_map["point"]; - case 3: - // printf ("circle\n"); - return conn.name_conv_map["circle"]; - case 4: - // printf ("lseg\n"); - return conn.name_conv_map["lseg"]; - } - } - - ERROR_RETURN_NO_PG_TYPE -} diff -r f4c52c68f744 -r ee2b22964070 main/database/src/command.h --- a/main/database/src/command.h Sun May 19 18:47:32 2013 +0000 +++ b/main/database/src/command.h Mon May 20 06:06:37 2013 +0000 @@ -26,7 +26,6 @@ #include #include "pq_connection.h" -#include "converters.h" class command @@ -50,19 +49,12 @@ } } - typedef struct - { - dim_vector pd, cur; - octave_idx_type nd; - } - count_state; - - typedef int (command::*to_octave_array_fp_t) - (const octave_pq_connection &, char *, octave_value &, + typedef int (*to_octave_array_fp_t) + (octave_pq_connection &, char *, octave_value &, int, oct_pq_conv_t *); - typedef int (command::*to_octave_composite_fp_t) - (const octave_pq_connection &, char *, octave_value &, + typedef int (*to_octave_composite_fp_t) + (octave_pq_connection &, char *, octave_value &, int, oct_pq_conv_t *); int all_results_fetched (void) @@ -88,8 +80,6 @@ private: - typedef enum {simple, array, composite} oct_type_t; - octave_map get_elements_typeinfo (oct_pq_conv_t *conv, bool &err); void check_first_result (void) @@ -122,44 +112,6 @@ octave_value copy_in_handler (const std::string &, const Cell &, const Cell &, bool, bool); - oct_pq_conv_t *pgtype_from_octtype (const octave_value &); - - oct_pq_conv_t *pgtype_from_spec (std::string &, oct_type_t &); - - oct_pq_conv_t *pgtype_from_spec (Oid, oct_type_t &); - - oct_pq_conv_t *pgtype_from_spec (Oid, oct_pq_conv_t *&, oct_type_t &); - - int from_octave_bin_array (const octave_pq_connection &conn, - const octave_value &oct_arr, oct_pq_dynvec_t &val, - oct_pq_conv_t *); - - int from_octave_bin_composite (const octave_pq_connection &conn, - const octave_value &oct_comp, - oct_pq_dynvec_t &val, oct_pq_conv_t *); - - int from_octave_str_array (const octave_pq_connection &conn, - const octave_value &oct_arr, oct_pq_dynvec_t &val, - octave_value &type); - - int from_octave_str_composite (const octave_pq_connection &conn, - const octave_value &oct_comp, - oct_pq_dynvec_t &val, octave_value &type); - - int to_octave_bin_array (const octave_pq_connection &conn, - char *, octave_value &, int, oct_pq_conv_t *); - - int to_octave_bin_composite (const octave_pq_connection &conn, - char *, octave_value &, int, oct_pq_conv_t *); - - int to_octave_str_array (const octave_pq_connection &conn, - char *, octave_value &, int, oct_pq_conv_t *); - - int to_octave_str_composite (const octave_pq_connection &conn, - char *, octave_value &, int, oct_pq_conv_t *); - - octave_idx_type count_row_major_order (dim_vector &, count_state &, bool); - PGresult *res; int all_fetched; int valid; diff -r f4c52c68f744 -r ee2b22964070 main/database/src/converters.h --- a/main/database/src/converters.h Sun May 19 18:47:32 2013 +0000 +++ b/main/database/src/converters.h Mon May 20 06:06:37 2013 +0000 @@ -36,6 +36,15 @@ typedef std::vector oct_pq_dynvec_t; +typedef enum {simple, array, composite} pq_oct_type_t; + +typedef struct +{ + dim_vector pd, cur; + octave_idx_type nd; +} + oct_mo_count_state; + class octave_pq_connection; typedef int (*oct_pq_to_octave_fp_t) (const octave_pq_connection &, @@ -117,6 +126,11 @@ oct_pq_conv_t *conv; }; +typedef std::map oct_pq_conv_map_t; + +typedef std::map oct_pq_name_conv_map_t; + // helper function for debugging void print_conv (oct_pq_conv_t *); @@ -133,6 +147,49 @@ int from_octave_bin_text (const octave_pq_connection &conn, const octave_value &ov, oct_pq_dynvec_t &val); +oct_pq_conv_t *pgtype_from_octtype (octave_pq_connection &conn, + const octave_value &); + +oct_pq_conv_t *pgtype_from_spec (octave_pq_connection &, std::string &, + pq_oct_type_t &); + +oct_pq_conv_t *pgtype_from_spec (octave_pq_connection &, Oid, + pq_oct_type_t &); + +oct_pq_conv_t *pgtype_from_spec (octave_pq_connection &, Oid, + oct_pq_conv_t *&, pq_oct_type_t &); + +octave_idx_type count_row_major_order (dim_vector &, oct_mo_count_state &, + bool); + +int from_octave_bin_array (octave_pq_connection &conn, + const octave_value &oct_arr, oct_pq_dynvec_t &val, + oct_pq_conv_t *); + +int from_octave_bin_composite (octave_pq_connection &conn, + const octave_value &oct_comp, + oct_pq_dynvec_t &val, oct_pq_conv_t *); + +int from_octave_str_array (octave_pq_connection &conn, + const octave_value &oct_arr, oct_pq_dynvec_t &val, + octave_value &type); + +int from_octave_str_composite (octave_pq_connection &conn, + const octave_value &oct_comp, + oct_pq_dynvec_t &val, octave_value &type); + +int to_octave_bin_array (octave_pq_connection &conn, + char *, octave_value &, int, oct_pq_conv_t *); + +int to_octave_bin_composite (octave_pq_connection &conn, + char *, octave_value &, int, oct_pq_conv_t *); + +int to_octave_str_array (octave_pq_connection &conn, + char *, octave_value &, int, oct_pq_conv_t *); + +int to_octave_str_composite (octave_pq_connection &conn, + char *, octave_value &, int, oct_pq_conv_t *); + // append bytes of value 'val' of type 'type' to dynamic char vector 'dv' #define OCT_PQ_PUT(dv, type, val) \ dv.resize (dv.size () + sizeof (type)); \ diff -r f4c52c68f744 -r ee2b22964070 main/database/src/converters_arr_comp.cc --- a/main/database/src/converters_arr_comp.cc Sun May 19 18:47:32 2013 +0000 +++ b/main/database/src/converters_arr_comp.cc Mon May 20 06:06:37 2013 +0000 @@ -24,10 +24,194 @@ #include -#include "command.h" +#include "converters.h" +#include "pq_connection.h" + +#define ERROR_RETURN_NO_PG_TYPE \ + { \ + error ("could not determine postgresql type for Octave parameter"); \ + return NULL; \ + } + +oct_pq_conv_t *pgtype_from_spec (octave_pq_connection &conn, + std::string &name, + pq_oct_type_t &oct_type) +{ + oct_pq_conv_t *conv = NULL; + + // printf ("pgtype_from_spec(%s): simple ", name.c_str ()); + + oct_type = simple; // default + int l; + while (name.size () >= 2 && ! name.compare (l = name.size () - 2, 2, "[]")) + { + name.erase (l, 2); + oct_type = array; + + // printf ("array "); + } + + oct_pq_name_conv_map_t::iterator iter; + + if ((iter = conn.name_conv_map.find (name.c_str ())) == + conn.name_conv_map.end ()) + error ("no converter found for type %s", + name.c_str ()); + else + { + // printf ("(looked up in name map) "); + + conv = iter->second; + + if (oct_type == array && ! conv->aoid) + { + error ("%s: internal error, type %s, specified as array, has no array type in system catalog", name.c_str ()); + return conv; + } + + if (! (oct_type == array) && conv->is_composite) + { + oct_type = composite; + + // printf ("composite "); + } + } + + // printf ("\n"); + + return conv; +} + +oct_pq_conv_t *pgtype_from_spec (octave_pq_connection &conn, Oid oid, + pq_oct_type_t &oct_type) +{ + // printf ("pgtype_from_spec(%u): ", oid); + + oct_pq_conv_t *conv = NULL; + + oct_pq_conv_map_t::iterator iter; + + if ((iter = conn.conv_map.find (oid)) == conn.conv_map.end ()) + { + error ("no converter found for element oid %u", oid); + return conv; + } + conv = iter->second; + // printf ("(looked up %s in oid map) ", conv->name.c_str ()); + + if (conv->aoid == oid) + oct_type = array; + else if (conv->is_composite) + oct_type = composite; + else + oct_type = simple; + + // printf ("oct_type: %i\n", oct_type); + + return conv; +} -octave_idx_type command::count_row_major_order (dim_vector &dv, - count_state &state, bool init) +oct_pq_conv_t *pgtype_from_spec (octave_pq_connection &conn, Oid oid, + oct_pq_conv_t *&c_conv, + pq_oct_type_t &oct_type) +{ + if (c_conv) + { + if (c_conv->aoid == oid) + oct_type = array; + else if (c_conv->is_composite) + oct_type = composite; + else + oct_type = simple; + } + else + c_conv = pgtype_from_spec (conn, oid, oct_type); + + return c_conv; +} + +oct_pq_conv_t *pgtype_from_octtype (octave_pq_connection &conn, + const octave_value ¶m) +{ + // printf ("pgtype_from_octtype: "); + + if (param.is_bool_scalar ()) + { + // printf ("bool\n"); + return conn.name_conv_map["bool"]; + } + else if (param.is_real_scalar ()) + { + if (param.is_double_type ()) + { + // printf ("float8\n"); + return conn.name_conv_map["float8"]; + } + else if (param.is_single_type ()) + { + // printf ("float4\n"); + return conn.name_conv_map["float4"]; + } + } + + if (param.is_scalar_type ()) + { + if (param.is_int16_type ()) + { + // printf ("int2\n"); + return conn.name_conv_map["int2"]; + } + else if (param.is_int32_type ()) + { + // printf ("int4\n"); + return conn.name_conv_map["int4"]; + } + else if (param.is_int64_type ()) + { + // printf ("int8\n"); + return conn.name_conv_map["int8"]; + } + else if (param.is_uint32_type ()) + { + // printf ("oid\n"); + return conn.name_conv_map["oid"]; + } + } + + if (param.is_uint8_type ()) + { + // printf ("bytea\n"); + return conn.name_conv_map["bytea"]; + } + else if (param.is_string ()) + { + // printf ("text\n"); + return conn.name_conv_map["text"]; + } + + // is_real_type() is true for strings, so is_numeric_type() would + // still be needed if strings were not recognized above + if (param.is_real_type ()) + { + switch (param.numel ()) + { + case 2: + // printf ("point\n"); + return conn.name_conv_map["point"]; + case 3: + // printf ("circle\n"); + return conn.name_conv_map["circle"]; + case 4: + // printf ("lseg\n"); + return conn.name_conv_map["lseg"]; + } + } + + ERROR_RETURN_NO_PG_TYPE +} + +octave_idx_type count_row_major_order (dim_vector &dv, + oct_mo_count_state &state, bool init) { if (init) { @@ -85,21 +269,20 @@ } } -int command::from_octave_bin_array (const octave_pq_connection &conn, - const octave_value &oct_arr, - oct_pq_dynvec_t &val, oct_pq_conv_t *conv) +int from_octave_bin_array (octave_pq_connection &conn, + const octave_value &oct_arr, + oct_pq_dynvec_t &val, oct_pq_conv_t *conv) { octave_scalar_map m = oct_arr.scalar_map_value (); if (error_state) { - error ("%s: Postgresql array parameter no Octave structure", - caller.c_str ()); + error ("Postgresql array parameter no Octave structure"); return 1; } if (! m.isfield ("ndims") || ! m.isfield ("data")) { - error ("%s: field 'ndims' or 'data' missing in parameter for Postgresql array", caller.c_str ()); + error ("field 'ndims' or 'data' missing in parameter for Postgresql array"); return 1; } @@ -107,7 +290,7 @@ Cell arr = m.contents ("data").cell_value (); if (error_state || nd_pq < 0) { - error ("%s: 'ndims' and 'data' could not be converted to non-negative integer and cell-array in parameter for Postgresql array", caller.c_str ()); + error ("'ndims' and 'data' could not be converted to non-negative integer and cell-array in parameter for Postgresql array"); return 1; } @@ -119,7 +302,7 @@ lb = m.contents ("lbounds").row_vector_value (); if (error_state) { - error ("%s: could not convert given enumeration bases for array to row vector", caller.c_str ()); + error ("could not convert given enumeration bases for array to row vector"); return 1; } } @@ -163,7 +346,7 @@ OCT_PQ_PUT(val, int32_t, htobe32 ((int32_t) lb(i))) } // elements - count_state state; + oct_mo_count_state state; count_row_major_order (d, state, true); // initialize counter for (int i = 0, ti = 0; ti < nl; ti++, i = count_row_major_order (d, state, false)) @@ -194,15 +377,15 @@ return 0; } -int command::from_octave_bin_composite (const octave_pq_connection &conn, - const octave_value &oct_comp, - oct_pq_dynvec_t &val, - oct_pq_conv_t *conv) +int from_octave_bin_composite (octave_pq_connection &conn, + const octave_value &oct_comp, + oct_pq_dynvec_t &val, + oct_pq_conv_t *conv) { Cell rec (oct_comp.cell_value ()); if (error_state) { - error ("%s: Octaves representation of a composite type could not be converted to cell-array", caller.c_str ()); + error ("Octaves representation of a composite type could not be converted to cell-array"); return 1; } @@ -210,8 +393,8 @@ if (size_t (nl) != conv->el_oids.size ()) { - error ("%s: Octaves representation of a composite type has incorrect number of elements (%i, should have %i)", - caller.c_str (), nl, conv->el_oids.size ()); + error ("Octaves representation of a composite type has incorrect number of elements (%i, should have %i)", + nl, conv->el_oids.size ()); return 1; } @@ -232,9 +415,10 @@ OCT_PQ_SET_UINT32_PLACEHOLDER(val, temp_pos) oct_pq_conv_t *el_conv; - oct_type_t oct_type; + pq_oct_type_t oct_type; - if (! (el_conv = pgtype_from_spec (conv->el_oids[i], + if (! (el_conv = pgtype_from_spec (conn, + conv->el_oids[i], conv->conv_cache[i], oct_type))) return 1; @@ -258,8 +442,7 @@ default: // should not get here - error ("%s: internal error, undefined type identifier", - caller.c_str ()); + error ("internal error, undefined type identifier"); return 1; } @@ -270,9 +453,9 @@ return 0; } -int command::from_octave_str_array (const octave_pq_connection &conn, - const octave_value &oct_arr, - oct_pq_dynvec_t &val, octave_value &type) +int from_octave_str_array (octave_pq_connection &conn, + const octave_value &oct_arr, + oct_pq_dynvec_t &val, octave_value &type) { // not implemented error ("not implemented"); @@ -281,10 +464,10 @@ return 0; } -int command::from_octave_str_composite (const octave_pq_connection &conn, - const octave_value &oct_comp, - oct_pq_dynvec_t &val, - octave_value &type) +int from_octave_str_composite (octave_pq_connection &conn, + const octave_value &oct_comp, + oct_pq_dynvec_t &val, + octave_value &type) { // not implemented error ("not implemented"); @@ -293,9 +476,9 @@ return 0; } -int command::to_octave_bin_array (const octave_pq_connection &conn, - char *v, octave_value &ov, int nb, - oct_pq_conv_t *conv) +int to_octave_bin_array (octave_pq_connection &conn, + char *v, octave_value &ov, int nb, + oct_pq_conv_t *conv) { char *p = v; @@ -313,8 +496,8 @@ // check element OID if (oid != conv->oid) { - error ("%s: element oid %i sent by server does not match element oid %i expected for array with oid %i", - caller.c_str (), oid, conv->oid, conv->aoid); + error ("element oid %i sent by server does not match element oid %i expected for array with oid %i", + oid, conv->oid, conv->aoid); return 1; } @@ -336,7 +519,7 @@ // elements octave_idx_type nl = dv.numel (); Cell c (dv); - count_state state; + oct_mo_count_state state; count_row_major_order (dv, state, true); // initialize counter for (int i = 0, ti = 0; ti < nl; ti++, i = count_row_major_order (dv, state, false)) @@ -378,9 +561,9 @@ return 0; } -int command::to_octave_bin_composite (const octave_pq_connection &conn, - char *v, octave_value &ov, int nb, - oct_pq_conv_t *conv) +int to_octave_bin_composite (octave_pq_connection &conn, + char *v, octave_value &ov, int nb, + oct_pq_conv_t *conv) { char *p = v; @@ -404,9 +587,9 @@ uint32_t nb_el = uint32_t (null_id); oct_pq_conv_t *el_conv; - oct_type_t oct_type; + pq_oct_type_t oct_type; - if (! (el_conv = pgtype_from_spec (oid, conv->conv_cache[i], + if (! (el_conv = pgtype_from_spec (conn, oid, conv->conv_cache[i], oct_type))) return 1; @@ -430,8 +613,7 @@ default: // should not get here - error ("%s: internal error, undefined type identifier", - caller.c_str ()); + error ("internal error, undefined type identifier"); return 1; } @@ -447,9 +629,9 @@ } -int command::to_octave_str_array (const octave_pq_connection &conn, - char *v, octave_value &ov, int nb, - oct_pq_conv_t *conv) +int to_octave_str_array (octave_pq_connection &conn, + char *v, octave_value &ov, int nb, + oct_pq_conv_t *conv) { // not implemented error ("not implemented"); @@ -458,9 +640,9 @@ return 0; } -int command::to_octave_str_composite (const octave_pq_connection &conn, - char *v, octave_value &ov, int nb, - oct_pq_conv_t *conv) +int to_octave_str_composite (octave_pq_connection &conn, + char *v, octave_value &ov, int nb, + oct_pq_conv_t *conv) { // not implemented error ("not implemented"); diff -r f4c52c68f744 -r ee2b22964070 main/database/src/pq_connection.h --- a/main/database/src/pq_connection.h Sun May 19 18:47:32 2013 +0000 +++ b/main/database/src/pq_connection.h Mon May 20 06:06:37 2013 +0000 @@ -27,11 +27,6 @@ #include "converters.h" -typedef std::map oct_pq_conv_map_t; - -typedef std::map oct_pq_name_conv_map_t; - class octave_pq_connection : public octave_base_value {