Ignore:
Timestamp:
Mar 19, 2015, 10:01:11 AM (9 years ago)
Author:
david
Message:

commit of partial async queue process management

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PublicaMundi_David-devel/zoo-project/zoo-kernel/zoo_sql.c

    r603 r617  
     1/**
     2 * Author : David Saggiorato
     3 *
     4 *  Copyright 2008-2009 GeoLabs SARL. All rights reserved.
     5 *
     6 * Permission is hereby granted, free of charge, to any person obtaining a copy
     7 * of this software and associated documentation files (the "Software"), to deal
     8 * in the Software without restriction, including without limitation the rights
     9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     10 * copies of the Software, and to permit persons to whom the Software is
     11 * furnished to do so, subject to the following conditions:
     12 *
     13 * The above copyright notice and this permission notice shall be included in
     14 * all copies or substantial portions of the Software.
     15 *
     16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     22 * THE SOFTWARE.
     23 */
     24
     25
     26
    127#include <string.h>
    228#include <stdio.h>
     
    5884 }
    5985
    60 int add_status(const char * uuid) {
     86int add_job(const char * uuid) {
    6187    init_connection();
    6288    const char * query = "insert into status (uuid,status,created_time) values ('%s','queue',now())";
     
    7298    return 0;
    7399}
     100
     101int start_job(const char *uuid){
     102    init_connection();
     103    const char * query = "update status set start_date=now(), status='running', progress=0 where uuid='%s';";
     104    char * query_f = (char*) malloc(strlen(query) + strlen(uuid) + 1);
     105    sprintf(query_f,query,uuid);
     106    if (mysql_query(con, query_f) != 0){
     107        fprintf(stderr, "%s\n", mysql_error(con));
     108        free(query_f);
     109        return -1;
     110    }
     111    free(query_f);
     112    mysql_close(con);
     113    return 0;
     114}
     115
     116
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png