- Timestamp:
- Mar 19, 2015, 10:01:11 AM (9 years ago)
- 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 1 27 #include <string.h> 2 28 #include <stdio.h> … … 58 84 } 59 85 60 int add_ status(const char * uuid) {86 int add_job(const char * uuid) { 61 87 init_connection(); 62 88 const char * query = "insert into status (uuid,status,created_time) values ('%s','queue',now())"; … … 72 98 return 0; 73 99 } 100 101 int 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.