TEST_F(statement, can_count_its_parameters) { auto statement(db->prepare_statement("SELECT * FROM test WHERE id = :id;")); EXPECT_EQ(1, statement.parameter_count()); statement = db->prepare_statement( "SELECT * FROM test WHERE id = :id AND name = :name;" ); EXPECT_EQ(2, statement.parameter_count()); }
std::shared_ptr<AbstractExpression> LQPSubqueryExpression::parameter_expression(const size_t parameter_idx) const { Assert(parameter_idx < parameter_count(), "Parameter index out of range"); return arguments[parameter_idx]; }
bool ogc_deriving_conv :: to_wkt( char buffer[], int options, size_t buflen) const { OGC_UTF8_NAME buf_name; OGC_TBUF buf_hdr; OGC_TBUF buf_method; OGC_TBUF buf_parameter; OGC_TBUF buf_id; int opts = (options | OGC_WKT_OPT_INTERNAL); size_t len = 0; bool rc = true; const char * opn = "["; const char * cls = "]"; const char * kwd = obj_kwd(); if ( (options & OGC_WKT_OPT_PARENS) != 0 ) { opn = "("; cls = ")"; } if ( (opts & OGC_WKT_OPT_TOP_ID_ONLY) != 0 ) opts |= OGC_WKT_OPT_NO_IDS; if ( buffer == OGC_NULL ) return false; *buffer = 0; if ( !is_visible() ) return true; if ( (options & OGC_WKT_OPT_OLD_SYNTAX) != 0 ) return true; rc &= ogc_method :: to_wkt(_method, buf_method, opts, OGC_TBUF_MAX); ogc_string::escape_str(buf_name, _name, OGC_UTF8_NAME_MAX); sprintf(buf_hdr, "%s%s\"%s\"", kwd, opn, buf_name); OGC_CPY_TO_BUF( buf_hdr ); OGC_ADD_TO_BUF( buf_method ); if ( _parameters != OGC_NULL ) { for (int i = 0; i < parameter_count(); i++) { rc &= ogc_parameter :: to_wkt(parameter(i), buf_parameter, opts, OGC_TBUF_MAX); OGC_ADD_TO_BUF( buf_parameter ); } } if ( _param_files != OGC_NULL ) { for (int i = 0; i < param_file_count(); i++) { rc &= ogc_param_file :: to_wkt(param_file(i), buf_parameter, opts, OGC_TBUF_MAX); OGC_ADD_TO_BUF( buf_parameter ); } } if ( _ids != OGC_NULL && (options & OGC_WKT_OPT_NO_IDS) == 0 ) { for (int i = 0; i < id_count(); i++) { rc &= ogc_id :: to_wkt(id(i), buf_id, opts, OGC_TBUF_MAX); OGC_ADD_TO_BUF( buf_id ); } } OGC_CPY_TO_BUF( cls ); if ( (options & OGC_WKT_OPT_INTERNAL) == 0 && (options & OGC_WKT_OPT_EXPAND) != 0 ) { rc &= ogc_utils :: expand_wkt(buffer, buffer, "", options, buflen); } return rc; }