File: sqpOpen.c

package info (click to toggle)
unixodbc 2.1.1-8
  • links: PTS
  • area: main
  • in suites: woody
  • size: 12,668 kB
  • ctags: 12,486
  • sloc: ansic: 107,685; cpp: 33,663; sh: 13,300; makefile: 2,926; yacc: 499; lex: 241; sed: 93; sql: 1
file content (72 lines) | stat: -rw-r--r-- 1,616 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "sqp.h"


/*
 * Extern these in sqp.h and instantiate here. 
 *
 * Each process that uses the sqp share will get exactly one version of 
 * these. So sqp is NOT multi-thread safe but is safe across multi 
 * processes.
 *
 */
char		    g_szError[1024];

HSQPPARSEDSQL   g_hParsedSQL;

char *		    g_pszTable;
char *   	    g_pszType;
HLST		    g_hColumns;
HLST		    g_hColumnDefs;
HSQPDATATYPE    g_hDataType;
HLST		    g_hValues;
HLST		    g_hAssignments;
HLST            g_hOrderBy;
sqpOrder        g_nOrderDirection;
char *		    g_pszCursor;
int             g_nNulls;

char *		    g_pszSQLCursor;		/* yyparse position init to start of SQL string before yyparse	*/
char *		    g_pszSQLLimit;		/* ptr to NULL terminator of SQL string (yyparse stops here)	*/
int 		    g_nLineNo;

HLST            g_hParams;
HSQPCOND        g_hConds;

void sqpOpen( char *pszFirstChar, char *pszLastChar, HLST hParams )
{

#ifdef SQPDEBUG
	printf( "[SQP][%s][%d] BEGIN:\n", __FILE__, __LINE__ );
#endif

	*g_szError		    = '\0';

    g_hParsedSQL        = NULL;

	g_pszTable		    = NULL;
	g_pszType		    = NULL;
	g_hColumns		    = NULL;
	g_hColumnDefs	    = NULL;
    g_hDataType         = NULL;
	g_hValues		    = NULL;
	g_hAssignments	    = NULL;
    g_hOrderBy          = NULL;
    g_nOrderDirection   = sqpnone;
	g_pszCursor		    = NULL;
    g_nNulls            = 1;

	g_pszSQLCursor	    = pszFirstChar;
	g_pszSQLLimit	    = pszLastChar;
	g_nLineNo		    = 1;

	g_hParams		    = hParams;
    lstFirst( g_hParams );
	g_hConds		    = NULL;

#ifdef SQPDEBUG
	printf( "[SQP][%s][%d] END:\n", __FILE__, __LINE__ );
#endif

}