/ Check-in [440bfd2a]
Login

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

Overview
Comment:Fix error message returned when a database cannot be opened. (CVS 1739)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 440bfd2ac57d228d10913aca81ca8c6d7f38aa61
User & Date: danielk1977 2004-06-26 10:02:16
Context
2004-06-26
12:40
Add news about the break-in to the homepage. (CVS 1740) check-in: 5cda1cda user: drh tags: trunk
10:02
Fix error message returned when a database cannot be opened. (CVS 1739) check-in: 440bfd2a user: danielk1977 tags: trunk
09:50
Minor fixes related to the tests in misuse.test (CVS 1738) check-in: 0af3ff39 user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/main.c.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
840
841
842
843
844
845
846
847



848
849
850
851
852
853
854
**
*************************************************************************
** 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.235 2004/06/26 09:50:12 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*
** A pointer to this structure is used to communicate information
................................................................................
const char *sqlite3_errmsg(sqlite3 *db){
  if( !db || !db->pErr ){
    /* If db is NULL, then assume that a malloc() failed during an
    ** sqlite3_open() call.
    */
    return sqlite3ErrStr(SQLITE_NOMEM);
  }
  if( db->magic!=SQLITE_MAGIC_OPEN && db->magic!=SQLITE_MAGIC_BUSY ){



    return sqlite3ErrStr(SQLITE_MISUSE);
  }
  if( !sqlite3_value_text(db->pErr) ){
    return sqlite3ErrStr(db->errCode);
  }
  return sqlite3_value_text(db->pErr);
}







|







 







|
>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
**
*************************************************************************
** 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.236 2004/06/26 10:02:16 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*
** A pointer to this structure is used to communicate information
................................................................................
const char *sqlite3_errmsg(sqlite3 *db){
  if( !db || !db->pErr ){
    /* If db is NULL, then assume that a malloc() failed during an
    ** sqlite3_open() call.
    */
    return sqlite3ErrStr(SQLITE_NOMEM);
  }
  if( db->magic!=SQLITE_MAGIC_OPEN && 
      db->magic!=SQLITE_MAGIC_BUSY &&
      db->magic!=SQLITE_MAGIC_CLOSED 
  ){
    return sqlite3ErrStr(SQLITE_MISUSE);
  }
  if( !sqlite3_value_text(db->pErr) ){
    return sqlite3ErrStr(db->errCode);
  }
  return sqlite3_value_text(db->pErr);
}