Ignore:
Timestamp:
Nov 21, 2017, 10:24:14 AM (6 years ago)
Author:
djay
Message:

HPC support update. Add inputs for create options in Gdal_Dem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/prototype-v0/zoo-project/zoo-kernel/sqlapi.c

    r851 r854  
    7070  int i=0;
    7171  maps* cconf=getMaps(conf,key);
    72   if(cconf==NULL)
     72  if(cconf==NULL){
     73    fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    7374    return "-1";
     75  }
    7476  int len=0;
    7577  for(i=0;i<6;i++){
     
    119121int _init_sql(maps* conf,const char* key){
    120122  char* sqlInitString=_createInitString(conf,key);
     123  fprintf(stderr,"Try to connect to: %s %s !\n",key,sqlInitString);
     124  fflush(stderr); 
    121125  if(strncmp(sqlInitString,"-1",2)==0)
    122126    return -1;
     127  fprintf(stderr,"Try to connect to: %s !\n",key);
     128  fflush(stderr); 
    123129  OGRSFDriver *poDriver = NULL;
    124130  OGRRegisterAll();
     
    195201 */
    196202void close_sql(maps* conf,int cid){
    197   if( zoo_ResultSet != NULL )
     203  if( zoo_ResultSet != NULL ){
    198204    zoo_DS[cid]->ReleaseResultSet( zoo_ResultSet );
    199   if(zoo_DS!=NULL){
     205    zoo_ResultSet=NULL;
     206  }
     207  if(zoo_DS!=NULL && zoo_DS[cid]!=NULL){
    200208#if GDAL_VERSION_MAJOR >= 2
    201209    GDALClose(zoo_DS[cid]);
     
    223231 */
    224232OGRLayer *fetchSql(maps* conf,int cid,const char* sqlQuery){
    225   if(zoo_DS[cid]==NULL)
     233  if(zoo_DS==NULL || zoo_DS[cid]==NULL)
    226234    return NULL;
    227235  OGRLayer *res=NULL;
     
    250258int execSql(maps* conf,int cid,const char* sqlQuery){
    251259  int res=-1;
     260  if(zoo_DS == NULL || zoo_DS[cid]==NULL)
     261    return -1;
    252262  zoo_ResultSet = zoo_DS[cid]->ExecuteSQL( sqlQuery, NULL, NULL);
    253263  if( zoo_ResultSet != NULL ){
     
    371381  char *sqlQuery=(char*)malloc((strlen(schema->value)+strlen(msg->value)+strlen(p->value)+strlen(sid->value)+64+1)*sizeof(char));
    372382  sprintf(sqlQuery,"UPDATE %s.services set status=$$%s$$,message=$$%s$$ where uuid=$$%s$$;",schema->value,p->value,msg->value,sid->value);
    373   if( zoo_ds_nb==
    374 #ifdef META_DB
    375       1
    376 #else
    377       0
    378 #endif
    379       ){
     383  if(zoo_ds_nb==0){
    380384    init_sql(conf);
    381385    zoo_ds_nb++;
    382386  }
    383   execSql(conf,zoo_ds_nb-1,sqlQuery);
    384   cleanUpResultSet(conf,zoo_ds_nb-1);
    385   free(sqlQuery);
     387  execSql(conf,0,sqlQuery);
     388  cleanUpResultSet(conf,0);
     389  close_sql(conf,0);
     390  free(sqlQuery);
     391  setMapInMaps(conf,"lenv","ds_nb","0");
    386392  return 0;
    387393}
     
    439445  int zoo_ds_nb=getCurrentId(conf);
    440446  map *schema=getMapFromMaps(conf,"database","schema");
     447  OGRFeature  *poFeature = NULL;
     448  const char *tmp1=NULL;
     449  int hasRes=-1;
    441450  char *sqlQuery=(char*)malloc((strlen(schema->value)+strlen(pid)+82+1)*sizeof(char));
    442451  sprintf(sqlQuery,
     
    454463  }
    455464  execSql(conf,zoo_ds_nb-1,sqlQuery);
    456   OGRFeature  *poFeature = NULL;
    457   const char *tmp1;
    458   int hasRes=-1;
    459465  if(zoo_ResultSet!=NULL){
    460466      while( (poFeature = zoo_ResultSet->GetNextFeature()) != NULL ){
     
    472478  if(hasRes<0)
    473479    tmp1=NULL;
    474   else
    475     cleanUpResultSet(conf,zoo_ds_nb-1);
     480  cleanUpResultSet(conf,zoo_ds_nb-1);
    476481  free(sqlQuery);
    477482  return (char*)tmp1;
     
    534539  //close_sql(conf,zoo_ds_nb-1);
    535540  free(sqlQuery);
    536   end_sql();
     541  //end_sql();
    537542}
    538543
     
    555560    zoo_ds_nb++;
    556561  }
    557   execSql(conf,zoo_ds_nb-1,sqlQuery);
     562  if(execSql(conf,zoo_ds_nb-1,sqlQuery)<0)
     563    return NULL;
    558564  OGRFeature  *poFeature = NULL;
    559565  const char *tmp1;
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