annotate main/database/src/command.cc @ 12720:52ca082757c2 octave-forge tip

Update copyright notices.
author i7tiol
date Sat, 27 Feb 2016 11:21:29 +0000
parents 1af86934c14e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
1 /*
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
2
12720
52ca082757c2 Update copyright notices.
i7tiol
parents: 12718
diff changeset
3 Copyright (C) 2012-2016 Olaf Till <i7tiol@t-online.de>
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
4
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
5 This program is free software; you can redistribute it and/or modify
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
7 the Free Software Foundation; either version 3 of the License, or
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
8 (at your option) any later version.
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
9
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
13 GNU General Public License for more details.
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
14
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
16 along with this program; If not, see <http://www.gnu.org/licenses/>.
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
17
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
18 */
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
19
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
20 #include <octave/oct.h>
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
21 #include <octave/ov-struct.h>
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
22 #include <octave/Cell.h>
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
23 #include <octave/lo-ieee.h>
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
24
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
25 #include <iostream>
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
26 #include <fstream>
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
27
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
28 #include "command.h"
11713
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
29 #include "converters.h"
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
30 #include "error-helpers.h"
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
31
11499
1176424db5df Finished copy in from Octave variable. Removed preparations for copy out to variable. New release.
i7tiol
parents: 11484
diff changeset
32 #define COPY_HEADER_SIZE 19
1176424db5df Finished copy in from Octave variable. Removed preparations for copy out to variable. New release.
i7tiol
parents: 11484
diff changeset
33
1176424db5df Finished copy in from Octave variable. Removed preparations for copy out to variable. New release.
i7tiol
parents: 11484
diff changeset
34 #define COUT_RESIZE_STEP 1000 // resize result only after this number of rows
1176424db5df Finished copy in from Octave variable. Removed preparations for copy out to variable. New release.
i7tiol
parents: 11484
diff changeset
35
12612
2257648e8ce1 avoid using const_cast, new release 2.3.2
i7tiol
parents: 11713
diff changeset
36 command::command (octave_pq_connection_rep &connection, std::string &cmd,
11645
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
37 Cell &rtypes,std::string &who)
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
38 : res (NULL), all_fetched (0), valid (1), conn (connection),
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
39 rettypes (rtypes), caller (who)
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
40 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
41 if (! (cptr = conn.octave_pq_get_conn ()))
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
42 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
43 valid = 0;
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
44 c_verror ("%s: connection not open", caller.c_str ());
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
45 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
46
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
47 if (! PQsendQuery (cptr, cmd.c_str ()))
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
48 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
49 valid = 0;
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
50 c_verror ("%s: could not dispatch command: %s", caller.c_str (),
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
51 PQerrorMessage (cptr));
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
52 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
53 else
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
54 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
55 res = PQgetResult (cptr);
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
56 check_first_result ();
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
57 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
58 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
59
12612
2257648e8ce1 avoid using const_cast, new release 2.3.2
i7tiol
parents: 11713
diff changeset
60 command::command (octave_pq_connection_rep &connection, std::string &cmd,
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
61 Cell &params, Cell &ptypes, Cell &rtypes, std::string &who)
11645
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
62 : res (NULL), all_fetched (1), valid (1), conn (connection),
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
63 rettypes (rtypes), caller (who)
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
64 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
65 if (! (cptr = conn.octave_pq_get_conn ()))
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
66 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
67 valid = 0;
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
68 c_verror ("%s: connection not open", caller.c_str ());
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
69 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
70
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
71 int npars = params.numel ();
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
72
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
73 char *vals [npars];
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
74 std::vector<oct_pq_dynvec_t> valsvec;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
75 valsvec.resize (npars);
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
76 int pl [npars];
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
77 int pf [npars];
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
78 Oid oids [npars];
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
79
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
80 for (int i = 0; i < npars; i++)
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
81 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
82 pf[i] = 1; // means binary format
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
83
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
84 if (params(i).is_real_scalar () && params(i).isna ().bool_value ())
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
85 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
86 vals[i] = NULL;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
87
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
88 oids[i] = 0;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
89 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
90 else
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
91 {
11713
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
92 pq_oct_type_t oct_type;
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
93 oct_pq_conv_t *conv;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
94
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
95 if (ptypes(i).is_empty ())
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
96 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
97 oct_type = simple;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
98
11713
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
99 if (! (conv = pgtype_from_octtype (conn, params(i))))
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
100 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
101 valid = 0;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
102 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
103 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
104
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
105 // array not possible here
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
106 oids[i] = conv->oid;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
107 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
108 else
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
109 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
110 bool err;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
111 std::string s;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
112 SET_ERR (s = ptypes(i).string_value (), err);
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
113 if (err)
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
114 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
115 valid = 0;
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
116 c_verror ("%s: parameter type specification no string",
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
117 caller.c_str ());
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
118 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
119 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
120
11713
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
121 if (! (conv = pgtype_from_spec (conn, s, oct_type)))
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
122 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
123 valid = 0;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
124 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
125 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
126
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
127 if (oct_type == array)
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
128 oids[i] = conv->aoid;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
129 else
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
130 oids[i] = conv->oid;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
131 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
132
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
133 switch (oct_type)
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
134 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
135 case simple:
11657
465192f682f0 Pass connection information to converters.
i7tiol
parents: 11646
diff changeset
136 if (conv->from_octave_bin (conn, params(i), valsvec[i]))
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
137 valid = 0;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
138 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
139
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
140 case array:
11657
465192f682f0 Pass connection information to converters.
i7tiol
parents: 11646
diff changeset
141 if (from_octave_bin_array (conn, params(i), valsvec[i], conv))
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
142 valid = 0;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
143 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
144
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
145 case composite:
11657
465192f682f0 Pass connection information to converters.
i7tiol
parents: 11646
diff changeset
146 if (from_octave_bin_composite (conn, params(i), valsvec[i], conv))
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
147 valid = 0;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
148 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
149
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
150 default:
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
151 // should not get here
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
152 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
153 c_verror ("%s: internal error, undefined type identifier",
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
154 caller.c_str ());
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
155
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
156 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
157
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
158 if (! valid) break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
159
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
160 vals[i] = &(valsvec[i].front ());
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
161 pl[i] = valsvec[i].size ();
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
162 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
163 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
164
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
165 if (valid)
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
166 {
11422
b1f26b72b61a Large object import/export also from/to pipes.
i7tiol
parents: 11408
diff changeset
167 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
b1f26b72b61a Large object import/export also from/to pipes.
i7tiol
parents: 11408
diff changeset
168
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
169 res = PQexecParams (cptr, cmd.c_str (), npars, oids, vals, pl, pf, 1);
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
170
11422
b1f26b72b61a Large object import/export also from/to pipes.
i7tiol
parents: 11408
diff changeset
171 END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
b1f26b72b61a Large object import/export also from/to pipes.
i7tiol
parents: 11408
diff changeset
172
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
173 check_first_result ();
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
174 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
175 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
176
11706
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
177 octave_map command::get_elements_typeinfo (oct_pq_conv_t *conv, bool &err)
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
178 {
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
179 int nel = conv->el_oids.size ();
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
180
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
181 octave_map ret (dim_vector (1, nel));
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
182 Cell types_name (1, nel);
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
183 Cell types_array (1, nel);
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
184 Cell types_composite (1, nel);
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
185 Cell types_enum (1, nel);
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
186 Cell types_elements (1, nel);
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
187
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
188 for (int i = 0; i < nel; i++)
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
189 {
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
190 oct_pq_conv_t *el_conv;
11713
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
191 pq_oct_type_t oct_type;
11706
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
192
11713
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
193 if (! (el_conv = pgtype_from_spec (conn, conv->el_oids[i],
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
194 conv->conv_cache[i], oct_type)))
11706
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
195 {
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
196 err = true;
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
197 return ret;
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
198 }
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
199
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
200 types_name(i) = octave_value (el_conv->name);
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
201 types_array(i) = octave_value (oct_type == array);
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
202 types_enum(i) = octave_value (el_conv->is_enum);
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
203 types_composite(i) = octave_value (el_conv->is_composite);
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
204 if (el_conv->is_composite)
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
205 {
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
206 bool rec_err = false;
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
207 types_elements(i) = octave_value (get_elements_typeinfo (el_conv,
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
208 rec_err));
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
209 if (rec_err)
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
210 {
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
211 err = true;
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
212 return ret;
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
213 }
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
214 }
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
215 }
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
216
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
217 ret.assign ("name", types_name);
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
218 ret.assign ("is_array", types_array);
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
219 ret.assign ("is_composite", types_composite);
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
220 ret.assign ("is_enum", types_enum);
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
221 ret.assign ("elements", types_elements);
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
222
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
223 return ret;
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
224 }
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
225
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
226 octave_value command::process_single_result (const std::string &infile,
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
227 const std::string &outfile,
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
228 const Cell &cdata,
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
229 const Cell &ctypes,
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
230 bool coids,
11499
1176424db5df Finished copy in from Octave variable. Removed preparations for copy out to variable. New release.
i7tiol
parents: 11484
diff changeset
231 bool cin_var)
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
232 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
233 octave_value retval;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
234
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
235 // first result is already fetched
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
236 if (! res && (res = PQgetResult (cptr)))
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
237 state = PQresultStatus (res);
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
238
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
239 if (! res)
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
240 all_fetched = 1;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
241 else
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
242 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
243 switch (state)
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
244 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
245 case PGRES_BAD_RESPONSE:
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
246 valid = 0;
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
247 c_verror ("%s: server response not understood", caller.c_str ());
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
248 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
249 case PGRES_FATAL_ERROR:
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
250 valid = 0;
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
251 c_verror ("%s: fatal error: %s", caller.c_str (),
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
252 PQresultErrorMessage (res));
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
253 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
254 case PGRES_COMMAND_OK:
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
255 retval = command_ok_handler ();
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
256 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
257 case PGRES_TUPLES_OK:
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
258 retval = tuples_ok_handler ();
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
259 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
260 case PGRES_COPY_OUT:
11499
1176424db5df Finished copy in from Octave variable. Removed preparations for copy out to variable. New release.
i7tiol
parents: 11484
diff changeset
261 retval = copy_out_handler (outfile);
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
262 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
263 case PGRES_COPY_IN:
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
264 retval = copy_in_handler (infile, cdata, ctypes, coids, cin_var);
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
265 break;
11645
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
266 case PGRES_NONFATAL_ERROR:
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
267 break;
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
268 default:
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
269 valid = 0;
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
270 c_verror ("internal error, unexpected server response");
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
271 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
272
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
273 if (res) // could have been changed by a handler
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
274 {
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
275 PQclear (res);
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
276 res = NULL;
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
277 }
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
278 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
279
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
280 return retval;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
281 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
282
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
283 octave_value command::tuples_ok_handler (void)
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
284 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
285 octave_map ret;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
286
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
287 int nt = PQntuples (res);
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
288 int nf = PQnfields (res);
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
289
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
290 Cell data (nt, nf);
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
291 Cell columns (1, nf);
11699
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
292 Cell types_name (1, nf);
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
293 Cell types_array (1, nf);
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
294 Cell types_composite (1, nf);
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
295 Cell types_enum (1, nf);
11706
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
296 Cell types_elements (1, nf);
11699
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
297 octave_map types (dim_vector (1, nf));
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
298
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
299 bool rtypes_given;
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
300 int l = rettypes.numel ();
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
301 if (l > 0)
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
302 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
303 if (l != nf)
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
304 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
305 valid = 0;
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
306 c_verror ("%s: wrong number of given returned types",
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
307 caller.c_str ());
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
308 return octave_value_list ();
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
309 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
310 rtypes_given = true;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
311 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
312 else
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
313 rtypes_given = false;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
314
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
315 for (int j = 0; j < nf; j++) // j is column
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
316 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
317 columns(j) = octave_value (PQfname (res, j));
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
318
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
319 int f = PQfformat (res, j);
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
320
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
321 oct_pq_to_octave_fp_t simple_type_to_octave;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
322 to_octave_array_fp_t array_to_octave;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
323 to_octave_composite_fp_t composite_to_octave;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
324
11645
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
325 oct_pq_conv_t *conv = NULL; // silence inadequate warning by
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
326 // initializing it here
11713
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
327 pq_oct_type_t oct_type;
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
328
11699
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
329 if (rtypes_given) // for internal reading of system tables
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
330 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
331 std::string type;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
332 bool err;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
333 SET_ERR (type = rettypes(j).string_value (), err);
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
334 if (err)
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
335 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
336 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
337 c_verror ("%s: could not convert given type to string",
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
338 caller.c_str ());
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
339 break;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
340 }
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
341 else if (! (conv = pgtype_from_spec (conn, type, oct_type)))
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
342 {
11699
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
343 valid = 0;
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
344 break;
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
345 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
346 }
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
347 else if (! (conv = pgtype_from_spec (conn, PQftype (res, j), oct_type)))
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
348 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
349 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
350 break;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
351 }
11699
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
352
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
353 if (f)
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
354 {
11713
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
355 array_to_octave = &to_octave_bin_array;
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
356 composite_to_octave = &to_octave_bin_composite;
11699
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
357 // will be NULL for non-simple converters
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
358 simple_type_to_octave = conv->to_octave_bin;
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
359 }
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
360 else
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
361 {
11713
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
362 array_to_octave = &to_octave_str_array;
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
363 composite_to_octave = &to_octave_str_composite;
11699
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
364 // will be NULL for non-simple converters
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
365 simple_type_to_octave = conv->to_octave_str;
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
366 }
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
367
11706
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
368 // prepare type information
11699
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
369 types_name(j) = octave_value (conv->name);
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
370 types_array(j) = octave_value (oct_type == array);
11706
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
371 types_enum(j) = octave_value (conv->is_enum);
11702
dc5cbdce490b Mark returned type as composite even when array.
i7tiol
parents: 11699
diff changeset
372 types_composite(j) = octave_value (conv->is_composite);
11706
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
373 if (conv->is_composite)
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
374 {
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
375 // To implement here: recursively go through the elements
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
376 // and return respective recursive structures. This has the
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
377 // side effect that all converters necessary for this query
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
378 // will be looked up and cached (if they aren't already), so
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
379 // in the actual conversion of composite types only cache
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
380 // reads are performed, no map lookups.
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
381
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
382 bool err = false;
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
383
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
384 types_elements(j) = octave_value (get_elements_typeinfo (conv, err));
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
385
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
386 if (err)
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
387 {
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
388 valid = 0;
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
389 break;
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
390 }
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
391 }
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
392
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
393 for (int i = 0; i < nt; i++) // i is row
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
394 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
395 if (PQgetisnull (res, i, j))
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
396 data(i, j) = octave_value (octave_NA);
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
397 else
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
398 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
399 char *v = PQgetvalue (res, i, j);
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
400 int nb = PQgetlength (res, i, j);
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
401 octave_value ov;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
402
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
403 switch (oct_type)
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
404 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
405 case simple:
11657
465192f682f0 Pass connection information to converters.
i7tiol
parents: 11646
diff changeset
406 if (simple_type_to_octave (conn, v, ov, nb))
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
407 valid = 0;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
408 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
409
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
410 case array:
11713
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
411 if (array_to_octave (conn, v, ov, nb, conv))
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
412 valid = 0;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
413 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
414
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
415 case composite:
11713
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
416 if (composite_to_octave (conn, v, ov, nb, conv))
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
417 valid = 0;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
418 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
419
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
420 default:
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
421 // should not get here
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
422 c_verror ("%s: internal error, undefined type identifier",
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
423 caller.c_str ());
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
424
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
425 valid = 0;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
426 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
427
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
428 if (valid)
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
429 data(i, j) = ov;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
430 else
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
431 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
432 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
433 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
434
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
435 if (! valid)
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
436 break;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
437 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
438
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
439 if (! valid)
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
440 return octave_value_list ();
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
441 else
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
442 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
443 ret.assign ("data", octave_value (data));
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
444 ret.assign ("columns", octave_value (columns));
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
445
11699
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
446 types.setfield ("name", types_name);
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
447 types.setfield ("is_array", types_array);
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
448 types.setfield ("is_composite", types_composite);
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
449 types.setfield ("is_enum", types_enum);
11706
95b91d8c9ee2 Make returned type information recursive over composite type elements.
i7tiol
parents: 11702
diff changeset
450 types.setfield ("elements", types_elements);
11699
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
451 ret.assign ("types", octave_value (types));
dafee4563c36 Return information on column types.
i7tiol
parents: 11697
diff changeset
452
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
453 return octave_value (ret);
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
454 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
455 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
456
11499
1176424db5df Finished copy in from Octave variable. Removed preparations for copy out to variable. New release.
i7tiol
parents: 11484
diff changeset
457 octave_value command::copy_out_handler (const std::string &outfile)
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
458 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
459 octave_value retval;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
460
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
461 if (! outfile.empty ())
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
462 {
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
463 // store unchecked output in file
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
464
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
465 std::ofstream ostr (outfile.c_str (), std::ios_base::out);
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
466 if (ostr.fail ())
11499
1176424db5df Finished copy in from Octave variable. Removed preparations for copy out to variable. New release.
i7tiol
parents: 11484
diff changeset
467 {
1176424db5df Finished copy in from Octave variable. Removed preparations for copy out to variable. New release.
i7tiol
parents: 11484
diff changeset
468 valid = 0;
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
469 c_verror ("could not open output file %s", outfile.c_str ());
11499
1176424db5df Finished copy in from Octave variable. Removed preparations for copy out to variable. New release.
i7tiol
parents: 11484
diff changeset
470 return retval;
1176424db5df Finished copy in from Octave variable. Removed preparations for copy out to variable. New release.
i7tiol
parents: 11484
diff changeset
471 }
1176424db5df Finished copy in from Octave variable. Removed preparations for copy out to variable. New release.
i7tiol
parents: 11484
diff changeset
472
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
473 char *data;
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
474 int nb;
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
475 while ((nb = PQgetCopyData (cptr, &data, 0)) > 0)
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
476 {
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
477 if (! (ostr.fail () || ostr.bad ()))
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
478 {
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
479 ostr.write (data, nb);
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
480 if (ostr.bad ())
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
481 c_verror ("write to file failed");
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
482 }
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
483 PQfreemem (data);
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
484 }
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
485
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
486 if (! ostr.bad ())
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
487 ostr.close ();
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
488
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
489 if (nb == -2)
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
490 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
491 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
492 c_verror ("server error in copy-out: %s", PQerrorMessage (cptr));
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
493 }
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
494 else
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
495 {
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
496 PQclear (res);
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
497
11645
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
498 if ((res = PQgetResult (cptr)))
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
499 {
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
500 if ((state = PQresultStatus (res)) == PGRES_FATAL_ERROR)
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
501 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
502 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
503 c_verror ("server error in copy-out: %s",
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
504 PQerrorMessage (cptr));
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
505 }
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
506 }
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
507 else
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
508 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
509 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
510 c_verror ("unexpectedly got no result information");
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
511 }
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
512 }
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
513 }
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
514 else
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
515 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
516 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
517 c_verror ("no output file given");
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
518 }
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
519
11551
7c0dae992c31 Work around path problem in package initialization. Fixes part of bug #38491.
i7tiol
parents: 11499
diff changeset
520 return octave_value (std::string ("copy out"));
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
521 }
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
522
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
523 octave_value command::copy_in_handler (const std::string &infile,
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
524 const Cell &data,
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
525 const Cell &cin_types,
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
526 bool oids,
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
527 bool var)
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
528 {
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
529 octave_value retval;
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
530
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
531 #define OCT_PQ_READSIZE 4096
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
532
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
533 char buff [OCT_PQ_READSIZE];
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
534
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
535 if (! var)
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
536 {
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
537 // read unchecked input from file
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
538
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
539 if (infile.empty ())
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
540 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
541 valid = 0;
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
542
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
543 c_verror ("no input file given");
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
544
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
545 return retval;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
546 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
547
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
548 std::ifstream istr (infile.c_str (), std::ios_base::in);
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
549 if (istr.fail ())
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
550 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
551 c_verror ("could not open input file %s", infile.c_str ());
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
552
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
553 PQputCopyEnd (cptr, "could not open input file");
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
554
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
555 c_verror ("server error: %s", PQerrorMessage (cptr));
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
556
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
557 valid = 0;
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
558
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
559 return retval;
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
560 }
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
561
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
562 do
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
563 {
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
564 istr.read (buff, OCT_PQ_READSIZE);
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
565
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
566 if (istr.bad ())
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
567 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
568 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
569
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
570 c_verror ("could not read file %s", infile.c_str ());
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
571
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
572 break;
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
573 }
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
574 else
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
575 {
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
576 int nb;
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
577
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
578 if ((nb = istr.gcount ()) > 0)
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
579 if (PQputCopyData (cptr, buff, nb) == -1)
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
580 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
581 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
582
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
583 c_verror ("%s", PQerrorMessage (cptr));
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
584
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
585 break;
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
586 }
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
587 }
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
588 }
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
589 while (! istr.eof ());
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
590
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
591 istr.close ();
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
592
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
593 if (! valid)
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
594 {
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
595 PQputCopyEnd (cptr, "copy-in interrupted");
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
596
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
597 c_verror ("%s", PQerrorMessage (cptr));
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
598 }
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
599 else
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
600 {
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
601 if (PQputCopyEnd (cptr, NULL) == -1)
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
602 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
603 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
604 c_verror ("%s", PQerrorMessage (cptr));
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
605 }
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
606 else
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
607 {
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
608 PQclear (res);
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
609
11645
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
610 if ((res = PQgetResult (cptr)))
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
611 {
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
612 if ((state = PQresultStatus (res)) == PGRES_FATAL_ERROR)
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
613 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
614 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
615 c_verror ("server error in copy-in: %s",
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
616 PQerrorMessage (cptr));
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
617 }
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
618 }
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
619 else
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
620 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
621 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
622 c_verror ("unexpectedly got no result information");
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
623 }
11398
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
624 }
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
625 }
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
626 }
913ac5491db1 Copy in/out from/to local file hacked in. Doc change waits till copy in/out from/to variable.
i7tiol
parents: 11394
diff changeset
627 else
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
628 {
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
629 // copy in from octave variable
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
630
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
631 dim_vector dv = data.dims ();
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
632 octave_idx_type r = dv(0);
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
633 octave_idx_type c = dv(1);
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
634
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
635 octave_idx_type nf = PQnfields (res);
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
636 if (c != nf + oids)
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
637 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
638 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
639
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
640 c_verror ("variable for copy-in has %i columns, but should have %i",
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
641 c, nf + oids);
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
642
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
643 PQputCopyEnd
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
644 (cptr, "variable for copy-in has wrong number of columns");
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
645 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
646 else if (! PQbinaryTuples (res))
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
647 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
648 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
649
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
650 c_verror ("copy-in from variable must use binary mode");
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
651
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
652 PQputCopyEnd (cptr, "copy-in from variable must use binary mode");
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
653 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
654 else
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
655 {
11499
1176424db5df Finished copy in from Octave variable. Removed preparations for copy out to variable. New release.
i7tiol
parents: 11484
diff changeset
656 for (octave_idx_type j = 0; j < nf; j++)
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
657 if (! PQfformat (res, j))
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
658 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
659 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
660
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
661 c_verror ("copy-in from variable must use binary mode in all columns");
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
662
11499
1176424db5df Finished copy in from Octave variable. Removed preparations for copy out to variable. New release.
i7tiol
parents: 11484
diff changeset
663 PQputCopyEnd (cptr, "copy-in from variable must use binary mode in all columns");
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
664
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
665 break;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
666 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
667 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
668
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
669 if (! valid)
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
670 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
671 c_verror ("server error: %s", PQerrorMessage (cptr));
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
672
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
673 return retval;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
674 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
675
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
676 char header [COPY_HEADER_SIZE];
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
677 memset (header, 0, COPY_HEADER_SIZE);
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
678 strcpy (header, "PGCOPY\n\377\r\n\0");
11646
b257244ad466 Hopefully fix strict aliasing issues.
i7tiol
parents: 11645
diff changeset
679 uint32_t tpu32 = htobe32 (uint32_t (oids) << 16);
b257244ad466 Hopefully fix strict aliasing issues.
i7tiol
parents: 11645
diff changeset
680 memcpy (&header[11], &tpu32, 4);
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
681
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
682 char trailer [2];
11646
b257244ad466 Hopefully fix strict aliasing issues.
i7tiol
parents: 11645
diff changeset
683 int16_t tp16 = htobe16 (int16_t (-1));
b257244ad466 Hopefully fix strict aliasing issues.
i7tiol
parents: 11645
diff changeset
684 memcpy (&trailer, &tp16, 2);
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
685
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
686 if (PQputCopyData (cptr, header, COPY_HEADER_SIZE) == -1)
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
687 {
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
688 PQputCopyEnd (cptr, "could not send header");
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
689
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
690 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
691
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
692 c_verror ("server error: %s", PQerrorMessage (cptr));
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
693 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
694 else
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
695 {
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
696 oct_pq_conv_t *convs [c];
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
697 memset (convs, 0, sizeof (convs));
11713
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
698 pq_oct_type_t oct_types [c];
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
699
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
700 for (octave_idx_type i = 0; i < r; i++) // i is row
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
701 {
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
702 int16_t fc = htobe16 (int16_t (nf));
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
703 if (PQputCopyData (cptr, (char *) &fc, 2) == -1)
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
704 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
705 c_verror ("%s", PQerrorMessage (cptr));
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
706
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
707 PQputCopyEnd (cptr, "error sending field count");
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
708
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
709 c_verror ("server error: %s", PQerrorMessage (cptr));
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
710
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
711 valid = 0;
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
712
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
713 break;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
714 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
715
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
716 // j is column of argument data
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
717 for (octave_idx_type j = 0; j < c; j++)
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
718 {
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
719 if (data(i, j).is_real_scalar () &&
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
720 data(i, j).isna ().bool_value ())
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
721 {
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
722 int32_t t = htobe32 (int32_t (-1));
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
723 if (PQputCopyData (cptr, (char *) &t, 4) == -1)
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
724 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
725 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
726
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
727 c_verror ("could not send NULL in copy-in");
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
728
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
729 break;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
730 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
731 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
732 else
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
733 {
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
734 if (! convs [j])
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
735 {
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
736 if ((j == 0) && oids)
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
737 {
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
738 std::string t ("oid");
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
739 if (! (convs[0] =
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
740 pgtype_from_spec (conn, t, oct_types[0])))
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
741 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
742 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
743
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
744 c_verror ("could not get converter for oid in copy-in");
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
745 break;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
746 }
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
747 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
748 else
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
749 {
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
750 if (cin_types(j).is_empty ())
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
751 {
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
752 oct_types[j] = simple;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
753
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
754 if (! (convs[j] =
11713
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
755 pgtype_from_octtype (conn,
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
756 data(i, j))))
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
757 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
758 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
759
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
760 c_verror ("could not determine type in column %i for copy-in",
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
761 j);
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
762
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
763 break;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
764 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
765 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
766 else
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
767 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
768 bool err;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
769 std::string s;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
770 SET_ERR (s = cin_types(j).string_value (),
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
771 err);
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
772 if (err)
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
773 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
774 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
775
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
776 c_verror ("column type specification no string");
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
777
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
778 break;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
779 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
780
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
781 if (! (convs[j] =
11713
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
782 pgtype_from_spec (conn, s,
ee2b22964070 Make some functions of class 'command' non-members.
i7tiol
parents: 11706
diff changeset
783 oct_types[j])))
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
784 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
785 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
786
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
787 c_verror ("invalid column type specification");
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
788
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
789 break;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
790 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
791 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
792 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
793 } // ! convs [j]
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
794
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
795 oct_pq_dynvec_t val;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
796
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
797 bool conversion_failed = false;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
798 switch (oct_types[j])
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
799 {
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
800 case simple:
11657
465192f682f0 Pass connection information to converters.
i7tiol
parents: 11646
diff changeset
801 if (convs[j]->from_octave_bin (conn, data(i, j), val))
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
802 conversion_failed = true;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
803 break;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
804
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
805 case array:
11657
465192f682f0 Pass connection information to converters.
i7tiol
parents: 11646
diff changeset
806 if (from_octave_bin_array (conn, data(i, j), val,
465192f682f0 Pass connection information to converters.
i7tiol
parents: 11646
diff changeset
807 convs[j]))
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
808 conversion_failed = true;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
809 break;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
810
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
811 case composite:
11657
465192f682f0 Pass connection information to converters.
i7tiol
parents: 11646
diff changeset
812 if (from_octave_bin_composite (conn, data(i, j), val,
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
813 convs[j]))
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
814 conversion_failed = true;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
815 break;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
816
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
817 default:
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
818 // should not get here
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
819 c_verror ("internal error, undefined type identifier");
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
820 conversion_failed = true;
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
821 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
822
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
823 if (conversion_failed)
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
824 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
825 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
826 error ("could not convert data(%i, %i) for copy-in",
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
827 i, j);
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
828 }
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
829 else
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
830 {
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
831 uint32_t t = htobe32 (uint32_t (val.size ()));
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
832 if (PQputCopyData (cptr, (char *) &t, 4) == -1)
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
833 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
834 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
835 c_verror ("could not send data length in copy-in");
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
836 }
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
837 else if (PQputCopyData (cptr, &(val.front ()),
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
838 val.size ()) == -1)
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
839 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
840 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
841 c_verror ("could not send copy-in data");
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
842 }
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
843 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
844
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
845 if (! valid) break;
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
846 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
847 } // columns of argument data
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
848
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
849 if (! valid)
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
850 {
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
851 PQputCopyEnd (cptr, "error sending copy-in data");
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
852
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
853 c_verror ("server error: %s", PQerrorMessage (cptr));
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
854
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
855 break;
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
856 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
857 } // rows of argument data
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
858 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
859
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
860 if (valid)
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
861 if (PQputCopyData (cptr, trailer, 2) == -1)
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
862 {
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
863 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
864
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
865 PQputCopyEnd (cptr, "could not send trailer");
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
866
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
867 c_verror ("%s", PQerrorMessage (cptr));
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
868 }
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
869
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
870 if (valid)
11645
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
871 {
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
872 if (PQputCopyEnd (cptr, NULL) == -1)
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
873 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
874 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
875 c_verror ("%s", PQerrorMessage (cptr));
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
876 }
11645
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
877 else
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
878 {
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
879 PQclear (res);
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
880
11645
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
881 if ((res = PQgetResult (cptr)))
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
882 {
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
883 if ((state = PQresultStatus (res)) == PGRES_FATAL_ERROR)
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
884 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
885 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
886 c_verror ("server error in copy-in: %s",
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
887 PQerrorMessage (cptr));
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
888 }
11645
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
889 }
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
890 else
12718
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
891 {
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
892 valid = 0;
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
893 c_verror ("unexpectedly got no result information");
1af86934c14e Make compatible with Octaves new exception-based error handling.
i7tiol
parents: 12612
diff changeset
894 }
11645
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
895 }
bd5a8f1bdfb8 Clean out harmless warnings and one unnecessarily returned column.
i7tiol
parents: 11551
diff changeset
896 }
11484
154bc776dfa8 Implemented copy in from Octave variable.
i7tiol
parents: 11480
diff changeset
897 } // copy from variable
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
898
11551
7c0dae992c31 Work around path problem in package initialization. Fixes part of bug #38491.
i7tiol
parents: 11499
diff changeset
899 return octave_value (std::string ("copy in"));
11394
9aee227e296c Populated new database package with initial postgresql interface.
i7tiol
parents:
diff changeset
900 }