Mapper
get_espts_dir.c
Go to the documentation of this file.
1 #include <sqlhdr.h>
2 #include <sqliapi.h>
3 #line 1 "get_espts_dir.ec"
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7 #include <errno.h>
8 #include <ctype.h>
9 #include <sys/time.h>
10 #include <sys/types.h>
11 #include <sys/stat.h>
12 #include <unistd.h>
13 
14 get_espts_dir(char *source, char *espts_dir)
15 {
16 /* general defintions */
17 int i;
18 int len1,len2;
19 
20 /*
21  * exec sql begin declare section;
22  */
23 #line 17 "get_espts_dir.ec"
24 #line 18 "get_espts_dir.ec"
25  char src[2];
26  char sub_dir[21];
27 /*
28  * exec sql end declare section;
29  */
30 #line 20 "get_espts_dir.ec"
31 
32 
33  /* open up the database */
34 /*
35  * $database "fastetc";
36  */
37 #line 23 "get_espts_dir.ec"
38  {
39 #line 23 "get_espts_dir.ec"
40  sqli_db_open("fastetc", 0);
41 #line 23 "get_espts_dir.ec"
42  }
43  if(sqlca.sqlcode)
44  {
45  printf("database did not open (%d)\n",sqlca.sqlcode);
46  exit(0);
47  }
48 
49  strcpy(src,source);
50  len1=strlen("espts_dir");
51  get_apps_defaults("espts_dir",&len1,espts_dir,&len2);
52 
53 /*
54  * $select espts_dir into $sub_dir from espts_dir where src=$src;
55  */
56 #line 34 "get_espts_dir.ec"
57  {
58 #line 34 "get_espts_dir.ec"
59  static const char *sqlcmdtxt[] =
60 #line 34 "get_espts_dir.ec"
61  {
62 #line 34 "get_espts_dir.ec"
63  "select espts_dir from espts_dir where src = ?",
64  0
65  };
66 #line 34 "get_espts_dir.ec"
67 static ifx_cursor_t _SQ0 = {0};
68  static ifx_sqlvar_t _sqibind[] =
69  {
70  { 100, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
71 #line 34 "get_espts_dir.ec"
72  };
73  static ifx_sqlvar_t _sqobind[] =
74  {
75  { 100, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
76 #line 34 "get_espts_dir.ec"
77  };
78 #line 34 "get_espts_dir.ec"
79  _sqibind[0].sqldata = src;
80 #line 34 "get_espts_dir.ec"
81  _sqobind[0].sqldata = sub_dir;
82 #line 34 "get_espts_dir.ec"
83  sqli_slct(ESQLINTVERSION, &_SQ0,sqlcmdtxt,1,_sqibind,1,_sqobind,0,(ifx_literal_t *)0,(ifx_namelist_t *)0,0);
84 #line 34 "get_espts_dir.ec"
85  }
86  if(!sqlca.sqlcode)
87  strcat(espts_dir,sub_dir);
88  else
89  *(espts_dir)='\0';
90 
91  return(0);
92 }
93 
94 #line 41 "get_espts_dir.ec"
int get_apps_defaults(char *request, int *request_len, char *reply, int *reply_len)
static int i
struct sqlca_s sqlca
get_espts_dir(char *source, char *espts_dir)
Definition: get_espts_dir.c:14
printf("fbuf is %s\n", fbuf)
int len1
Definition: mapp2h.h:48
int len2
Definition: mapp2h.h:48
long sqlcode
Definition: db.c:44