Revision c7625b48 src/pool/PoolObjectSQL.cc

View differences:

src/pool/PoolObjectSQL.cc
162 162
/* -------------------------------------------------------------------------- */
163 163
/* -------------------------------------------------------------------------- */
164 164

  
165
int PoolObjectSQL::replace_template(const string& tmpl_str, string& error)
166
{
167
    Template * new_tmpl  = get_new_template();
168
    char *     error_msg = 0;
169

  
170
    if ( new_tmpl == 0 )
171
    {
172
        error = "Can not allocate a new template";
173
        return -1;
174
    }
175
    
176
    if ( new_tmpl->parse(tmpl_str, &error_msg) != 0 )
177
    {
178
        ostringstream oss;
179
        
180
        oss << "Parse error";
181
         
182
        if (error_msg != 0)
183
        {
184
            oss << ": " << error_msg;
185
        }
186
        
187
        error = oss.str();
188

  
189
        return -1;
190
    }
191

  
192
    delete obj_template;
193

  
194
    obj_template = new_tmpl;
195

  
196
    return 0;
197
} 
198

  
199
/* -------------------------------------------------------------------------- */
200
/* -------------------------------------------------------------------------- */
201

  

Also available in: Unified diff