1 /*
2     This file is part of GNU APL, a free implementation of the
3     ISO/IEC Standard 13751, "Programming Language APL, Extended"
4 
5     Copyright (C) 2014  Elias Mårtenson
6 
7     This program is free software: you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation, either version 3 of the License, or
10     (at your option) any later version.
11 
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16 
17     You should have received a copy of the GNU General Public License
18     along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #include "Connection.hh"
22 
replace_bind_args(const string & sql)23 const string Connection::replace_bind_args( const string &sql )
24 {
25     stringstream out;
26     int pos = 0;
27     for( size_t i = 0 ; i < sql.size() ; i++ ) {
28         char ch = sql[i];
29         if( ch == '?' ) {
30             out << make_positional_param( pos++ );
31         }
32         else {
33             out << ch;
34         }
35     }
36     return out.str();
37 }
38