0000: 2f 2a 0a 2a 2a 20 32 30 30 36 20 4a 75 6e 65 20 /*.** 2006 June
0010: 37 0a 2a 2a 0a 2a 2a 20 54 68 65 20 61 75 74 68 7.**.** The auth
0020: 6f 72 20 64 69 73 63 6c 61 69 6d 73 20 63 6f 70 or disclaims cop
0030: 79 72 69 67 68 74 20 74 6f 20 74 68 69 73 20 73 yright to this s
0040: 6f 75 72 63 65 20 63 6f 64 65 2e 20 20 49 6e 20 ource code. In
0050: 70 6c 61 63 65 20 6f 66 0a 2a 2a 20 61 20 6c 65 place of.** a le
0060: 67 61 6c 20 6e 6f 74 69 63 65 2c 20 68 65 72 65 gal notice, here
0070: 20 69 73 20 61 20 62 6c 65 73 73 69 6e 67 3a 0a is a blessing:.
0080: 2a 2a 0a 2a 2a 20 20 20 20 4d 61 79 20 79 6f 75 **.** May you
0090: 20 64 6f 20 67 6f 6f 64 20 61 6e 64 20 6e 6f 74 do good and not
00a0: 20 65 76 69 6c 2e 0a 2a 2a 20 20 20 20 4d 61 79 evil..** May
00b0: 20 79 6f 75 20 66 69 6e 64 20 66 6f 72 67 69 76 you find forgiv
00c0: 65 6e 65 73 73 20 66 6f 72 20 79 6f 75 72 73 65 eness for yourse
00d0: 6c 66 20 61 6e 64 20 66 6f 72 67 69 76 65 20 6f lf and forgive o
00e0: 74 68 65 72 73 2e 0a 2a 2a 20 20 20 20 4d 61 79 thers..** May
00f0: 20 79 6f 75 20 73 68 61 72 65 20 66 72 65 65 6c you share freel
0100: 79 2c 20 6e 65 76 65 72 20 74 61 6b 69 6e 67 20 y, never taking
0110: 6d 6f 72 65 20 74 68 61 6e 20 79 6f 75 20 67 69 more than you gi
0120: 76 65 2e 0a 2a 2a 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a ve..**.*********
0130: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0140: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0150: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0160: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0170: 0a 2a 2a 20 54 68 69 73 20 66 69 6c 65 20 63 6f .** This file co
0180: 6e 74 61 69 6e 73 20 63 6f 64 65 20 75 73 65 64 ntains code used
0190: 20 74 6f 20 64 79 6e 61 6d 69 63 61 6c 6c 79 20 to dynamically
01a0: 6c 6f 61 64 20 65 78 74 65 6e 73 69 6f 6e 73 20 load extensions
01b0: 69 6e 74 6f 0a 2a 2a 20 74 68 65 20 53 51 4c 69 into.** the SQLi
01c0: 74 65 20 6c 69 62 72 61 72 79 2e 0a 2a 2f 0a 23 te library..*/.#
01d0: 69 66 6e 64 65 66 20 53 51 4c 49 54 45 5f 4f 4d ifndef SQLITE_OM
01e0: 49 54 5f 4c 4f 41 44 5f 45 58 54 45 4e 53 49 4f IT_LOAD_EXTENSIO
01f0: 4e 0a 0a 23 64 65 66 69 6e 65 20 53 51 4c 49 54 N..#define SQLIT
0200: 45 5f 43 4f 52 45 20 31 20 20 2f 2a 20 44 69 73 E_CORE 1 /* Dis
0210: 61 62 6c 65 20 74 68 65 20 41 50 49 20 72 65 64 able the API red
0220: 65 66 69 6e 69 74 69 6f 6e 20 69 6e 20 73 71 6c efinition in sql
0230: 69 74 65 33 65 78 74 2e 68 20 2a 2f 0a 23 69 6e ite3ext.h */.#in
0240: 63 6c 75 64 65 20 22 73 71 6c 69 74 65 33 65 78 clude "sqlite3ex
0250: 74 2e 68 22 0a 23 69 6e 63 6c 75 64 65 20 22 73 t.h".#include "s
0260: 71 6c 69 74 65 49 6e 74 2e 68 22 0a 23 69 6e 63 qliteInt.h".#inc
0270: 6c 75 64 65 20 3c 73 74 72 69 6e 67 2e 68 3e 0a lude <string.h>.
0280: 23 69 6e 63 6c 75 64 65 20 3c 63 74 79 70 65 2e #include <ctype.
0290: 68 3e 0a 0a 2f 2a 0a 2a 2a 20 53 6f 6d 65 20 41 h>../*.** Some A
02a0: 50 49 20 72 6f 75 74 69 6e 65 73 20 61 72 65 20 PI routines are
02b0: 6f 6d 69 74 74 65 64 20 77 68 65 6e 20 76 61 72 omitted when var
02c0: 69 6f 75 73 20 66 65 61 74 75 72 65 73 20 61 72 ious features ar
02d0: 65 0a 2a 2a 20 65 78 63 6c 75 64 65 64 20 66 72 e.** excluded fr
02e0: 6f 6d 20 61 20 62 75 69 6c 64 20 6f 66 20 53 51 om a build of SQ
02f0: 4c 69 74 65 2e 20 20 53 75 62 73 74 69 74 75 74 Lite. Substitut
0300: 65 20 61 20 4e 55 4c 4c 20 70 6f 69 6e 74 65 72 e a NULL pointer
0310: 0a 2a 2a 20 66 6f 72 20 61 6e 79 20 6d 69 73 73 .** for any miss
0320: 69 6e 67 20 41 50 49 73 2e 0a 2a 2f 0a 23 69 66 ing APIs..*/.#if
0330: 6e 64 65 66 20 53 51 4c 49 54 45 5f 45 4e 41 42 ndef SQLITE_ENAB
0340: 4c 45 5f 43 4f 4c 55 4d 4e 5f 4d 45 54 41 44 41 LE_COLUMN_METADA
0350: 54 41 0a 23 20 64 65 66 69 6e 65 20 73 71 6c 69 TA.# define sqli
0360: 74 65 33 5f 63 6f 6c 75 6d 6e 5f 64 61 74 61 62 te3_column_datab
0370: 61 73 65 5f 6e 61 6d 65 20 20 20 30 0a 23 20 64 ase_name 0.# d
0380: 65 66 69 6e 65 20 73 71 6c 69 74 65 33 5f 63 6f efine sqlite3_co
0390: 6c 75 6d 6e 5f 64 61 74 61 62 61 73 65 5f 6e 61 lumn_database_na
03a0: 6d 65 31 36 20 30 0a 23 20 64 65 66 69 6e 65 20 me16 0.# define
03b0: 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 74 sqlite3_column_t
03c0: 61 62 6c 65 5f 6e 61 6d 65 20 20 20 20 20 20 30 able_name 0
03d0: 0a 23 20 64 65 66 69 6e 65 20 73 71 6c 69 74 65 .# define sqlite
03e0: 33 5f 63 6f 6c 75 6d 6e 5f 74 61 62 6c 65 5f 6e 3_column_table_n
03f0: 61 6d 65 31 36 20 20 20 20 30 0a 23 20 64 65 66 ame16 0.# def
0400: 69 6e 65 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 ine sqlite3_colu
0410: 6d 6e 5f 6f 72 69 67 69 6e 5f 6e 61 6d 65 20 20 mn_origin_name
0420: 20 20 20 30 0a 23 20 64 65 66 69 6e 65 20 73 71 0.# define sq
0430: 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 6f 72 69 lite3_column_ori
0440: 67 69 6e 5f 6e 61 6d 65 31 36 20 20 20 30 0a 23 gin_name16 0.#
0450: 20 64 65 66 69 6e 65 20 73 71 6c 69 74 65 33 5f define sqlite3_
0460: 74 61 62 6c 65 5f 63 6f 6c 75 6d 6e 5f 6d 65 74 table_column_met
0470: 61 64 61 74 61 20 20 30 0a 23 65 6e 64 69 66 0a adata 0.#endif.
0480: 0a 23 69 66 64 65 66 20 53 51 4c 49 54 45 5f 4f .#ifdef SQLITE_O
0490: 4d 49 54 5f 41 55 54 48 4f 52 49 5a 41 54 49 4f MIT_AUTHORIZATIO
04a0: 4e 0a 23 20 64 65 66 69 6e 65 20 73 71 6c 69 74 N.# define sqlit
04b0: 65 33 5f 73 65 74 5f 61 75 74 68 6f 72 69 7a 65 e3_set_authorize
04c0: 72 20 20 20 20 20 30 0a 23 65 6e 64 69 66 0a 0a r 0.#endif..
04d0: 23 69 66 64 65 66 20 53 51 4c 49 54 45 5f 4f 4d #ifdef SQLITE_OM
04e0: 49 54 5f 55 54 46 31 36 0a 23 20 64 65 66 69 6e IT_UTF16.# defin
04f0: 65 20 73 71 6c 69 74 65 33 5f 62 69 6e 64 5f 74 e sqlite3_bind_t
0500: 65 78 74 31 36 20 20 20 20 20 20 20 20 30 0a 23 ext16 0.#
0510: 20 64 65 66 69 6e 65 20 73 71 6c 69 74 65 33 5f define sqlite3_
0520: 63 6f 6c 6c 61 74 69 6f 6e 5f 6e 65 65 64 65 64 collation_needed
0530: 31 36 20 30 0a 23 20 64 65 66 69 6e 65 20 73 71 16 0.# define sq
0540: 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 64 65 63 lite3_column_dec
0550: 6c 74 79 70 65 31 36 20 20 30 0a 23 20 64 65 66 ltype16 0.# def
0560: 69 6e 65 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 ine sqlite3_colu
0570: 6d 6e 5f 6e 61 6d 65 31 36 20 20 20 20 20 20 30 mn_name16 0
0580: 0a 23 20 64 65 66 69 6e 65 20 73 71 6c 69 74 65 .# define sqlite
0590: 33 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 31 36 20 3_column_text16
05a0: 20 20 20 20 20 30 0a 23 20 64 65 66 69 6e 65 20 0.# define
05b0: 73 71 6c 69 74 65 33 5f 63 6f 6d 70 6c 65 74 65 sqlite3_complete
05c0: 31 36 20 20 20 20 20 20 20 20 20 30 0a 23 20 64 16 0.# d
05d0: 65 66 69 6e 65 20 73 71 6c 69 74 65 33 5f 63 72 efine sqlite3_cr
05e0: 65 61 74 65 5f 63 6f 6c 6c 61 74 69 6f 6e 31 36 eate_collation16
05f0: 20 30 0a 23 20 64 65 66 69 6e 65 20 73 71 6c 69 0.# define sqli
0600: 74 65 33 5f 63 72 65 61 74 65 5f 66 75 6e 63 74 te3_create_funct
0610: 69 6f 6e 31 36 20 20 30 0a 23 20 64 65 66 69 6e ion16 0.# defin
0620: 65 20 73 71 6c 69 74 65 33 5f 65 72 72 6d 73 67 e sqlite3_errmsg
0630: 31 36 20 20 20 20 20 20 20 20 20 20 20 30 0a 23 16 0.#
0640: 20 64 65 66 69 6e 65 20 73 71 6c 69 74 65 33 5f define sqlite3_
0650: 6f 70 65 6e 31 36 20 20 20 20 20 20 20 20 20 20 open16
0660: 20 20 20 30 0a 23 20 64 65 66 69 6e 65 20 73 71 0.# define sq
0670: 6c 69 74 65 33 5f 70 72 65 70 61 72 65 31 36 20 lite3_prepare16
0680: 20 20 20 20 20 20 20 20 20 30 0a 23 20 64 65 66 0.# def
0690: 69 6e 65 20 73 71 6c 69 74 65 33 5f 72 65 73 75 ine sqlite3_resu
06a0: 6c 74 5f 65 72 72 6f 72 31 36 20 20 20 20 20 30 lt_error16 0
06b0: 0a 23 20 64 65 66 69 6e 65 20 73 71 6c 69 74 65 .# define sqlite
06c0: 33 5f 72 65 73 75 6c 74 5f 74 65 78 74 31 36 20 3_result_text16
06d0: 20 20 20 20 20 30 0a 23 20 64 65 66 69 6e 65 20 0.# define
06e0: 73 71 6c 69 74 65 33 5f 72 65 73 75 6c 74 5f 74 sqlite3_result_t
06f0: 65 78 74 31 36 62 65 20 20 20 20 30 0a 23 20 64 ext16be 0.# d
0700: 65 66 69 6e 65 20 73 71 6c 69 74 65 33 5f 72 65 efine sqlite3_re
0710: 73 75 6c 74 5f 74 65 78 74 31 36 6c 65 20 20 20 sult_text16le
0720: 20 30 0a 23 20 64 65 66 69 6e 65 20 73 71 6c 69 0.# define sqli
0730: 74 65 33 5f 76 61 6c 75 65 5f 74 65 78 74 31 36 te3_value_text16
0740: 20 20 20 20 20 20 20 30 0a 23 20 64 65 66 69 6e 0.# defin
0750: 65 20 73 71 6c 69 74 65 33 5f 76 61 6c 75 65 5f e sqlite3_value_
0760: 74 65 78 74 31 36 62 65 20 20 20 20 20 30 0a 23 text16be 0.#
0770: 20 64 65 66 69 6e 65 20 73 71 6c 69 74 65 33 5f define sqlite3_
0780: 76 61 6c 75 65 5f 74 65 78 74 31 36 6c 65 20 20 value_text16le
0790: 20 20 20 30 0a 23 65 6e 64 69 66 0a 0a 23 69 66 0.#endif..#if
07a0: 64 65 66 20 53 51 4c 49 54 45 5f 4f 4d 49 54 5f def SQLITE_OMIT_
07b0: 43 4f 4d 50 4c 45 54 45 0a 23 20 64 65 66 69 6e COMPLETE.# defin
07c0: 65 20 73 71 6c 69 74 65 33 5f 63 6f 6d 70 6c 65 e sqlite3_comple
07d0: 74 65 20 30 0a 23 20 64 65 66 69 6e 65 20 73 71 te 0.# define sq
07e0: 6c 69 74 65 33 5f 63 6f 6d 70 6c 65 74 65 31 36 lite3_complete16
07f0: 20 30 0a 23 65 6e 64 69 66 0a 0a 23 69 66 64 65 0.#endif..#ifde
0800: 66 20 53 51 4c 49 54 45 5f 4f 4d 49 54 5f 50 52 f SQLITE_OMIT_PR
0810: 4f 47 52 45 53 53 5f 43 41 4c 4c 42 41 43 4b 0a OGRESS_CALLBACK.
0820: 23 20 64 65 66 69 6e 65 20 73 71 6c 69 74 65 33 # define sqlite3
0830: 5f 70 72 6f 67 72 65 73 73 5f 68 61 6e 64 6c 65 _progress_handle
0840: 72 20 30 0a 23 65 6e 64 69 66 0a 0a 23 69 66 64 r 0.#endif..#ifd
0850: 65 66 20 53 51 4c 49 54 45 5f 4f 4d 49 54 5f 56 ef SQLITE_OMIT_V
0860: 49 52 54 55 41 4c 54 41 42 4c 45 0a 23 20 64 65 IRTUALTABLE.# de
0870: 66 69 6e 65 20 73 71 6c 69 74 65 33 5f 63 72 65 fine sqlite3_cre
0880: 61 74 65 5f 6d 6f 64 75 6c 65 20 30 0a 23 20 64 ate_module 0.# d
0890: 65 66 69 6e 65 20 73 71 6c 69 74 65 33 5f 64 65 efine sqlite3_de
08a0: 63 6c 61 72 65 5f 76 74 61 62 20 30 0a 23 65 6e clare_vtab 0.#en
08b0: 64 69 66 0a 0a 2f 2a 0a 2a 2a 20 54 68 65 20 66 dif../*.** The f
08c0: 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 75 ollowing structu
08d0: 72 65 20 63 6f 6e 74 61 69 6e 73 20 70 6f 69 6e re contains poin
08e0: 74 65 72 73 20 74 6f 20 61 6c 6c 20 53 51 4c 69 ters to all SQLi
08f0: 74 65 20 41 50 49 20 72 6f 75 74 69 6e 65 73 2e te API routines.
0900: 0a 2a 2a 20 41 20 70 6f 69 6e 74 65 72 20 74 6f .** A pointer to
0910: 20 74 68 69 73 20 73 74 72 75 63 74 75 72 65 20 this structure
0920: 69 73 20 70 61 73 73 65 64 20 69 6e 74 6f 20 65 is passed into e
0930: 78 74 65 6e 73 69 6f 6e 73 20 77 68 65 6e 20 74 xtensions when t
0940: 68 65 79 20 61 72 65 0a 2a 2a 20 6c 6f 61 64 65 hey are.** loade
0950: 64 20 73 6f 20 74 68 61 74 20 74 68 65 20 65 78 d so that the ex
0960: 74 65 6e 73 69 6f 6e 20 63 61 6e 20 6d 61 6b 65 tension can make
0970: 20 63 61 6c 6c 73 20 62 61 63 6b 20 69 6e 74 6f calls back into
0980: 20 74 68 65 20 53 51 4c 69 74 65 0a 2a 2a 20 6c the SQLite.** l
0990: 69 62 72 61 72 79 2e 0a 2a 2a 0a 2a 2a 20 57 68 ibrary..**.** Wh
09a0: 65 6e 20 61 64 64 69 6e 67 20 6e 65 77 20 41 50 en adding new AP
09b0: 49 73 2c 20 61 64 64 20 74 68 65 6d 20 74 6f 20 Is, add them to
09c0: 74 68 65 20 62 6f 74 74 6f 6d 20 6f 66 20 74 68 the bottom of th
09d0: 69 73 20 73 74 72 75 63 74 75 72 65 0a 2a 2a 20 is structure.**
09e0: 69 6e 20 6f 72 64 65 72 20 74 6f 20 70 72 65 73 in order to pres
09f0: 65 72 76 65 20 62 61 63 6b 77 61 72 64 73 20 63 erve backwards c
0a00: 6f 6d 70 61 74 69 62 69 6c 69 74 79 2e 0a 2a 2a ompatibility..**
0a10: 0a 2a 2a 20 45 78 74 65 6e 73 69 6f 6e 73 20 74 .** Extensions t
0a20: 68 61 74 20 75 73 65 20 6e 65 77 65 72 20 41 50 hat use newer AP
0a30: 49 73 20 73 68 6f 75 6c 64 20 66 69 72 73 74 20 Is should first
0a40: 63 61 6c 6c 20 74 68 65 0a 2a 2a 20 73 71 6c 69 call the.** sqli
0a50: 74 65 33 5f 6c 69 62 76 65 72 73 69 6f 6e 5f 6e te3_libversion_n
0a60: 75 6d 62 65 72 28 29 20 74 6f 20 6d 61 6b 65 20 umber() to make
0a70: 73 75 72 65 20 74 68 61 74 20 74 68 65 20 41 50 sure that the AP
0a80: 49 20 74 68 65 79 0a 2a 2a 20 69 6e 74 65 6e 64 I they.** intend
0a90: 20 74 6f 20 75 73 65 20 69 73 20 73 75 70 70 6f to use is suppo
0aa0: 72 74 65 64 20 62 79 20 74 68 65 20 6c 69 62 72 rted by the libr
0ab0: 61 72 79 2e 20 20 45 78 74 65 6e 73 69 6f 6e 73 ary. Extensions
0ac0: 20 73 68 6f 75 6c 64 0a 2a 2a 20 61 6c 73 6f 20 should.** also
0ad0: 63 68 65 63 6b 20 74 6f 20 6d 61 6b 65 20 73 75 check to make su
0ae0: 72 65 20 74 68 61 74 20 74 68 65 20 70 6f 69 6e re that the poin
0af0: 74 65 72 20 74 6f 20 74 68 65 20 66 75 6e 63 74 ter to the funct
0b00: 69 6f 6e 20 69 73 0a 2a 2a 20 6e 6f 74 20 4e 55 ion is.** not NU
0b10: 4c 4c 20 62 65 66 6f 72 65 20 63 61 6c 6c 69 6e LL before callin
0b20: 67 20 69 74 2e 0a 2a 2f 0a 63 6f 6e 73 74 20 73 g it..*/.const s
0b30: 71 6c 69 74 65 33 5f 61 70 69 5f 72 6f 75 74 69 qlite3_api_routi
0b40: 6e 65 73 20 73 71 6c 69 74 65 33 5f 61 70 69 20 nes sqlite3_api
0b50: 3d 20 7b 0a 20 20 73 71 6c 69 74 65 33 5f 61 67 = {. sqlite3_ag
0b60: 67 72 65 67 61 74 65 5f 63 6f 6e 74 65 78 74 2c gregate_context,
0b70: 0a 20 20 73 71 6c 69 74 65 33 5f 61 67 67 72 65 . sqlite3_aggre
0b80: 67 61 74 65 5f 63 6f 75 6e 74 2c 0a 20 20 73 71 gate_count,. sq
0b90: 6c 69 74 65 33 5f 62 69 6e 64 5f 62 6c 6f 62 2c lite3_bind_blob,
0ba0: 0a 20 20 73 71 6c 69 74 65 33 5f 62 69 6e 64 5f . sqlite3_bind_
0bb0: 64 6f 75 62 6c 65 2c 0a 20 20 73 71 6c 69 74 65 double,. sqlite
0bc0: 33 5f 62 69 6e 64 5f 69 6e 74 2c 0a 20 20 73 71 3_bind_int,. sq
0bd0: 6c 69 74 65 33 5f 62 69 6e 64 5f 69 6e 74 36 34 lite3_bind_int64
0be0: 2c 0a 20 20 73 71 6c 69 74 65 33 5f 62 69 6e 64 ,. sqlite3_bind
0bf0: 5f 6e 75 6c 6c 2c 0a 20 20 73 71 6c 69 74 65 33 _null,. sqlite3
0c00: 5f 62 69 6e 64 5f 70 61 72 61 6d 65 74 65 72 5f _bind_parameter_
0c10: 63 6f 75 6e 74 2c 0a 20 20 73 71 6c 69 74 65 33 count,. sqlite3
0c20: 5f 62 69 6e 64 5f 70 61 72 61 6d 65 74 65 72 5f _bind_parameter_
0c30: 69 6e 64 65 78 2c 0a 20 20 73 71 6c 69 74 65 33 index,. sqlite3
0c40: 5f 62 69 6e 64 5f 70 61 72 61 6d 65 74 65 72 5f _bind_parameter_
0c50: 6e 61 6d 65 2c 0a 20 20 73 71 6c 69 74 65 33 5f name,. sqlite3_
0c60: 62 69 6e 64 5f 74 65 78 74 2c 0a 20 20 73 71 6c bind_text,. sql
0c70: 69 74 65 33 5f 62 69 6e 64 5f 74 65 78 74 31 36 ite3_bind_text16
0c80: 2c 0a 20 20 73 71 6c 69 74 65 33 5f 62 69 6e 64 ,. sqlite3_bind
0c90: 5f 76 61 6c 75 65 2c 0a 20 20 73 71 6c 69 74 65 _value,. sqlite
0ca0: 33 5f 62 75 73 79 5f 68 61 6e 64 6c 65 72 2c 0a 3_busy_handler,.
0cb0: 20 20 73 71 6c 69 74 65 33 5f 62 75 73 79 5f 74 sqlite3_busy_t
0cc0: 69 6d 65 6f 75 74 2c 0a 20 20 73 71 6c 69 74 65 imeout,. sqlite
0cd0: 33 5f 63 68 61 6e 67 65 73 2c 0a 20 20 73 71 6c 3_changes,. sql
0ce0: 69 74 65 33 5f 63 6c 6f 73 65 2c 0a 20 20 73 71 ite3_close,. sq
0cf0: 6c 69 74 65 33 5f 63 6f 6c 6c 61 74 69 6f 6e 5f lite3_collation_
0d00: 6e 65 65 64 65 64 2c 0a 20 20 73 71 6c 69 74 65 needed,. sqlite
0d10: 33 5f 63 6f 6c 6c 61 74 69 6f 6e 5f 6e 65 65 64 3_collation_need
0d20: 65 64 31 36 2c 0a 20 20 73 71 6c 69 74 65 33 5f ed16,. sqlite3_
0d30: 63 6f 6c 75 6d 6e 5f 62 6c 6f 62 2c 0a 20 20 73 column_blob,. s
0d40: 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 62 79 qlite3_column_by
0d50: 74 65 73 2c 0a 20 20 73 71 6c 69 74 65 33 5f 63 tes,. sqlite3_c
0d60: 6f 6c 75 6d 6e 5f 62 79 74 65 73 31 36 2c 0a 20 olumn_bytes16,.
0d70: 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f sqlite3_column_
0d80: 63 6f 75 6e 74 2c 0a 20 20 73 71 6c 69 74 65 33 count,. sqlite3
0d90: 5f 63 6f 6c 75 6d 6e 5f 64 61 74 61 62 61 73 65 _column_database
0da0: 5f 6e 61 6d 65 2c 0a 20 20 73 71 6c 69 74 65 33 _name,. sqlite3
0db0: 5f 63 6f 6c 75 6d 6e 5f 64 61 74 61 62 61 73 65 _column_database
0dc0: 5f 6e 61 6d 65 31 36 2c 0a 20 20 73 71 6c 69 74 _name16,. sqlit
0dd0: 65 33 5f 63 6f 6c 75 6d 6e 5f 64 65 63 6c 74 79 e3_column_declty
0de0: 70 65 2c 0a 20 20 73 71 6c 69 74 65 33 5f 63 6f pe,. sqlite3_co
0df0: 6c 75 6d 6e 5f 64 65 63 6c 74 79 70 65 31 36 2c lumn_decltype16,
0e00: 0a 20 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d . sqlite3_colum
0e10: 6e 5f 64 6f 75 62 6c 65 2c 0a 20 20 73 71 6c 69 n_double,. sqli
0e20: 74 65 33 5f 63 6f 6c 75 6d 6e 5f 69 6e 74 2c 0a te3_column_int,.
0e30: 20 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e sqlite3_column
0e40: 5f 69 6e 74 36 34 2c 0a 20 20 73 71 6c 69 74 65 _int64,. sqlite
0e50: 33 5f 63 6f 6c 75 6d 6e 5f 6e 61 6d 65 2c 0a 20 3_column_name,.
0e60: 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f sqlite3_column_
0e70: 6e 61 6d 65 31 36 2c 0a 20 20 73 71 6c 69 74 65 name16,. sqlite
0e80: 33 5f 63 6f 6c 75 6d 6e 5f 6f 72 69 67 69 6e 5f 3_column_origin_
0e90: 6e 61 6d 65 2c 0a 20 20 73 71 6c 69 74 65 33 5f name,. sqlite3_
0ea0: 63 6f 6c 75 6d 6e 5f 6f 72 69 67 69 6e 5f 6e 61 column_origin_na
0eb0: 6d 65 31 36 2c 0a 20 20 73 71 6c 69 74 65 33 5f me16,. sqlite3_
0ec0: 63 6f 6c 75 6d 6e 5f 74 61 62 6c 65 5f 6e 61 6d column_table_nam
0ed0: 65 2c 0a 20 20 73 71 6c 69 74 65 33 5f 63 6f 6c e,. sqlite3_col
0ee0: 75 6d 6e 5f 74 61 62 6c 65 5f 6e 61 6d 65 31 36 umn_table_name16
0ef0: 2c 0a 20 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 ,. sqlite3_colu
0f00: 6d 6e 5f 74 65 78 74 2c 0a 20 20 73 71 6c 69 74 mn_text,. sqlit
0f10: 65 33 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 31 36 e3_column_text16
0f20: 2c 0a 20 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 ,. sqlite3_colu
0f30: 6d 6e 5f 74 79 70 65 2c 0a 20 20 73 71 6c 69 74 mn_type,. sqlit
0f40: 65 33 5f 63 6f 6c 75 6d 6e 5f 76 61 6c 75 65 2c e3_column_value,
0f50: 0a 20 20 73 71 6c 69 74 65 33 5f 63 6f 6d 6d 69 . sqlite3_commi
0f60: 74 5f 68 6f 6f 6b 2c 0a 20 20 73 71 6c 69 74 65 t_hook,. sqlite
0f70: 33 5f 63 6f 6d 70 6c 65 74 65 2c 0a 20 20 73 71 3_complete,. sq
0f80: 6c 69 74 65 33 5f 63 6f 6d 70 6c 65 74 65 31 36 lite3_complete16
0f90: 2c 0a 20 20 73 71 6c 69 74 65 33 5f 63 72 65 61 ,. sqlite3_crea
0fa0: 74 65 5f 63 6f 6c 6c 61 74 69 6f 6e 2c 0a 20 20 te_collation,.
0fb0: 73 71 6c 69 74 65 33 5f 63 72 65 61 74 65 5f 63 sqlite3_create_c
0fc0: 6f 6c 6c 61 74 69 6f 6e 31 36 2c 0a 20 20 73 71 ollation16,. sq
0fd0: 6c 69 74 65 33 5f 63 72 65 61 74 65 5f 66 75 6e lite3_create_fun
0fe0: 63 74 69 6f 6e 2c 0a 20 20 73 71 6c 69 74 65 33 ction,. sqlite3
0ff0: 5f 63 72 65 61 74 65 5f 66 75 6e 63 74 69 6f 6e _create_function
1000: 31 36 2c 0a 20 20 73 71 6c 69 74 65 33 5f 63 72 16,. sqlite3_cr
1010: 65 61 74 65 5f 6d 6f 64 75 6c 65 2c 0a 20 20 73 eate_module,. s
1020: 71 6c 69 74 65 33 5f 64 61 74 61 5f 63 6f 75 6e qlite3_data_coun
1030: 74 2c 0a 20 20 73 71 6c 69 74 65 33 5f 64 62 5f t,. sqlite3_db_
1040: 68 61 6e 64 6c 65 2c 0a 20 20 73 71 6c 69 74 65 handle,. sqlite
1050: 33 5f 64 65 63 6c 61 72 65 5f 76 74 61 62 2c 0a 3_declare_vtab,.
1060: 20 20 73 71 6c 69 74 65 33 5f 65 6e 61 62 6c 65 sqlite3_enable
1070: 5f 73 68 61 72 65 64 5f 63 61 63 68 65 2c 0a 20 _shared_cache,.
1080: 20 73 71 6c 69 74 65 33 5f 65 72 72 63 6f 64 65 sqlite3_errcode
1090: 2c 0a 20 20 73 71 6c 69 74 65 33 5f 65 72 72 6d ,. sqlite3_errm
10a0: 73 67 2c 0a 20 20 73 71 6c 69 74 65 33 5f 65 72 sg,. sqlite3_er
10b0: 72 6d 73 67 31 36 2c 0a 20 20 73 71 6c 69 74 65 rmsg16,. sqlite
10c0: 33 5f 65 78 65 63 2c 0a 20 20 73 71 6c 69 74 65 3_exec,. sqlite
10d0: 33 5f 65 78 70 69 72 65 64 2c 0a 20 20 73 71 6c 3_expired,. sql
10e0: 69 74 65 33 5f 66 69 6e 61 6c 69 7a 65 2c 0a 20 ite3_finalize,.
10f0: 20 73 71 6c 69 74 65 33 5f 66 72 65 65 2c 0a 20 sqlite3_free,.
1100: 20 73 71 6c 69 74 65 33 5f 66 72 65 65 5f 74 61 sqlite3_free_ta
1110: 62 6c 65 2c 0a 20 20 73 71 6c 69 74 65 33 5f 67 ble,. sqlite3_g
1120: 65 74 5f 61 75 74 6f 63 6f 6d 6d 69 74 2c 0a 20 et_autocommit,.
1130: 20 73 71 6c 69 74 65 33 5f 67 65 74 5f 61 75 78 sqlite3_get_aux
1140: 64 61 74 61 2c 0a 20 20 73 71 6c 69 74 65 33 5f data,. sqlite3_
1150: 67 65 74 5f 74 61 62 6c 65 2c 0a 20 20 73 71 6c get_table,. sql
1160: 69 74 65 33 5f 67 6c 6f 62 61 6c 5f 72 65 63 6f ite3_global_reco
1170: 76 65 72 2c 0a 20 20 73 71 6c 69 74 65 33 5f 69 ver,. sqlite3_i
1180: 6e 74 65 72 72 75 70 74 2c 0a 20 20 73 71 6c 69 nterrupt,. sqli
1190: 74 65 33 5f 6c 61 73 74 5f 69 6e 73 65 72 74 5f te3_last_insert_
11a0: 72 6f 77 69 64 2c 0a 20 20 73 71 6c 69 74 65 33 rowid,. sqlite3
11b0: 5f 6c 69 62 76 65 72 73 69 6f 6e 2c 0a 20 20 73 _libversion,. s
11c0: 71 6c 69 74 65 33 5f 6c 69 62 76 65 72 73 69 6f qlite3_libversio
11d0: 6e 5f 6e 75 6d 62 65 72 2c 0a 20 20 73 71 6c 69 n_number,. sqli
11e0: 74 65 33 5f 6d 61 6c 6c 6f 63 2c 0a 20 20 73 71 te3_malloc,. sq
11f0: 6c 69 74 65 33 5f 6d 70 72 69 6e 74 66 2c 0a 20 lite3_mprintf,.
1200: 20 73 71 6c 69 74 65 33 5f 6f 70 65 6e 2c 0a 20 sqlite3_open,.
1210: 20 73 71 6c 69 74 65 33 5f 6f 70 65 6e 31 36 2c sqlite3_open16,
1220: 0a 20 20 73 71 6c 69 74 65 33 5f 70 72 65 70 61 . sqlite3_prepa
1230: 72 65 2c 0a 20 20 73 71 6c 69 74 65 33 5f 70 72 re,. sqlite3_pr
1240: 65 70 61 72 65 31 36 2c 0a 20 20 73 71 6c 69 74 epare16,. sqlit
1250: 65 33 5f 70 72 6f 66 69 6c 65 2c 0a 20 20 73 71 e3_profile,. sq
1260: 6c 69 74 65 33 5f 70 72 6f 67 72 65 73 73 5f 68 lite3_progress_h
1270: 61 6e 64 6c 65 72 2c 0a 20 20 73 71 6c 69 74 65 andler,. sqlite
1280: 33 5f 72 65 61 6c 6c 6f 63 2c 0a 20 20 73 71 6c 3_realloc,. sql
1290: 69 74 65 33 5f 72 65 73 65 74 2c 0a 20 20 73 71 ite3_reset,. sq
12a0: 6c 69 74 65 33 5f 72 65 73 75 6c 74 5f 62 6c 6f lite3_result_blo
12b0: 62 2c 0a 20 20 73 71 6c 69 74 65 33 5f 72 65 73 b,. sqlite3_res
12c0: 75 6c 74 5f 64 6f 75 62 6c 65 2c 0a 20 20 73 71 ult_double,. sq
12d0: 6c 69 74 65 33 5f 72 65 73 75 6c 74 5f 65 72 72 lite3_result_err
12e0: 6f 72 2c 0a 20 20 73 71 6c 69 74 65 33 5f 72 65 or,. sqlite3_re
12f0: 73 75 6c 74 5f 65 72 72 6f 72 31 36 2c 0a 20 20 sult_error16,.
1300: 73 71 6c 69 74 65 33 5f 72 65 73 75 6c 74 5f 69 sqlite3_result_i
1310: 6e 74 2c 0a 20 20 73 71 6c 69 74 65 33 5f 72 65 nt,. sqlite3_re
1320: 73 75 6c 74 5f 69 6e 74 36 34 2c 0a 20 20 73 71 sult_int64,. sq
1330: 6c 69 74 65 33 5f 72 65 73 75 6c 74 5f 6e 75 6c lite3_result_nul
1340: 6c 2c 0a 20 20 73 71 6c 69 74 65 33 5f 72 65 73 l,. sqlite3_res
1350: 75 6c 74 5f 74 65 78 74 2c 0a 20 20 73 71 6c 69 ult_text,. sqli
1360: 74 65 33 5f 72 65 73 75 6c 74 5f 74 65 78 74 31 te3_result_text1
1370: 36 2c 0a 20 20 73 71 6c 69 74 65 33 5f 72 65 73 6,. sqlite3_res
1380: 75 6c 74 5f 74 65 78 74 31 36 62 65 2c 0a 20 20 ult_text16be,.
1390: 73 71 6c 69 74 65 33 5f 72 65 73 75 6c 74 5f 74 sqlite3_result_t
13a0: 65 78 74 31 36 6c 65 2c 0a 20 20 73 71 6c 69 74 ext16le,. sqlit
13b0: 65 33 5f 72 65 73 75 6c 74 5f 76 61 6c 75 65 2c e3_result_value,
13c0: 0a 20 20 73 71 6c 69 74 65 33 5f 72 6f 6c 6c 62 . sqlite3_rollb
13d0: 61 63 6b 5f 68 6f 6f 6b 2c 0a 20 20 73 71 6c 69 ack_hook,. sqli
13e0: 74 65 33 5f 73 65 74 5f 61 75 74 68 6f 72 69 7a te3_set_authoriz
13f0: 65 72 2c 0a 20 20 73 71 6c 69 74 65 33 5f 73 65 er,. sqlite3_se
1400: 74 5f 61 75 78 64 61 74 61 2c 0a 20 20 73 71 6c t_auxdata,. sql
1410: 69 74 65 33 5f 73 6e 70 72 69 6e 74 66 2c 0a 20 ite3_snprintf,.
1420: 20 73 71 6c 69 74 65 33 5f 73 74 65 70 2c 0a 20 sqlite3_step,.
1430: 20 73 71 6c 69 74 65 33 5f 74 61 62 6c 65 5f 63 sqlite3_table_c
1440: 6f 6c 75 6d 6e 5f 6d 65 74 61 64 61 74 61 2c 0a olumn_metadata,.
1450: 20 20 73 71 6c 69 74 65 33 5f 74 68 72 65 61 64 sqlite3_thread
1460: 5f 63 6c 65 61 6e 75 70 2c 0a 20 20 73 71 6c 69 _cleanup,. sqli
1470: 74 65 33 5f 74 6f 74 61 6c 5f 63 68 61 6e 67 65 te3_total_change
1480: 73 2c 0a 20 20 73 71 6c 69 74 65 33 5f 74 72 61 s,. sqlite3_tra
1490: 63 65 2c 0a 20 20 73 71 6c 69 74 65 33 5f 74 72 ce,. sqlite3_tr
14a0: 61 6e 73 66 65 72 5f 62 69 6e 64 69 6e 67 73 2c ansfer_bindings,
14b0: 0a 20 20 73 71 6c 69 74 65 33 5f 75 70 64 61 74 . sqlite3_updat
14c0: 65 5f 68 6f 6f 6b 2c 0a 20 20 73 71 6c 69 74 65 e_hook,. sqlite
14d0: 33 5f 75 73 65 72 5f 64 61 74 61 2c 0a 20 20 73 3_user_data,. s
14e0: 71 6c 69 74 65 33 5f 76 61 6c 75 65 5f 62 6c 6f qlite3_value_blo
14f0: 62 2c 0a 20 20 73 71 6c 69 74 65 33 5f 76 61 6c b,. sqlite3_val
1500: 75 65 5f 62 79 74 65 73 2c 0a 20 20 73 71 6c 69 ue_bytes,. sqli
1510: 74 65 33 5f 76 61 6c 75 65 5f 62 79 74 65 73 31 te3_value_bytes1
1520: 36 2c 0a 20 20 73 71 6c 69 74 65 33 5f 76 61 6c 6,. sqlite3_val
1530: 75 65 5f 64 6f 75 62 6c 65 2c 0a 20 20 73 71 6c ue_double,. sql
1540: 69 74 65 33 5f 76 61 6c 75 65 5f 69 6e 74 2c 0a ite3_value_int,.
1550: 20 20 73 71 6c 69 74 65 33 5f 76 61 6c 75 65 5f sqlite3_value_
1560: 69 6e 74 36 34 2c 0a 20 20 73 71 6c 69 74 65 33 int64,. sqlite3
1570: 5f 76 61 6c 75 65 5f 6e 75 6d 65 72 69 63 5f 74 _value_numeric_t
1580: 79 70 65 2c 0a 20 20 73 71 6c 69 74 65 33 5f 76 ype,. sqlite3_v
1590: 61 6c 75 65 5f 74 65 78 74 2c 0a 20 20 73 71 6c alue_text,. sql
15a0: 69 74 65 33 5f 76 61 6c 75 65 5f 74 65 78 74 31 ite3_value_text1
15b0: 36 2c 0a 20 20 73 71 6c 69 74 65 33 5f 76 61 6c 6,. sqlite3_val
15c0: 75 65 5f 74 65 78 74 31 36 62 65 2c 0a 20 20 73 ue_text16be,. s
15d0: 71 6c 69 74 65 33 5f 76 61 6c 75 65 5f 74 65 78 qlite3_value_tex
15e0: 74 31 36 6c 65 2c 0a 20 20 73 71 6c 69 74 65 33 t16le,. sqlite3
15f0: 5f 76 61 6c 75 65 5f 74 79 70 65 2c 0a 20 20 73 _value_type,. s
1600: 71 6c 69 74 65 33 5f 76 6d 70 72 69 6e 74 66 2c qlite3_vmprintf,
1610: 0a 20 20 2f 2a 0a 20 20 2a 2a 20 54 68 65 20 6f . /*. ** The o
1620: 72 69 67 69 6e 61 6c 20 41 50 49 20 73 65 74 20 riginal API set
1630: 65 6e 64 73 20 68 65 72 65 2e 20 20 41 6c 6c 20 ends here. All
1640: 65 78 74 65 6e 73 69 6f 6e 73 20 63 61 6e 20 63 extensions can c
1650: 61 6c 6c 20 61 6e 79 0a 20 20 2a 2a 20 6f 66 20 all any. ** of
1660: 74 68 65 20 41 50 49 73 20 61 62 6f 76 65 20 70 the APIs above p
1670: 72 6f 76 69 64 65 64 20 74 68 61 74 20 74 68 65 rovided that the
1680: 20 70 6f 69 6e 74 65 72 20 69 73 20 6e 6f 74 20 pointer is not
1690: 4e 55 4c 4c 2e 20 20 42 75 74 0a 20 20 2a 2a 20 NULL. But. **
16a0: 62 65 66 6f 72 65 20 63 61 6c 6c 69 6e 67 20 41 before calling A
16b0: 50 49 73 20 74 68 61 74 20 66 6f 6c 6c 6f 77 2c PIs that follow,
16c0: 20 65 78 74 65 6e 73 69 6f 6e 20 73 68 6f 75 6c extension shoul
16d0: 64 20 63 68 65 63 6b 20 74 68 65 0a 20 20 2a 2a d check the. **
16e0: 20 73 71 6c 69 74 65 33 5f 6c 69 62 76 65 72 73 sqlite3_libvers
16f0: 69 6f 6e 5f 6e 75 6d 62 65 72 28 29 20 74 6f 20 ion_number() to
1700: 6d 61 6b 65 20 73 75 72 65 20 74 68 65 79 20 61 make sure they a
1710: 72 65 20 64 65 61 6c 69 6e 67 20 77 69 74 68 0a re dealing with.
1720: 20 20 2a 2a 20 61 20 6c 69 62 72 61 72 79 20 74 ** a library t
1730: 68 61 74 20 69 73 20 6e 65 77 20 65 6e 6f 75 67 hat is new enoug
1740: 68 20 74 6f 20 73 75 70 70 6f 72 74 20 74 68 61 h to support tha
1750: 74 20 41 50 49 2e 0a 20 20 2a 2a 2a 2a 2a 2a 2a t API.. *******
1760: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
1770: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
1780: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
1790: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
17a0: 2a 2a 0a 20 20 2a 2f 0a 7d 3b 0a 0a 2f 2a 0a 2a **. */.};../*.*
17b0: 2a 20 54 68 65 20 77 69 6e 64 6f 77 73 20 69 6d * The windows im
17c0: 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 plementation of
17d0: 73 68 61 72 65 64 2d 6c 69 62 72 61 72 79 20 6c shared-library l
17e0: 6f 61 64 65 72 73 0a 2a 2f 0a 23 69 66 20 64 65 oaders.*/.#if de
17f0: 66 69 6e 65 64 28 5f 57 49 4e 33 32 29 20 7c 7c fined(_WIN32) ||
1800: 20 64 65 66 69 6e 65 64 28 57 49 4e 33 32 29 20 defined(WIN32)
1810: 7c 7c 20 64 65 66 69 6e 65 64 28 5f 5f 4d 49 4e || defined(__MIN
1820: 47 57 33 32 5f 5f 29 20 7c 7c 20 64 65 66 69 6e GW32__) || defin
1830: 65 64 28 5f 5f 42 4f 52 4c 41 4e 44 43 5f 5f 29 ed(__BORLANDC__)
1840: 0a 23 20 69 6e 63 6c 75 64 65 20 3c 77 69 6e 64 .# include <wind
1850: 6f 77 73 2e 68 3e 0a 23 20 64 65 66 69 6e 65 20 ows.h>.# define
1860: 53 51 4c 49 54 45 5f 4c 49 42 52 41 52 59 5f 54 SQLITE_LIBRARY_T
1870: 59 50 45 20 20 20 20 20 48 41 4e 44 4c 45 0a 23 YPE HANDLE.#
1880: 20 64 65 66 69 6e 65 20 53 51 4c 49 54 45 5f 4f define SQLITE_O
1890: 50 45 4e 5f 4c 49 42 52 41 52 59 28 41 29 20 20 PEN_LIBRARY(A)
18a0: 4c 6f 61 64 4c 69 62 72 61 72 79 28 41 29 0a 23 LoadLibrary(A).#
18b0: 20 64 65 66 69 6e 65 20 53 51 4c 49 54 45 5f 46 define SQLITE_F
18c0: 49 4e 44 5f 53 59 4d 42 4f 4c 28 41 2c 42 29 20 IND_SYMBOL(A,B)
18d0: 47 65 74 50 72 6f 63 41 64 64 72 65 73 73 28 41 GetProcAddress(A
18e0: 2c 42 29 0a 23 20 64 65 66 69 6e 65 20 53 51 4c ,B).# define SQL
18f0: 49 54 45 5f 43 4c 4f 53 45 5f 4c 49 42 52 41 52 ITE_CLOSE_LIBRAR
1900: 59 28 41 29 20 46 72 65 65 4c 69 62 72 61 72 79 Y(A) FreeLibrary
1910: 28 41 29 0a 23 65 6e 64 69 66 20 2f 2a 20 77 69 (A).#endif /* wi
1920: 6e 64 6f 77 73 20 2a 2f 0a 0a 2f 2a 0a 2a 2a 20 ndows */../*.**
1930: 54 68 65 20 75 6e 69 78 20 69 6d 70 6c 65 6d 65 The unix impleme
1940: 6e 74 61 74 69 6f 6e 20 6f 66 20 73 68 61 72 65 ntation of share
1950: 64 2d 6c 69 62 72 61 72 79 20 6c 6f 61 64 65 72 d-library loader
1960: 73 0a 2a 2f 0a 23 69 66 20 64 65 66 69 6e 65 64 s.*/.#if defined
1970: 28 48 41 56 45 5f 44 4c 4f 50 45 4e 29 20 26 26 (HAVE_DLOPEN) &&
1980: 20 21 64 65 66 69 6e 65 64 28 53 51 4c 49 54 45 !defined(SQLITE
1990: 5f 4c 49 42 52 41 52 59 5f 54 59 50 45 29 0a 23 _LIBRARY_TYPE).#
19a0: 20 69 6e 63 6c 75 64 65 20 3c 64 6c 66 63 6e 2e include <dlfcn.
19b0: 68 3e 0a 23 20 64 65 66 69 6e 65 20 53 51 4c 49 h>.# define SQLI
19c0: 54 45 5f 4c 49 42 52 41 52 59 5f 54 59 50 45 20 TE_LIBRARY_TYPE
19d0: 20 20 20 20 76 6f 69 64 2a 0a 23 20 64 65 66 69 void*.# defi
19e0: 6e 65 20 53 51 4c 49 54 45 5f 4f 50 45 4e 5f 4c ne SQLITE_OPEN_L
19f0: 49 42 52 41 52 59 28 41 29 20 20 64 6c 6f 70 65 IBRARY(A) dlope
1a00: 6e 28 41 2c 20 52 54 4c 44 5f 4e 4f 57 20 7c 20 n(A, RTLD_NOW |
1a10: 52 54 4c 44 5f 47 4c 4f 42 41 4c 29 0a 23 20 64 RTLD_GLOBAL).# d
1a20: 65 66 69 6e 65 20 53 51 4c 49 54 45 5f 46 49 4e efine SQLITE_FIN
1a30: 44 5f 53 59 4d 42 4f 4c 28 41 2c 42 29 20 64 6c D_SYMBOL(A,B) dl
1a40: 73 79 6d 28 41 2c 42 29 0a 23 20 64 65 66 69 6e sym(A,B).# defin
1a50: 65 20 53 51 4c 49 54 45 5f 43 4c 4f 53 45 5f 4c e SQLITE_CLOSE_L
1a60: 49 42 52 41 52 59 28 41 29 20 64 6c 63 6c 6f 73 IBRARY(A) dlclos
1a70: 65 28 41 29 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a e(A).#endif../*.
1a80: 2a 2a 20 41 74 74 65 6d 70 74 20 74 6f 20 6c 6f ** Attempt to lo
1a90: 61 64 20 61 6e 20 53 51 4c 69 74 65 20 65 78 74 ad an SQLite ext
1aa0: 65 6e 73 69 6f 6e 20 6c 69 62 72 61 72 79 20 63 ension library c
1ab0: 6f 6e 74 61 69 6e 65 64 20 69 6e 20 74 68 65 20 ontained in the
1ac0: 66 69 6c 65 0a 2a 2a 20 7a 46 69 6c 65 2e 20 20 file.** zFile.
1ad0: 54 68 65 20 65 6e 74 72 79 20 70 6f 69 6e 74 20 The entry point
1ae0: 69 73 20 7a 50 72 6f 63 2e 20 20 7a 50 72 6f 63 is zProc. zProc
1af0: 20 6d 61 79 20 62 65 20 30 20 69 6e 20 77 68 69 may be 0 in whi
1b00: 63 68 20 63 61 73 65 20 61 0a 2a 2a 20 64 65 66 ch case a.** def
1b10: 61 75 6c 74 20 65 6e 74 72 79 20 70 6f 69 6e 74 ault entry point
1b20: 20 6e 61 6d 65 20 28 73 71 6c 69 74 65 33 5f 65 name (sqlite3_e
1b30: 78 74 65 6e 73 69 6f 6e 5f 69 6e 69 74 29 20 69 xtension_init) i
1b40: 73 20 75 73 65 64 2e 20 20 55 73 65 0a 2a 2a 20 s used. Use.**
1b50: 6f 66 20 74 68 65 20 64 65 66 61 75 6c 74 20 6e of the default n
1b60: 61 6d 65 20 69 73 20 72 65 63 6f 6d 6d 65 6e 64 ame is recommend
1b70: 65 64 2e 0a 2a 2a 0a 2a 2a 20 52 65 74 75 72 6e ed..**.** Return
1b80: 20 53 51 4c 49 54 45 5f 4f 4b 20 6f 6e 20 73 75 SQLITE_OK on su
1b90: 63 63 65 73 73 20 61 6e 64 20 53 51 4c 49 54 45 ccess and SQLITE
1ba0: 5f 45 52 52 4f 52 20 69 66 20 73 6f 6d 65 74 68 _ERROR if someth
1bb0: 69 6e 67 20 67 6f 65 73 20 77 72 6f 6e 67 2e 0a ing goes wrong..
1bc0: 2a 2a 0a 2a 2a 20 49 66 20 61 6e 20 65 72 72 6f **.** If an erro
1bd0: 72 20 6f 63 63 75 72 73 20 61 6e 64 20 70 7a 45 r occurs and pzE
1be0: 72 72 4d 73 67 20 69 73 20 6e 6f 74 20 30 2c 20 rrMsg is not 0,
1bf0: 74 68 65 6e 20 66 69 6c 6c 20 2a 70 7a 45 72 72 then fill *pzErr
1c00: 4d 73 67 20 77 69 74 68 20 0a 2a 2a 20 65 72 72 Msg with .** err
1c10: 6f 72 20 6d 65 73 73 61 67 65 20 74 65 78 74 2e or message text.
1c20: 20 20 54 68 65 20 63 61 6c 6c 69 6e 67 20 66 75 The calling fu
1c30: 6e 63 74 69 6f 6e 20 73 68 6f 75 6c 64 20 66 72 nction should fr
1c40: 65 65 20 74 68 69 73 20 6d 65 6d 6f 72 79 0a 2a ee this memory.*
1c50: 2a 20 62 79 20 63 61 6c 6c 69 6e 67 20 73 71 6c * by calling sql
1c60: 69 74 65 33 5f 66 72 65 65 28 29 2e 0a 2a 2f 0a ite3_free()..*/.
1c70: 69 6e 74 20 73 71 6c 69 74 65 33 5f 6c 6f 61 64 int sqlite3_load
1c80: 5f 65 78 74 65 6e 73 69 6f 6e 28 0a 20 20 73 71 _extension(. sq
1c90: 6c 69 74 65 33 20 2a 64 62 2c 20 20 20 20 20 20 lite3 *db,
1ca0: 20 20 20 20 2f 2a 20 4c 6f 61 64 20 74 68 65 20 /* Load the
1cb0: 65 78 74 65 6e 73 69 6f 6e 20 69 6e 74 6f 20 74 extension into t
1cc0: 68 69 73 20 64 61 74 61 62 61 73 65 20 63 6f 6e his database con
1cd0: 6e 65 63 74 69 6f 6e 20 2a 2f 0a 20 20 63 6f 6e nection */. con
1ce0: 73 74 20 63 68 61 72 20 2a 7a 46 69 6c 65 2c 20 st char *zFile,
1cf0: 20 20 20 2f 2a 20 4e 61 6d 65 20 6f 66 20 74 68 /* Name of th
1d00: 65 20 73 68 61 72 65 64 20 6c 69 62 72 61 72 79 e shared library
1d10: 20 63 6f 6e 74 61 69 6e 69 6e 67 20 65 78 74 65 containing exte
1d20: 6e 73 69 6f 6e 20 2a 2f 0a 20 20 63 6f 6e 73 74 nsion */. const
1d30: 20 63 68 61 72 20 2a 7a 50 72 6f 63 2c 20 20 20 char *zProc,
1d40: 20 2f 2a 20 45 6e 74 72 79 20 70 6f 69 6e 74 2e /* Entry point.
1d50: 20 20 55 73 65 20 22 73 71 6c 69 74 65 33 5f 65 Use "sqlite3_e
1d60: 78 74 65 6e 73 69 6f 6e 5f 69 6e 69 74 22 20 69 xtension_init" i
1d70: 66 20 30 20 2a 2f 0a 20 20 63 68 61 72 20 2a 2a f 0 */. char **
1d80: 70 7a 45 72 72 4d 73 67 20 20 20 20 20 20 20 2f pzErrMsg /
1d90: 2a 20 50 75 74 20 65 72 72 6f 72 20 6d 65 73 73 * Put error mess
1da0: 61 67 65 20 68 65 72 65 20 69 66 20 6e 6f 74 20 age here if not
1db0: 30 20 2a 2f 0a 29 7b 0a 23 69 66 64 65 66 20 53 0 */.){.#ifdef S
1dc0: 51 4c 49 54 45 5f 4c 49 42 52 41 52 59 5f 54 59 QLITE_LIBRARY_TY
1dd0: 50 45 0a 20 20 53 51 4c 49 54 45 5f 4c 49 42 52 PE. SQLITE_LIBR
1de0: 41 52 59 5f 54 59 50 45 20 68 61 6e 64 6c 65 3b ARY_TYPE handle;
1df0: 0a 20 20 69 6e 74 20 28 2a 78 49 6e 69 74 29 28 . int (*xInit)(
1e00: 73 71 6c 69 74 65 33 2a 2c 63 68 61 72 2a 2a 2c sqlite3*,char**,
1e10: 63 6f 6e 73 74 20 73 71 6c 69 74 65 33 5f 61 70 const sqlite3_ap
1e20: 69 5f 72 6f 75 74 69 6e 65 73 2a 29 3b 0a 20 20 i_routines*);.
1e30: 63 68 61 72 20 2a 7a 45 72 72 6d 73 67 20 3d 20 char *zErrmsg =
1e40: 30 3b 0a 20 20 53 51 4c 49 54 45 5f 4c 49 42 52 0;. SQLITE_LIBR
1e50: 41 52 59 5f 54 59 50 45 20 2a 61 48 61 6e 64 6c ARY_TYPE *aHandl
1e60: 65 3b 0a 0a 20 20 2f 2a 20 54 69 63 6b 65 74 20 e;.. /* Ticket
1e70: 23 31 38 36 33 2e 20 20 54 6f 20 61 76 6f 69 64 #1863. To avoid
1e80: 20 61 20 63 72 65 61 74 69 6e 67 20 73 65 63 75 a creating secu
1e90: 72 69 74 79 20 70 72 6f 62 6c 65 6d 73 20 66 6f rity problems fo
1ea0: 72 20 6f 6c 64 65 72 0a 20 20 2a 2a 20 61 70 70 r older. ** app
1eb0: 6c 69 63 61 74 69 6f 6e 73 20 74 68 61 74 20 72 lications that r
1ec0: 65 6c 69 6e 6b 20 61 67 61 69 6e 73 74 20 6e 65 elink against ne
1ed0: 77 65 72 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 wer versions of
1ee0: 53 51 4c 69 74 65 2c 20 74 68 65 0a 20 20 2a 2a SQLite, the. **
1ef0: 20 61 62 69 6c 69 74 79 20 74 6f 20 72 75 6e 20 ability to run
1f00: 6c 6f 61 64 5f 65 78 74 65 6e 73 69 6f 6e 20 69 load_extension i
1f10: 73 20 74 75 72 6e 65 64 20 6f 66 66 20 62 79 20 s turned off by
1f20: 64 65 66 61 75 6c 74 2e 20 20 4f 6e 65 0a 20 20 default. One.
1f30: 2a 2a 20 6d 75 73 74 20 63 61 6c 6c 20 73 71 6c ** must call sql
1f40: 69 74 65 33 5f 65 6e 61 62 6c 65 5f 6c 6f 61 64 ite3_enable_load
1f50: 5f 65 78 74 65 6e 73 69 6f 6e 28 29 20 74 6f 20 _extension() to
1f60: 74 75 72 6e 20 6f 6e 20 65 78 74 65 6e 73 69 6f turn on extensio
1f70: 6e 0a 20 20 2a 2a 20 6c 6f 61 64 69 6e 67 2e 20 n. ** loading.
1f80: 20 4f 74 68 65 72 77 69 73 65 20 79 6f 75 20 67 Otherwise you g
1f90: 65 74 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 et the following
1fa0: 20 65 72 72 6f 72 2e 0a 20 20 2a 2f 0a 20 20 69 error.. */. i
1fb0: 66 28 20 28 64 62 2d 3e 66 6c 61 67 73 20 26 20 f( (db->flags &
1fc0: 53 51 4c 49 54 45 5f 4c 6f 61 64 45 78 74 65 6e SQLITE_LoadExten
1fd0: 73 69 6f 6e 29 3d 3d 30 20 29 7b 0a 20 20 20 20 sion)==0 ){.
1fe0: 69 66 28 20 70 7a 45 72 72 4d 73 67 20 29 7b 0a if( pzErrMsg ){.
1ff0: 20 20 20 20 20 20 2a 70 7a 45 72 72 4d 73 67 20 *pzErrMsg
2000: 3d 20 73 71 6c 69 74 65 33 5f 6d 70 72 69 6e 74 = sqlite3_mprint
2010: 66 28 22 6e 6f 74 20 61 75 74 68 6f 72 69 7a 65 f("not authorize
2020: 64 22 29 3b 0a 20 20 20 20 7d 0a 20 20 20 20 72 d");. }. r
2030: 65 74 75 72 6e 20 53 51 4c 49 54 45 5f 45 52 52 eturn SQLITE_ERR
2040: 4f 52 3b 0a 20 20 7d 0a 0a 20 20 69 66 28 20 7a OR;. }.. if( z
2050: 50 72 6f 63 3d 3d 30 20 29 7b 0a 20 20 20 20 7a Proc==0 ){. z
2060: 50 72 6f 63 20 3d 20 22 73 71 6c 69 74 65 33 5f Proc = "sqlite3_
2070: 65 78 74 65 6e 73 69 6f 6e 5f 69 6e 69 74 22 3b extension_init";
2080: 0a 20 20 7d 0a 0a 20 20 68 61 6e 64 6c 65 20 3d . }.. handle =
2090: 20 53 51 4c 49 54 45 5f 4f 50 45 4e 5f 4c 49 42 SQLITE_OPEN_LIB
20a0: 52 41 52 59 28 7a 46 69 6c 65 29 3b 0a 20 20 69 RARY(zFile);. i
20b0: 66 28 20 68 61 6e 64 6c 65 3d 3d 30 20 29 7b 0a f( handle==0 ){.
20c0: 20 20 20 20 69 66 28 20 70 7a 45 72 72 4d 73 67 if( pzErrMsg
20d0: 20 29 7b 0a 20 20 20 20 20 20 2a 70 7a 45 72 72 ){. *pzErr
20e0: 4d 73 67 20 3d 20 73 71 6c 69 74 65 33 5f 6d 70 Msg = sqlite3_mp
20f0: 72 69 6e 74 66 28 22 75 6e 61 62 6c 65 20 74 6f rintf("unable to
2100: 20 6f 70 65 6e 20 73 68 61 72 65 64 20 6c 69 62 open shared lib
2110: 72 61 72 79 20 5b 25 73 5d 22 2c 20 7a 46 69 6c rary [%s]", zFil
2120: 65 29 3b 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 e);. }. re
2130: 74 75 72 6e 20 53 51 4c 49 54 45 5f 45 52 52 4f turn SQLITE_ERRO
2140: 52 3b 0a 20 20 7d 0a 20 20 78 49 6e 69 74 20 3d R;. }. xInit =
2150: 20 28 69 6e 74 28 2a 29 28 73 71 6c 69 74 65 33 (int(*)(sqlite3
2160: 2a 2c 63 68 61 72 2a 2a 2c 63 6f 6e 73 74 20 73 *,char**,const s
2170: 71 6c 69 74 65 33 5f 61 70 69 5f 72 6f 75 74 69 qlite3_api_routi
2180: 6e 65 73 2a 29 29 0a 20 20 20 20 20 20 20 20 20 nes*)).
2190: 20 20 20 20 20 20 20 20 20 20 53 51 4c 49 54 45 SQLITE
21a0: 5f 46 49 4e 44 5f 53 59 4d 42 4f 4c 28 68 61 6e _FIND_SYMBOL(han
21b0: 64 6c 65 2c 20 7a 50 72 6f 63 29 3b 0a 20 20 69 dle, zProc);. i
21c0: 66 28 20 78 49 6e 69 74 3d 3d 30 20 29 7b 0a 20 f( xInit==0 ){.
21d0: 20 20 20 69 66 28 20 70 7a 45 72 72 4d 73 67 20 if( pzErrMsg
21e0: 29 7b 0a 20 20 20 20 20 20 20 2a 70 7a 45 72 72 ){. *pzErr
21f0: 4d 73 67 20 3d 20 73 71 6c 69 74 65 33 5f 6d 70 Msg = sqlite3_mp
2200: 72 69 6e 74 66 28 22 6e 6f 20 65 6e 74 72 79 20 rintf("no entry
2210: 70 6f 69 6e 74 20 5b 25 73 5d 20 69 6e 20 73 68 point [%s] in sh
2220: 61 72 65 64 20 6c 69 62 72 61 72 79 20 5b 25 73 ared library [%s
2230: 5d 22 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 ]",.
2240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2250: 20 20 20 20 20 20 20 7a 50 72 6f 63 2c 20 7a 46 zProc, zF
2260: 69 6c 65 29 3b 0a 20 20 20 20 7d 0a 20 20 20 20 ile);. }.
2270: 53 51 4c 49 54 45 5f 43 4c 4f 53 45 5f 4c 49 42 SQLITE_CLOSE_LIB
2280: 52 41 52 59 28 68 61 6e 64 6c 65 29 3b 0a 20 20 RARY(handle);.
2290: 20 20 72 65 74 75 72 6e 20 53 51 4c 49 54 45 5f return SQLITE_
22a0: 45 52 52 4f 52 3b 0a 20 20 7d 65 6c 73 65 20 69 ERROR;. }else i
22b0: 66 28 20 78 49 6e 69 74 28 64 62 2c 20 26 7a 45 f( xInit(db, &zE
22c0: 72 72 6d 73 67 2c 20 26 73 71 6c 69 74 65 33 5f rrmsg, &sqlite3_
22d0: 61 70 69 29 20 29 7b 0a 20 20 20 20 69 66 28 20 api) ){. if(
22e0: 70 7a 45 72 72 4d 73 67 20 29 7b 0a 20 20 20 20 pzErrMsg ){.
22f0: 20 20 2a 70 7a 45 72 72 4d 73 67 20 3d 20 73 71 *pzErrMsg = sq
2300: 6c 69 74 65 33 5f 6d 70 72 69 6e 74 66 28 22 65 lite3_mprintf("e
2310: 72 72 6f 72 20 64 75 72 69 6e 67 20 69 6e 69 74 rror during init
2320: 69 61 6c 69 7a 61 74 69 6f 6e 3a 20 25 73 22 2c ialization: %s",
2330: 20 7a 45 72 72 6d 73 67 29 3b 0a 20 20 20 20 7d zErrmsg);. }
2340: 0a 20 20 20 20 73 71 6c 69 74 65 33 5f 66 72 65 . sqlite3_fre
2350: 65 28 7a 45 72 72 6d 73 67 29 3b 0a 20 20 20 20 e(zErrmsg);.
2360: 53 51 4c 49 54 45 5f 43 4c 4f 53 45 5f 4c 49 42 SQLITE_CLOSE_LIB
2370: 52 41 52 59 28 68 61 6e 64 6c 65 29 3b 0a 20 20 RARY(handle);.
2380: 20 20 72 65 74 75 72 6e 20 53 51 4c 49 54 45 5f return SQLITE_
2390: 45 52 52 4f 52 3b 0a 20 20 7d 0a 0a 20 20 2f 2a ERROR;. }.. /*
23a0: 20 41 70 70 65 6e 64 20 74 68 65 20 6e 65 77 20 Append the new
23b0: 73 68 61 72 65 64 20 6c 69 62 72 61 72 79 20 68 shared library h
23c0: 61 6e 64 6c 65 20 74 6f 20 74 68 65 20 64 62 2d andle to the db-
23d0: 3e 61 45 78 74 65 6e 73 69 6f 6e 20 61 72 72 61 >aExtension arra
23e0: 79 2e 20 2a 2f 0a 20 20 64 62 2d 3e 6e 45 78 74 y. */. db->nExt
23f0: 65 6e 73 69 6f 6e 2b 2b 3b 0a 20 20 61 48 61 6e ension++;. aHan
2400: 64 6c 65 20 3d 20 73 71 6c 69 74 65 4d 61 6c 6c dle = sqliteMall
2410: 6f 63 28 73 69 7a 65 6f 66 28 68 61 6e 64 6c 65 oc(sizeof(handle
2420: 29 2a 64 62 2d 3e 6e 45 78 74 65 6e 73 69 6f 6e )*db->nExtension
2430: 29 3b 0a 20 20 69 66 28 20 61 48 61 6e 64 6c 65 );. if( aHandle
2440: 3d 3d 30 20 29 7b 0a 20 20 20 20 72 65 74 75 72 ==0 ){. retur
2450: 6e 20 53 51 4c 49 54 45 5f 4e 4f 4d 45 4d 3b 0a n SQLITE_NOMEM;.
2460: 20 20 7d 0a 20 20 69 66 28 20 64 62 2d 3e 6e 45 }. if( db->nE
2470: 78 74 65 6e 73 69 6f 6e 3e 30 20 29 7b 0a 20 20 xtension>0 ){.
2480: 20 20 6d 65 6d 63 70 79 28 61 48 61 6e 64 6c 65 memcpy(aHandle
2490: 2c 20 64 62 2d 3e 61 45 78 74 65 6e 73 69 6f 6e , db->aExtension
24a0: 2c 20 73 69 7a 65 6f 66 28 68 61 6e 64 6c 65 29 , sizeof(handle)
24b0: 2a 28 64 62 2d 3e 6e 45 78 74 65 6e 73 69 6f 6e *(db->nExtension
24c0: 2d 31 29 29 3b 0a 20 20 7d 0a 20 20 73 71 6c 69 -1));. }. sqli
24d0: 74 65 46 72 65 65 28 64 62 2d 3e 61 45 78 74 65 teFree(db->aExte
24e0: 6e 73 69 6f 6e 29 3b 0a 20 20 64 62 2d 3e 61 45 nsion);. db->aE
24f0: 78 74 65 6e 73 69 6f 6e 20 3d 20 61 48 61 6e 64 xtension = aHand
2500: 6c 65 3b 0a 0a 20 20 28 28 53 51 4c 49 54 45 5f le;.. ((SQLITE_
2510: 4c 49 42 52 41 52 59 5f 54 59 50 45 2a 29 64 62 LIBRARY_TYPE*)db
2520: 2d 3e 61 45 78 74 65 6e 73 69 6f 6e 29 5b 64 62 ->aExtension)[db
2530: 2d 3e 6e 45 78 74 65 6e 73 69 6f 6e 2d 31 5d 20 ->nExtension-1]
2540: 3d 20 68 61 6e 64 6c 65 3b 0a 20 20 72 65 74 75 = handle;. retu
2550: 72 6e 20 53 51 4c 49 54 45 5f 4f 4b 3b 0a 23 65 rn SQLITE_OK;.#e
2560: 6c 73 65 0a 20 20 69 66 28 20 70 7a 45 72 72 4d lse. if( pzErrM
2570: 73 67 20 29 7b 0a 20 20 20 20 2a 70 7a 45 72 72 sg ){. *pzErr
2580: 4d 73 67 20 3d 20 73 71 6c 69 74 65 33 5f 6d 70 Msg = sqlite3_mp
2590: 72 69 6e 74 66 28 22 65 78 74 65 6e 73 69 6f 6e rintf("extension
25a0: 20 6c 6f 61 64 69 6e 67 20 69 73 20 64 69 73 61 loading is disa
25b0: 62 6c 65 64 22 29 3b 0a 20 20 7d 0a 20 20 72 65 bled");. }. re
25c0: 74 75 72 6e 20 53 51 4c 49 54 45 5f 45 52 52 4f turn SQLITE_ERRO
25d0: 52 3b 0a 23 65 6e 64 69 66 0a 7d 0a 0a 2f 2a 0a R;.#endif.}../*.
25e0: 2a 2a 20 43 61 6c 6c 20 74 68 69 73 20 72 6f 75 ** Call this rou
25f0: 74 69 6e 65 20 77 68 65 6e 20 74 68 65 20 64 61 tine when the da
2600: 74 61 62 61 73 65 20 63 6f 6e 6e 65 63 74 69 6f tabase connectio
2610: 6e 20 69 73 20 63 6c 6f 73 69 6e 67 20 69 6e 20 n is closing in
2620: 6f 72 64 65 72 0a 2a 2a 20 74 6f 20 63 6c 65 61 order.** to clea
2630: 6e 20 75 70 20 6c 6f 61 64 65 64 20 65 78 74 65 n up loaded exte
2640: 6e 73 69 6f 6e 73 0a 2a 2f 0a 76 6f 69 64 20 73 nsions.*/.void s
2650: 71 6c 69 74 65 33 43 6c 6f 73 65 45 78 74 65 6e qlite3CloseExten
2660: 73 69 6f 6e 73 28 73 71 6c 69 74 65 33 20 2a 64 sions(sqlite3 *d
2670: 62 29 7b 0a 23 69 66 64 65 66 20 53 51 4c 49 54 b){.#ifdef SQLIT
2680: 45 5f 4c 49 42 52 41 52 59 5f 54 59 50 45 0a 20 E_LIBRARY_TYPE.
2690: 20 69 6e 74 20 69 3b 0a 20 20 66 6f 72 28 69 3d int i;. for(i=
26a0: 30 3b 20 69 3c 64 62 2d 3e 6e 45 78 74 65 6e 73 0; i<db->nExtens
26b0: 69 6f 6e 3b 20 69 2b 2b 29 7b 0a 20 20 20 20 53 ion; i++){. S
26c0: 51 4c 49 54 45 5f 43 4c 4f 53 45 5f 4c 49 42 52 QLITE_CLOSE_LIBR
26d0: 41 52 59 28 28 28 53 51 4c 49 54 45 5f 4c 49 42 ARY(((SQLITE_LIB
26e0: 52 41 52 59 5f 54 59 50 45 2a 29 64 62 2d 3e 61 RARY_TYPE*)db->a
26f0: 45 78 74 65 6e 73 69 6f 6e 29 5b 69 5d 29 3b 0a Extension)[i]);.
2700: 20 20 7d 0a 20 20 73 71 6c 69 74 65 46 72 65 65 }. sqliteFree
2710: 28 64 62 2d 3e 61 45 78 74 65 6e 73 69 6f 6e 29 (db->aExtension)
2720: 3b 0a 23 65 6e 64 69 66 0a 7d 0a 0a 2f 2a 0a 2a ;.#endif.}../*.*
2730: 2a 20 45 6e 61 62 6c 65 20 6f 72 20 64 69 73 61 * Enable or disa
2740: 62 6c 65 20 65 78 74 65 6e 73 69 6f 6e 20 6c 6f ble extension lo
2750: 61 64 69 6e 67 2e 20 20 45 78 74 65 6e 73 69 6f ading. Extensio
2760: 6e 20 6c 6f 61 64 69 6e 67 20 69 73 20 64 69 73 n loading is dis
2770: 61 62 6c 65 64 20 62 79 0a 2a 2a 20 64 65 66 61 abled by.** defa
2780: 75 6c 74 20 73 6f 20 61 73 20 6e 6f 74 20 74 6f ult so as not to
2790: 20 6f 70 65 6e 20 73 65 63 75 72 69 74 79 20 68 open security h
27a0: 6f 6c 65 73 20 69 6e 20 6f 6c 64 65 72 20 61 70 oles in older ap
27b0: 70 6c 69 63 61 74 69 6f 6e 73 2e 0a 2a 2f 0a 69 plications..*/.i
27c0: 6e 74 20 73 71 6c 69 74 65 33 5f 65 6e 61 62 6c nt sqlite3_enabl
27d0: 65 5f 6c 6f 61 64 5f 65 78 74 65 6e 73 69 6f 6e e_load_extension
27e0: 28 73 71 6c 69 74 65 33 20 2a 64 62 2c 20 69 6e (sqlite3 *db, in
27f0: 74 20 6f 6e 6f 66 66 29 7b 0a 20 20 69 66 28 20 t onoff){. if(
2800: 6f 6e 6f 66 66 20 29 7b 0a 20 20 20 20 64 62 2d onoff ){. db-
2810: 3e 66 6c 61 67 73 20 7c 3d 20 53 51 4c 49 54 45 >flags |= SQLITE
2820: 5f 4c 6f 61 64 45 78 74 65 6e 73 69 6f 6e 3b 0a _LoadExtension;.
2830: 20 20 7d 65 6c 73 65 7b 0a 20 20 20 20 64 62 2d }else{. db-
2840: 3e 66 6c 61 67 73 20 26 3d 20 7e 53 51 4c 49 54 >flags &= ~SQLIT
2850: 45 5f 4c 6f 61 64 45 78 74 65 6e 73 69 6f 6e 3b E_LoadExtension;
2860: 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 53 51 . }. return SQ
2870: 4c 49 54 45 5f 4f 4b 3b 0a 7d 0a 0a 23 65 6e 64 LITE_OK;.}..#end
2880: 69 66 20 2f 2a 20 53 51 4c 49 54 45 5f 4f 4d 49 if /* SQLITE_OMI
2890: 54 5f 4c 4f 41 44 5f 45 58 54 45 4e 53 49 4f 4e T_LOAD_EXTENSION
28a0: 20 2a 2f 0a */.