1 /* 2 3 Copyright (C) 2013-2019 Olaf Till <i7tiol@t-online.de> 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; If not, see <http://www.gnu.org/licenses/>. 17 18 */ 19 20 #include <octave/oct.h> 21 22 #include "command.h" 23 24 // PKG_ADD: autoload ("pq_update_types", "pq_interface.oct"); 25 // PKG_DEL: autoload ("pq_update_types", "pq_interface.oct", "remove"); 26 27 DEFUN_DLD (pq_update_types, args, , 28 "-*- texinfo -*-\n\ 29 @deftypefn {Loadable Function} pq_update_types (@var{connection})\n\ 30 Updates information on existing postgresql types for @var{connection}. Use this before @code{pq_exec_params} if types were created or dropped while the connection was already established or if the schema search path changed. A newly created connection will automatically retrieve this information at connection time.\n\ 31 \n\ 32 @end deftypefn") 33 { 34 std::string fname ("pq_update_types"); 35 36 octave_value_list retval; 37 38 if (args.length () != 1 || 39 args(0).type_id () != octave_pq_connection::static_type_id ()) 40 { 41 print_usage (); 42 43 return retval; 44 } 45 46 const octave_base_value& rep = (args(0).get_rep ()); 47 48 const octave_pq_connection &oct_pq_conn = 49 dynamic_cast<const octave_pq_connection&> (rep); 50 51 if (oct_pq_conn.get_rep ()->octave_pq_refresh_types ()) 52 error ("%s failed", fname.c_str ()); 53 54 return retval; 55 } 56