SQLite

Check-in [6902fb1b49]
Login

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

Overview
Comment:Remove the sqlite3_open_varargs() API. (CVS 1515)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6902fb1b49fdf0e38265fa26198690243cdc2f58
User & Date: danielk1977 2004-06-01 00:03:53.000
Context
2004-06-01
01:22
Add the capi3ref.html page to the website. (CVS 1516) (check-in: 89f54f1ffd user: drh tags: trunk)
00:03
Remove the sqlite3_open_varargs() API. (CVS 1515) (check-in: 6902fb1b49 user: danielk1977 tags: trunk)
2004-05-31
23:56
Remove the sqlite3_error_string() API. (CVS 1514) (check-in: af8e2006d8 user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** Main file for the SQLite library.  The routines in this file
** implement the programmer interface to the library.  Routines in
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.201 2004/05/31 23:56:43 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*
** A pointer to this structure is used to communicate information







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** Main file for the SQLite library.  The routines in this file
** implement the programmer interface to the library.  Routines in
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.202 2004/06/01 00:03:53 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*
** A pointer to this structure is used to communicate information
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
    rc = openDatabase(zFilename8, ppDb, options, TEXT_Utf16le);
  }

  sqliteFree(zFilename8);
  return rc;
}

/*
** Open a new database handle.
*/
int sqlite3_open_vararg(
  const char *filename,   /* Database filename (UTF-8) */
  sqlite3 **ppDb,         /* OUT: SQLite db handle */
  ...                     /* Option strings */
){
  va_list ap;
  const char **aOpts = 0;
  int nOpts = 0;
  int rc;

  /* Count the arguments */
  va_start(ap, ppDb);
  while( va_arg(ap, const char *) ) nOpts++;
  va_end(ap);

  /* If there are more than zero arguments, construct an array */
  if( nOpts ){
    aOpts = (const char **)sqliteMalloc(sizeof(const char *)*nOpts+1);
    if( !aOpts ){
      *ppDb = 0;
      return SQLITE_NOMEM;
    }
    va_start(ap, ppDb);
    nOpts = 0;
    while( va_arg(ap, const char *) ){
      aOpts[nOpts] = va_arg(ap, const char *);
      nOpts++;
    }
    aOpts[nOpts] = 0;
    va_end(ap);
  }
  
  /* Call the regular sqlite3_open() */
  rc = sqlite3_open(filename, ppDb, aOpts);
  if( aOpts ) sqliteFree(aOpts);
  return rc;
}

/*
** Open a new database handle.
*/
int sqlite3_open16_vararg(
  const void *filename,   /* Database filename (UTF-16) */
  sqlite3 **ppDb,         /* OUT: SQLite db handle */
  ...                     /* Option strings */
){
  va_list ap;
  const char **aOpts = 0;
  int nOpts = 0;
  int rc;

  /* Count the arguments */
  va_start(ap, ppDb);
  while( va_arg(ap, const char *) ) nOpts++;
  va_end(ap);

  /* If there are more than zero arguments, construct an array */
  if( nOpts ){
    aOpts = (const char **)sqliteMalloc(sizeof(const char *)*nOpts+1);
    if( !aOpts ){
      *ppDb = 0;
      return SQLITE_NOMEM;
    }
    va_start(ap, ppDb);
    nOpts = 0;
    while( va_arg(ap, const char *) ){
      aOpts[nOpts] = va_arg(ap, const char *);
      nOpts++;
    }
    aOpts[nOpts] = 0;
    va_end(ap);
  }
  
  /* Call the regular sqlite3_open16() */
  rc = sqlite3_open16(filename, ppDb, aOpts);
  if( aOpts ) sqliteFree(aOpts);
  return rc;
}

/*
** The following routine destroys a virtual machine that is created by
** the sqlite3_compile() routine. The integer returned is an SQLITE_
** success/failure code that describes the result of executing the virtual
** machine.
**
** This routine sets the error code and string returned by







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







1104
1105
1106
1107
1108
1109
1110


















































































1111
1112
1113
1114
1115
1116
1117
    rc = openDatabase(zFilename8, ppDb, options, TEXT_Utf16le);
  }

  sqliteFree(zFilename8);
  return rc;
}



















































































/*
** The following routine destroys a virtual machine that is created by
** the sqlite3_compile() routine. The integer returned is an SQLITE_
** success/failure code that describes the result of executing the virtual
** machine.
**
** This routine sets the error code and string returned by
Changes to src/sqlite.h.in.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the SQLite library
** presents to client programs.
**
** @(#) $Id: sqlite.h.in,v 1.88 2004/05/31 23:56:43 danielk1977 Exp $
*/
#ifndef _SQLITE_H_
#define _SQLITE_H_
#include <stdarg.h>     /* Needed for the definition of va_list */

/*
** Make sure we can call this stuff from C++.







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the SQLite library
** presents to client programs.
**
** @(#) $Id: sqlite.h.in,v 1.89 2004/06/01 00:03:53 danielk1977 Exp $
*/
#ifndef _SQLITE_H_
#define _SQLITE_H_
#include <stdarg.h>     /* Needed for the definition of va_list */

/*
** Make sure we can call this stuff from C++.
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
);
int sqlite3_open16(
  const void *filename,   /* Database filename (UTF-16) */
  sqlite3 **ppDb,         /* OUT: SQLite db handle */
  const char **args       /* Null terminated array of option strings */
);

/*
** The following two functions are identical to sqlite3_open() and
** sqlite3_open16(), except that any option strings are specified as the
** third and subsequent arguments, instead of as an array.  The final
** argument to either of the following two functions must be a NULL.
*/
int sqlite3_open_vararg(
  const char *filename,   /* Database filename (UTF-8) */
  sqlite3 **ppDb,         /* OUT: SQLite db handle */
  ...                     /* Option strings */
);
int sqlite3_open16_vararg(
  const void *filename,   /* Database filename (UTF-16) */
  sqlite3 **ppDb,         /* OUT: SQLite db handle */
  ...                     /* Option strings */
);

/*
** Return the error code for the most recent sqlite3_* API call associated
** with sqlite3 handle 'db'. SQLITE_OK is returned if the most recent 
** API call was successful.
**
** Calls to many sqlite3_* functions set the error code and string returned
** by sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16()







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







514
515
516
517
518
519
520

















521
522
523
524
525
526
527
);
int sqlite3_open16(
  const void *filename,   /* Database filename (UTF-16) */
  sqlite3 **ppDb,         /* OUT: SQLite db handle */
  const char **args       /* Null terminated array of option strings */
);


















/*
** Return the error code for the most recent sqlite3_* API call associated
** with sqlite3 handle 'db'. SQLITE_OK is returned if the most recent 
** API call was successful.
**
** Calls to many sqlite3_* functions set the error code and string returned
** by sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16()