sqllogictest

Check-in [b5fbadd16e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improve the ability to compile and test on Windows using MinGW.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b5fbadd16ec0a3cbc2a2eb6796a9a3abbe8711b0
User & Date: mistachkin 2012-12-05 04:43:03.578
Context
2012-12-05
15:02
Fix aggregate function evidence tests to work with the scan-by-index optimization. check-in: fb12af96c2 user: drh tags: trunk
04:43
Improve the ability to compile and test on Windows using MinGW. check-in: b5fbadd16e user: mistachkin tags: trunk
2012-08-30
13:58
Update the built-in SQLite amalgamation to a 3.7.14 beta. check-in: 3a6f90e718 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Added src/Makefile.mingw.
































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#!/usr/bin/make
#
#### The suffix to add to executable files.  ".exe" for windows.
#    Nothing for unix.
#
E =

#### C Compile and options for use in building executables that 
#    will run on the target platform.
#
CC = gcc -g -Wall -DWIN32=1
#CC = gcc -g -Wall -DOMIT_ODBC=1 -fprofile-arcs -ftest-coverage
#CC += -DSQLITE_COVERAGE_TEST
CC += -DSQLITE_NO_SYNC=1

#### Extra arguments for linking the finished binary. 
#
LIB = $(LDFLAGS)

# You should not need to change anything below this line
###############################################################################
#
OBJ = \
  md5.o \
  sqlite3.o

INC = \
  slt_sqlite.c \
  slt_odbc3.c

OPTS += -DSQLITE_THREADSAFE=0

# The following OMIT options must match the OMIT options used to build
# the amalgamation.
#
OPTS += -DSQLITE_OMIT_LOAD_EXTENSION

sqllogictest$(E):	sqllogictest.c sqllogictest.h $(OBJ) $(INC)
	$(CC) -o sqllogictest$(E) sqllogictest.c $(OBJ) -lodbc32

md5.o:	md5.c
	$(CC) -c md5.c

sqlite3.o:	sqlite3.c sqlite3.h
	$(CC) -c sqlite3.c $(OPTS)

clean:
	rm -f $(OBJ)
Added src/run-all-odbc.bat.


>
1
for /R ..\test %%i in (*.test) do sqllogictest -odbc "UID=slt;" -verify %%i
Changes to src/slt_odbc3.c.
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187

188
189
190
191
192
193
194
static int ODBC3_dropAllTables(ODBC3_Handles *pODBC3conn)
{
  int rc = 0;
  SQLRETURN ret;       /* ODBC API return status */
  SQLSMALLINT columns; /* number of columns in result-set */
  ODBC3_resAccum res;          /* query result accumulator */
  SQLUSMALLINT i;
  char *zDmbsName = "unknown";
  char zSql[512];
  SQLHSTMT stmt = SQL_NULL_HSTMT;

  /* find type of db engine.  we may need to do special
   * processing based on the engine.
   */
  ODBC3GetEngineName(pODBC3conn, &zDmbsName);
  
  /* zero out accumulator structure */
  memset(&res, 0, sizeof(res));

  /* Allocate a statement handle */
  ret = SQLAllocHandle(SQL_HANDLE_STMT, pODBC3conn->dbc, &stmt);
  if( !SQL_SUCCEEDED(ret) && (ret != SQL_SUCCESS_WITH_INFO) ){
    ODBC3_perror("SQLAllocHandle", pODBC3conn->dbc, SQL_HANDLE_DBC);
    return 1;
  }

  /* Retrieve a list of tables */
  /* TBD:  do we need to drop views, triggers, etc. here? */
  ret = SQLTables(stmt, NULL, 0, NULL, 0, NULL, 0, "TABLE", SQL_NTS);

  if( !SQL_SUCCEEDED(ret) && (ret != SQL_SUCCESS_WITH_INFO) ){
    ODBC3_perror("SQLTables", stmt, SQL_HANDLE_STMT);
    rc = 1;
  }
  
  if( !rc ){
    /* How many columns are there */







|




















|
>







159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
static int ODBC3_dropAllTables(ODBC3_Handles *pODBC3conn)
{
  int rc = 0;
  SQLRETURN ret;       /* ODBC API return status */
  SQLSMALLINT columns; /* number of columns in result-set */
  ODBC3_resAccum res;          /* query result accumulator */
  SQLUSMALLINT i;
  const char *zDmbsName = "unknown";
  char zSql[512];
  SQLHSTMT stmt = SQL_NULL_HSTMT;

  /* find type of db engine.  we may need to do special
   * processing based on the engine.
   */
  ODBC3GetEngineName(pODBC3conn, &zDmbsName);
  
  /* zero out accumulator structure */
  memset(&res, 0, sizeof(res));

  /* Allocate a statement handle */
  ret = SQLAllocHandle(SQL_HANDLE_STMT, pODBC3conn->dbc, &stmt);
  if( !SQL_SUCCEEDED(ret) && (ret != SQL_SUCCESS_WITH_INFO) ){
    ODBC3_perror("SQLAllocHandle", pODBC3conn->dbc, SQL_HANDLE_DBC);
    return 1;
  }

  /* Retrieve a list of tables */
  /* TBD:  do we need to drop views, triggers, etc. here? */
  ret = SQLTables(stmt, NULL, 0, NULL, 0, NULL, 0, (SQLCHAR *)"TABLE",
                  SQL_NTS);
  if( !SQL_SUCCEEDED(ret) && (ret != SQL_SUCCESS_WITH_INFO) ){
    ODBC3_perror("SQLTables", stmt, SQL_HANDLE_STMT);
    rc = 1;
  }
  
  if( !rc ){
    /* How many columns are there */
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
    */
    char zDbName[512] = SLT_DB;
    char zUserName[512] = SLT_USER;
    char *pc1;
    char *pc2;

    pc1 = zDbName;
    pc2 = strstr(pODBC3conn->zConnStr, "DATABASE=");
    if( pc2 ){
      pc2 += 9;
      while( *pc2 && (*pc2!=';') ) *pc1++ = *pc2++;
      *pc1 = '\0';
    }

    pc1 = zUserName;
    pc2 = strstr(pODBC3conn->zConnStr, "UID=");
    if( pc2 ){
      pc2 += 4;
      while( *pc2 && (*pc2!=';') ) *pc1++ = *pc2++;
      *pc1 = '\0';
    }

    /* for each valid table found, drop it */







|







|







247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
    */
    char zDbName[512] = SLT_DB;
    char zUserName[512] = SLT_USER;
    char *pc1;
    char *pc2;

    pc1 = zDbName;
    pc2 = strstr((const char *)pODBC3conn->zConnStr, "DATABASE=");
    if( pc2 ){
      pc2 += 9;
      while( *pc2 && (*pc2!=';') ) *pc1++ = *pc2++;
      *pc1 = '\0';
    }

    pc1 = zUserName;
    pc2 = strstr((const char *)pODBC3conn->zConnStr, "UID=");
    if( pc2 ){
      pc2 += 4;
      while( *pc2 && (*pc2!=';') ) *pc1++ = *pc2++;
      *pc1 = '\0';
    }

    /* for each valid table found, drop it */