rhodes 2.3.2 → 2.4.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (623) hide show
  1. data/CHANGELOG +18 -0
  2. data/CREDITS +38 -0
  3. data/README.md +2 -2
  4. data/Rakefile +60 -2
  5. data/bin/set-rhodes-sdk.bat +1 -0
  6. data/doc/application.txt +11 -0
  7. data/doc/build.txt +156 -39
  8. data/doc/configuration.txt +1 -10
  9. data/doc/connect-to-web-services.txt +6 -6
  10. data/doc/device-caps.txt +48 -5
  11. data/doc/extensions.txt +8 -1
  12. data/doc/rhom.txt +16 -0
  13. data/doc/synchronization.txt +56 -14
  14. data/doc/ui.txt +23 -2
  15. data/installer/instant-rhodes.nsi +6 -6
  16. data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +4 -2
  17. data/lib/extensions/barcode/ext/barcode/platform/wm/Rakefile +1 -1
  18. data/lib/extensions/digest-md5/ext/Rakefile +3 -3
  19. data/lib/extensions/digest-md5/ext/build +0 -1
  20. data/lib/extensions/digest-sha1/ext/Rakefile +1 -1
  21. data/lib/extensions/digest-sha1/ext/build +0 -1
  22. data/lib/extensions/digest/ext/Rakefile +3 -3
  23. data/lib/extensions/digest/ext/build +0 -1
  24. data/lib/extensions/fcntl/ext/Rakefile +1 -1
  25. data/lib/extensions/mspec/mspec/guards/guard.rb +4 -0
  26. data/lib/extensions/mspec/mspec/helpers/environment.rb +4 -0
  27. data/lib/extensions/nfc/ext.yml +2 -0
  28. data/lib/extensions/nfc/ext/build +12 -0
  29. data/lib/extensions/nfc/ext/build.bat +8 -0
  30. data/lib/extensions/nfc/ext/nfc/platform/android/AndroidManifest.xml +25 -0
  31. data/lib/extensions/nfc/ext/nfc/platform/android/Rakefile +94 -0
  32. data/lib/extensions/nfc/ext/nfc/platform/android/ext_build.files +4 -0
  33. data/lib/extensions/nfc/ext/nfc/platform/android/jni/src/nfc.cpp +404 -0
  34. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/Nfc.java +138 -0
  35. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/NfcMessage.java +34 -0
  36. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/NfcMessagePack.java +33 -0
  37. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/NfcRecord.java +149 -0
  38. data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc.i +22 -0
  39. data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc_wrap.c +2034 -0
  40. data/lib/extensions/nfc/nfc.rb +120 -0
  41. data/lib/extensions/rholang/{lang_ca.rb → rholang/lang_ca.rb} +0 -0
  42. data/lib/extensions/rholang/{lang_cf.rb → rholang/lang_cf.rb} +0 -0
  43. data/lib/extensions/rholang/{lang_chef.rb → rholang/lang_chef.rb} +0 -0
  44. data/lib/extensions/rholang/{lang_cs.rb → rholang/lang_cs.rb} +0 -0
  45. data/lib/extensions/rholang/{lang_da.rb → rholang/lang_da.rb} +0 -0
  46. data/lib/extensions/rholang/{lang_de.rb → rholang/lang_de.rb} +0 -0
  47. data/lib/extensions/rholang/{lang_es.rb → rholang/lang_es.rb} +0 -0
  48. data/lib/extensions/rholang/{lang_es_ar.rb → rholang/lang_es_ar.rb} +0 -0
  49. data/lib/extensions/rholang/{lang_fi.rb → rholang/lang_fi.rb} +0 -0
  50. data/lib/extensions/rholang/{lang_fr.rb → rholang/lang_fr.rb} +0 -0
  51. data/lib/extensions/rholang/{lang_it.rb → rholang/lang_it.rb} +0 -0
  52. data/lib/extensions/rholang/{lang_ko.rb → rholang/lang_ko.rb} +0 -0
  53. data/lib/extensions/rholang/{lang_nl.rb → rholang/lang_nl.rb} +0 -0
  54. data/lib/extensions/rholang/{lang_no.rb → rholang/lang_no.rb} +0 -0
  55. data/lib/extensions/rholang/{lang_pt.rb → rholang/lang_pt.rb} +0 -0
  56. data/lib/extensions/rholang/{lang_pt_br.rb → rholang/lang_pt_br.rb} +0 -0
  57. data/lib/extensions/rholang/{lang_ru.rb → rholang/lang_ru.rb} +0 -0
  58. data/lib/extensions/rholang/{lang_se.rb → rholang/lang_se.rb} +0 -0
  59. data/lib/extensions/rholang/{lang_sr.rb → rholang/lang_sr.rb} +0 -0
  60. data/lib/extensions/rholang/{rhoerror_ru.rb → rholang/rhoerror_ru.rb} +0 -0
  61. data/lib/extensions/rholang/{rhomsg_ru.rb → rholang/rhomsg_ru.rb} +0 -0
  62. data/lib/framework/date/format.rb +2 -0
  63. data/lib/framework/dateOrig.rb +17 -8
  64. data/lib/framework/rational18.rb +532 -0
  65. data/lib/framework/res/back_btn.wp7.png +0 -0
  66. data/lib/framework/res/blue_pushpin.wp7.png +0 -0
  67. data/lib/framework/res/blue_pushpin_small.wp7.png +0 -0
  68. data/lib/framework/res/callout.wp7.png +0 -0
  69. data/lib/framework/res/callout_link.wp7.png +0 -0
  70. data/lib/framework/res/esri.wp7.png +0 -0
  71. data/lib/framework/res/forward_btn.wp7.png +0 -0
  72. data/lib/framework/res/home_btn.wp7.png +0 -0
  73. data/lib/framework/res/options_btn.wp7.png +0 -0
  74. data/lib/framework/res/refresh_btn.wp7.png +0 -0
  75. data/lib/framework/rho/render.rb +8 -1
  76. data/lib/framework/rho/rho.rb +30 -7
  77. data/lib/framework/rho/rhoapplication.rb +9 -4
  78. data/lib/framework/rho/rhofsconnector.rb +5 -1
  79. data/lib/framework/rho/rhotabbar.rb +8 -0
  80. data/lib/framework/rho/rhotoolbar.rb +1 -1
  81. data/lib/framework/rho/rhoviewhelpers.rb +18 -1
  82. data/lib/framework/rhodes.rb +1 -1
  83. data/lib/framework/rhoframework.rb +46 -1
  84. data/lib/framework/rholang/localization_simplified.rb +17 -16
  85. data/lib/framework/rhom/rhom_db_adapter.rb +2 -2
  86. data/lib/framework/rhom/rhom_object_factory.rb +115 -12
  87. data/lib/framework/rhosystem.rb +135 -0
  88. data/lib/framework/version.rb +1 -1
  89. data/lib/rhodes.rb +1 -1
  90. data/lib/test/apps/rhoconfig.txt +23 -23
  91. data/platform/android/Rhodes/AndroidManifest.full.xml +101 -0
  92. data/platform/android/Rhodes/AndroidManifest.xml +10 -15
  93. data/platform/android/Rhodes/default.properties +11 -0
  94. data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +59 -53
  95. data/platform/android/Rhodes/jni/include/rhodes.h +1 -0
  96. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesApplication.h +21 -0
  97. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_alert_PopupActivity.h +21 -0
  98. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_file_RhoFileApi.h +10 -2
  99. data/platform/android/Rhodes/jni/src/alert.cpp +2 -1
  100. data/platform/android/Rhodes/jni/src/datetimepicker.cpp +2 -0
  101. data/platform/android/Rhodes/jni/src/fileapi.cpp +671 -84
  102. data/platform/android/Rhodes/jni/src/nativebar.cpp +18 -0
  103. data/platform/android/Rhodes/jni/src/rhodes.cpp +92 -1
  104. data/platform/android/Rhodes/res/values/styles.xml +7 -0
  105. data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +35 -2
  106. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +12 -13
  107. data/platform/android/Rhodes/src/com/rhomobile/rhodes/LocalFileProvider.java +130 -0
  108. data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +6 -0
  109. data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +5 -1
  110. data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +6 -2
  111. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMenu.java +7 -36
  112. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +43 -20
  113. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +2 -0
  114. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +63 -28
  115. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Utils.java +2 -2
  116. data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +6 -2
  117. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +19 -282
  118. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/PopupActivity.java +354 -0
  119. data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePickerScreen.java +4 -0
  120. data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +1 -2
  121. data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +71 -5
  122. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +107 -37
  123. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +10 -7
  124. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +156 -56
  125. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +0 -1
  126. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +40 -32
  127. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +1 -0
  128. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java +14 -6
  129. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/LocalFileHandler.java +46 -0
  130. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +4 -24
  131. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/UriHandler.java +3 -1
  132. data/platform/android/build/RhodesSRC_build.files +28 -25
  133. data/platform/android/build/android.rake +230 -54
  134. data/platform/android/build/androidcommon.rb +1 -1
  135. data/platform/android/build/librhocommon_build.files +1 -0
  136. data/platform/bb/Hsqldb/BlackBerry_App_Descriptor.xml +20 -0
  137. data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +1 -5
  138. data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +6 -1
  139. data/platform/bb/Hsqldb/src/org/hsqldb/rowio/RowOutputBase.java +1 -1
  140. data/platform/bb/Hsqldb/src/org/hsqldb/rowio/RowOutputBinary.java +1 -1
  141. data/platform/bb/RubyVM/BlackBerry_App_Descriptor.xml +20 -0
  142. data/platform/bb/RubyVM/src/com/rho/IRhoRubyHelper.java +2 -0
  143. data/platform/bb/RubyVM/src/com/rho/RhoLogOutputSink.java +0 -1
  144. data/platform/bb/RubyVM/src/com/rho/RhoLogger.java +12 -10
  145. data/platform/bb/RubyVM/src/com/rho/RhoThread.java +16 -0
  146. data/platform/bb/RubyVM/src/com/rho/RhoTimer.java +89 -0
  147. data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +20 -13
  148. data/platform/bb/RubyVM/src/com/rho/SplashScreen.java +1 -2
  149. data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +2 -2
  150. data/platform/bb/RubyVM/src/com/rho/TimeInterval.java +5 -0
  151. data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +54 -48
  152. data/platform/bb/RubyVM/src/com/rho/db/IDBResult.java +0 -1
  153. data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +1 -0
  154. data/platform/bb/RubyVM/src/com/rho/net/AsyncHttp.java +1 -1
  155. data/platform/bb/RubyVM/src/com/rho/sync/ClientRegister.java +1 -1
  156. data/platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java +1 -1
  157. data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +16 -8
  158. data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +2 -2
  159. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +52 -29
  160. data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +1 -3
  161. data/platform/bb/build/RubyVM_build.files +1 -0
  162. data/platform/bb/build/bb.rake +29 -9
  163. data/platform/bb/rhodes/BlackBerry_App_Descriptor.xml +23 -0
  164. data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +1 -1
  165. data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteCopyResult.java +0 -4
  166. data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteResult.java +13 -20
  167. data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteStorage.java +183 -157
  168. data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +22 -0
  169. data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +1 -1
  170. data/platform/bb/rhodes/src/com/rho/db/SqliteCopyResult.java +0 -4
  171. data/platform/bb/rhodes/src/com/rho/db/SqliteResult.java +13 -20
  172. data/platform/bb/rhodes/src/com/rho/db/SqliteStorage.java +183 -157
  173. data/platform/bb/rhodes/src/com/rho/rubyext/System.java +46 -1
  174. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +8 -1
  175. data/platform/bb/rhodes/src/rhomobile/camera/CameraFilesListener.java +13 -3
  176. data/platform/iphone/Classes/AppManager/AppManager.h +5 -1
  177. data/platform/iphone/Classes/AppManager/AppManager.m +170 -7
  178. data/platform/iphone/Classes/DateTimePicker.m +14 -1
  179. data/platform/iphone/Classes/DateTimePickerDelegate.h +2 -0
  180. data/platform/iphone/Classes/DateTimePickerDelegate.m +36 -2
  181. data/platform/iphone/Classes/NativeBar.h +1 -0
  182. data/platform/iphone/Classes/NativeBar.m +15 -3
  183. data/platform/iphone/Classes/Phonebook/phonebook.m +8 -9
  184. data/platform/iphone/Classes/Rhodes.m +50 -6
  185. data/platform/iphone/Classes/SimpleMainView.m +7 -6
  186. data/platform/iphone/Classes/SplitView/RightViewController.h +3 -1
  187. data/platform/iphone/Classes/SplitView/RightViewController.m +14 -1
  188. data/platform/iphone/Classes/TabbedMainView.h +4 -0
  189. data/platform/iphone/Classes/TabbedMainView.m +43 -26
  190. data/platform/iphone/Info.plist +1 -1
  191. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
  192. data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +3 -3
  193. data/platform/iphone/rbuild/iphone.rake +168 -119
  194. data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +4 -2
  195. data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +3 -3
  196. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +2 -2
  197. data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +3 -3
  198. data/platform/shared/SyncClient/SyncClient.cpp +20 -8
  199. data/platform/shared/SyncClient/SyncClient.h +2 -1
  200. data/platform/shared/common/RhoDefs.h +4 -0
  201. data/platform/shared/common/RhoPort.h +22 -0
  202. data/platform/shared/common/RhoStd.h +5 -0
  203. data/platform/shared/common/RhoTime.cpp +73 -0
  204. data/platform/shared/common/RhoTime.h +26 -53
  205. data/platform/shared/common/RhodesApp.cpp +29 -28
  206. data/platform/shared/common/RhodesApp.h +4 -1
  207. data/platform/shared/common/StringConverter.h +37 -10
  208. data/platform/shared/common/app_build_capabilities.h +2 -0
  209. data/platform/shared/common/rhoparams.cpp +25 -12
  210. data/platform/shared/common/rhoparams.h +10 -8
  211. data/platform/shared/db/DBAdapter.cpp +0 -22
  212. data/platform/shared/json/RJSONTokener.c +15 -23
  213. data/platform/shared/net/AsyncHttp.cpp +9 -8
  214. data/platform/shared/net/HttpServer.cpp +61 -19
  215. data/platform/shared/net/HttpServer.h +2 -0
  216. data/platform/shared/ruby/ext/datetimepicker/datetimepicker.i +3 -0
  217. data/platform/shared/ruby/ext/datetimepicker/datetimepicker_wrap.c +151 -402
  218. data/platform/shared/ruby/ext/nativebar/nativebar.i +3 -0
  219. data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +154 -403
  220. data/platform/shared/ruby/ext/rho/rhoruby.c +4 -0
  221. data/platform/shared/ruby/ext/rho/rhoruby.h +2 -0
  222. data/platform/shared/ruby/ext/system/system.i +8 -0
  223. data/platform/shared/ruby/ext/system/system_wrap.c +80 -5
  224. data/platform/shared/ruby/file.c +6 -4
  225. data/platform/shared/ruby/gc.c +1 -1
  226. data/platform/shared/ruby/linux/ruby/config.h +7 -2
  227. data/platform/shared/ruby/missing/acosh.c +3 -3
  228. data/platform/shared/ruby/wince/_time.h +1 -1
  229. data/platform/shared/ruby/wince/stdlib.c +1 -1
  230. data/platform/shared/ruby/wince/string_wce.c +2 -2
  231. data/platform/shared/ruby/wince/sys/timeb.c +1 -0
  232. data/platform/shared/ruby/wince/time_wce.c +8 -0
  233. data/platform/shared/ruby/wince/wince.c +7 -7
  234. data/platform/shared/ruby/wince/wince.h +22 -0
  235. data/platform/shared/rubyext/System.cpp +19 -1
  236. data/platform/shared/sqlite/sqlite3.c +18993 -8129
  237. data/platform/shared/sqlite/sqlite3.h +953 -358
  238. data/platform/shared/sqlite/sqlite3ext.h +42 -0
  239. data/platform/shared/sync/SyncEngine.cpp +10 -0
  240. data/platform/shared/sync/SyncSource.cpp +41 -19
  241. data/platform/shared/sync/SyncSource.h +1 -1
  242. data/platform/shared/tcmalloc/rhomem.h +7 -2
  243. data/platform/shared/tcmalloc/windows/port.h +2 -0
  244. data/platform/shared/unzip/unzip.cpp +1 -0
  245. data/platform/shared/xruby/src/com/xruby/compiler/parser/RubyParser.java +11 -1
  246. data/platform/wm/RhoLib/RhoLib.vcproj +182 -24
  247. data/platform/wm/build/wm.rake +16 -3
  248. data/platform/wm/rhodes.sln +106 -113
  249. data/platform/wm/rhodes/Alert.cpp +6 -7
  250. data/platform/wm/rhodes/AppManager.cpp +8 -17
  251. data/platform/wm/rhodes/DateTimePicker.cpp +3 -0
  252. data/platform/wm/rhodes/DateTimePicker.h +2 -0
  253. data/platform/wm/rhodes/MainWindow.cpp +36 -16
  254. data/platform/wm/rhodes/MainWindow.h +6 -3
  255. data/platform/wm/rhodes/OutlookApp.cpp +3 -3
  256. data/platform/wm/rhodes/Rhodes.cpp +46 -27
  257. data/platform/wm/rhodes/Rhodes.rc +16 -3
  258. data/platform/wm/rhodes/RingtoneManager.cpp +7 -7
  259. data/platform/wm/rhodes/RingtoneManager.h +1 -1
  260. data/platform/wm/rhodes/Utils.cpp +2 -1
  261. data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +1 -13
  262. data/platform/wm/rhodes/bluetooth/Bluetooth.h +1 -2
  263. data/platform/wm/rhodes/camera/Camera.cpp +6 -12
  264. data/platform/wm/rhodes/phonebook/phonebook.cpp +11 -11
  265. data/platform/wm/rhodes/phonebook/phonebook.h +1 -1
  266. data/platform/wm/rhodes/resource.h +3 -1
  267. data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +7 -5
  268. data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.cpp +6 -6
  269. data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.h +1 -1
  270. data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +6 -1
  271. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +84 -19
  272. data/platform/wm/rhodes/rho/rubyext/calendar.cpp +2 -2
  273. data/platform/wm/rhodes/rhodes.vcproj +316 -73
  274. data/platform/wm/rhodes/signature/Signature.cpp +336 -6
  275. data/platform/wm/rhodes/signature/Signature.h +55 -0
  276. data/platform/wm/rhodes/stdafx.h +7 -4
  277. data/platform/wm/rubylib/rubylib.vcproj +261 -91
  278. data/platform/wm/sqlite3/sqlite3.vcproj +223 -69
  279. data/platform/wm/syncengine/syncengine.vcproj +220 -66
  280. data/platform/wm/tcmalloc/tcmalloc.vcproj +197 -43
  281. data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Builtins/ConsoleStream.cs +107 -0
  282. data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/Loader.cs +1037 -0
  283. data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/RubyUtils.cs +1476 -0
  284. data/platform/wp7/RhoAppRunner/Program.cs +55 -0
  285. data/platform/wp7/RhoAppRunner/Properties/AssemblyInfo.cs +36 -0
  286. data/platform/wp7/RhoAppRunner/RhoAppRunner.csproj +69 -0
  287. data/platform/wp7/RhoRubyExtGen/GenerateInitializers.cmd +7 -0
  288. data/platform/wp7/RhoRubyExtGen/Properties/AssemblyInfo.cs +36 -0
  289. data/platform/wp7/RhoRubyExtGen/RhoAsyncHttp.cs +38 -0
  290. data/platform/wp7/RhoRubyExtGen/RhoDatabase.cs +93 -0
  291. data/platform/wp7/RhoRubyExtGen/RhoJSON.cs +37 -0
  292. data/platform/wp7/RhoRubyExtGen/RhoNativeBar.cs +106 -0
  293. data/platform/wp7/RhoRubyExtGen/RhoRubyExtGen.csproj +75 -0
  294. data/platform/wp7/RhoRubyExtGen/RhoSyncEngine.cs +123 -0
  295. data/platform/wp7/RhoRubyExtGen/RhoWebView.cs +42 -0
  296. data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +309 -0
  297. data/platform/wp7/RhoRubyLib/Properties/AssemblyInfo.cs +36 -0
  298. data/platform/wp7/RhoRubyLib/RhoAppAdapter.cs +96 -0
  299. data/platform/wp7/RhoRubyLib/RhoRuby.cs +296 -0
  300. data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +155 -0
  301. data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +107 -0
  302. data/platform/wp7/RhoRubyLib/common/IInputStream.cs +21 -0
  303. data/platform/wp7/RhoRubyLib/common/Mutex.cs +30 -0
  304. data/platform/wp7/RhoRubyLib/common/RhoConf.cs +389 -0
  305. data/platform/wp7/RhoRubyLib/common/RhoEmptyProfiler.cs +27 -0
  306. data/platform/wp7/RhoRubyLib/common/RhoFile.cs +332 -0
  307. data/platform/wp7/RhoRubyLib/common/RhoFilePath.cs +89 -0
  308. data/platform/wp7/RhoRubyLib/common/RhoParamArray.cs +33 -0
  309. data/platform/wp7/RhoRubyLib/common/RhoParams.cs +66 -0
  310. data/platform/wp7/RhoRubyLib/common/RhoProfiler.cs +145 -0
  311. data/platform/wp7/RhoRubyLib/common/RhoResourceMap.cs +68 -0
  312. data/platform/wp7/RhoRubyLib/common/RhoStd.cs +205 -0
  313. data/platform/wp7/RhoRubyLib/common/RhoThread.cs +114 -0
  314. data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +504 -0
  315. data/platform/wp7/RhoRubyLib/common/ThreadQueue.cs +199 -0
  316. data/platform/wp7/RhoRubyLib/common/TimeInterval.cs +56 -0
  317. data/platform/wp7/RhoRubyLib/common/Tokenizer.cs +52 -0
  318. data/platform/wp7/RhoRubyLib/db/DBAdapter.cs +1129 -0
  319. data/platform/wp7/RhoRubyLib/db/DBAttrManager.cs +92 -0
  320. data/platform/wp7/RhoRubyLib/db/DBException.cs +35 -0
  321. data/platform/wp7/RhoRubyLib/db/IDBCallback.cs +10 -0
  322. data/platform/wp7/RhoRubyLib/db/IDBResult.cs +33 -0
  323. data/platform/wp7/RhoRubyLib/db/IDBStorage.cs +32 -0
  324. data/platform/wp7/RhoRubyLib/db/SqliteCopyResult.cs +79 -0
  325. data/platform/wp7/RhoRubyLib/db/SqliteResult.cs +267 -0
  326. data/platform/wp7/RhoRubyLib/db/SqliteStorage.cs +319 -0
  327. data/platform/wp7/RhoRubyLib/json/JSONArrayIterator.cs +63 -0
  328. data/platform/wp7/RhoRubyLib/json/JSONEntry.cs +96 -0
  329. data/platform/wp7/RhoRubyLib/json/JSONStructIterator.cs +77 -0
  330. data/platform/wp7/RhoRubyLib/json/JsonParser.cs +483 -0
  331. data/platform/wp7/RhoRubyLib/json/RJSONTokener.cs +406 -0
  332. data/platform/wp7/RhoRubyLib/logging/IRhoLogSink.cs +12 -0
  333. data/platform/wp7/RhoRubyLib/logging/RhoLogConf.cs +161 -0
  334. data/platform/wp7/RhoRubyLib/logging/RhoLogFileSink.cs +174 -0
  335. data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +320 -0
  336. data/platform/wp7/RhoRubyLib/net/AsyncHttp.cs +362 -0
  337. data/platform/wp7/RhoRubyLib/net/HttpServer.cs +466 -0
  338. data/platform/wp7/RhoRubyLib/net/NetRequest.cs +717 -0
  339. data/platform/wp7/RhoRubyLib/net/NetResponse.cs +64 -0
  340. data/platform/wp7/RhoRubyLib/net/URI.cs +187 -0
  341. data/platform/wp7/RhoRubyLib/rubyext/RhoAsyncHttp.cs +43 -0
  342. data/platform/wp7/RhoRubyLib/rubyext/RhoDatabase.cs +177 -0
  343. data/platform/wp7/RhoRubyLib/rubyext/RhoJSON.cs +39 -0
  344. data/platform/wp7/RhoRubyLib/rubyext/RhoKernelOps.cs +19 -0
  345. data/platform/wp7/RhoRubyLib/rubyext/RhoNativeBar.cs +117 -0
  346. data/platform/wp7/RhoRubyLib/rubyext/RhoSyncEngine.cs +199 -0
  347. data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +49 -0
  348. data/platform/wp7/RhoRubyLib/sync/ClientRegister.cs +142 -0
  349. data/platform/wp7/RhoRubyLib/sync/ISyncProtocol.cs +23 -0
  350. data/platform/wp7/RhoRubyLib/sync/ISyncStatusListener.cs +10 -0
  351. data/platform/wp7/RhoRubyLib/sync/SyncEngine.cs +1051 -0
  352. data/platform/wp7/RhoRubyLib/sync/SyncNotify.cs +651 -0
  353. data/platform/wp7/RhoRubyLib/sync/SyncProtocol_3.cs +79 -0
  354. data/platform/wp7/RhoRubyLib/sync/SyncSource.cs +1105 -0
  355. data/platform/wp7/RhoRubyLib/sync/SyncThread.cs +301 -0
  356. data/platform/wp7/WPApplication.sln +50 -0
  357. data/platform/wp7/WPApplication/App.xaml +19 -0
  358. data/platform/wp7/WPApplication/App.xaml.cs +211 -0
  359. data/platform/wp7/WPApplication/ApplicationIcon.png +0 -0
  360. data/platform/wp7/WPApplication/Background.png +0 -0
  361. data/platform/wp7/WPApplication/MainPage.xaml +44 -0
  362. data/platform/wp7/WPApplication/MainPage.xaml.cs +132 -0
  363. data/platform/wp7/WPApplication/Properties/AppManifest.xml +6 -0
  364. data/platform/wp7/WPApplication/Properties/AssemblyInfo.cs +35 -0
  365. data/platform/wp7/WPApplication/Properties/WMAppManifest.xml +32 -0
  366. data/platform/wp7/WPApplication/SplashScreenImage.jpg +0 -0
  367. data/platform/wp7/WPApplication/WPApplication.csproj +201 -0
  368. data/platform/wp7/WPApplication/WP_PlatformAdaptationLayer.cs +88 -0
  369. data/platform/wp7/WPApplication/app_manifest.txt +1 -0
  370. data/platform/wp7/WPApplication/readme.htm +40 -0
  371. data/platform/wp7/WPApplication/readme2.htm +37 -0
  372. data/platform/wp7/WPApplication/rho/apps/app/Model1/edit.bb.erb +29 -0
  373. data/platform/wp7/WPApplication/rho/apps/app/Model1/edit.erb +32 -0
  374. data/platform/wp7/WPApplication/rho/apps/app/Model1/index.bb.erb +21 -0
  375. data/platform/wp7/WPApplication/rho/apps/app/Model1/index.erb +26 -0
  376. data/platform/wp7/WPApplication/rho/apps/app/Model1/model1.rb +10 -0
  377. data/platform/wp7/WPApplication/rho/apps/app/Model1/model1_controller.rb +58 -0
  378. data/platform/wp7/WPApplication/rho/apps/app/Model1/new.bb.erb +29 -0
  379. data/platform/wp7/WPApplication/rho/apps/app/Model1/new.erb +31 -0
  380. data/platform/wp7/WPApplication/rho/apps/app/Model1/show.bb.erb +26 -0
  381. data/platform/wp7/WPApplication/rho/apps/app/Model1/show.erb +28 -0
  382. data/platform/wp7/WPApplication/rho/apps/app/Settings/controller.rb +75 -0
  383. data/platform/wp7/WPApplication/rho/apps/app/Settings/home.bb.erb +17 -0
  384. data/platform/wp7/WPApplication/rho/apps/app/Settings/home.erb +20 -0
  385. data/platform/wp7/WPApplication/rho/apps/app/Settings/index.bb.erb +32 -0
  386. data/platform/wp7/WPApplication/rho/apps/app/Settings/index.erb +30 -0
  387. data/platform/wp7/WPApplication/rho/apps/app/Settings/login.bb.erb +35 -0
  388. data/platform/wp7/WPApplication/rho/apps/app/Settings/login.erb +27 -0
  389. data/platform/wp7/WPApplication/rho/apps/app/Settings/reset.bb.erb +15 -0
  390. data/platform/wp7/WPApplication/rho/apps/app/Settings/reset.erb +17 -0
  391. data/platform/wp7/WPApplication/rho/apps/app/Settings/wait.bb.erb +3 -0
  392. data/platform/wp7/WPApplication/rho/apps/app/Settings/wait.erb +5 -0
  393. data/platform/wp7/WPApplication/rho/apps/app/application.rb +16 -0
  394. data/platform/wp7/WPApplication/rho/apps/app/helpers/application_helper.rb +126 -0
  395. data/platform/wp7/WPApplication/rho/apps/app/helpers/browser_helper.rb +18 -0
  396. data/platform/wp7/WPApplication/rho/apps/app/index.bb.erb +26 -0
  397. data/platform/wp7/WPApplication/rho/apps/app/index.erb +26 -0
  398. data/platform/wp7/WPApplication/rho/apps/app/layout.erb +45 -0
  399. data/platform/wp7/WPApplication/rho/apps/app/loading.html +11 -0
  400. data/platform/wp7/WPApplication/rho/apps/app_manifest.txt +1 -0
  401. data/platform/wp7/WPApplication/rho/apps/public/css/android.css +330 -0
  402. data/platform/wp7/WPApplication/rho/apps/public/css/blackberry.css +115 -0
  403. data/platform/wp7/WPApplication/rho/apps/public/css/iphone.css +410 -0
  404. data/platform/wp7/WPApplication/rho/apps/public/css/windows_mobile.css +222 -0
  405. data/platform/wp7/WPApplication/rho/apps/public/images/IUI_LICENSE.txt +21 -0
  406. data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_check_off.png +0 -0
  407. data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_check_on.png +0 -0
  408. data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_radio_off.png +0 -0
  409. data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_radio_on.png +0 -0
  410. data/platform/wp7/WPApplication/rho/apps/public/images/android/disclosure.png +0 -0
  411. data/platform/wp7/WPApplication/rho/apps/public/images/android/ic_menu_more.png +0 -0
  412. data/platform/wp7/WPApplication/rho/apps/public/images/backButton.png +0 -0
  413. data/platform/wp7/WPApplication/rho/apps/public/images/blueButton.png +0 -0
  414. data/platform/wp7/WPApplication/rho/apps/public/images/cancel.png +0 -0
  415. data/platform/wp7/WPApplication/rho/apps/public/images/grayButton.png +0 -0
  416. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/disclosure.png +0 -0
  417. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/disclosure_detail.png +0 -0
  418. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/backButton.png +0 -0
  419. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/blueButton.png +0 -0
  420. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/cancel.png +0 -0
  421. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/chevron.png +0 -0
  422. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/grayButton.png +0 -0
  423. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/listArrowSel.png +0 -0
  424. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/listGroup.png +0 -0
  425. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/loading.gif +0 -0
  426. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/on_off.png +0 -0
  427. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/pinstripes.png +0 -0
  428. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/selection.png +0 -0
  429. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/thumb.png +0 -0
  430. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toggle.png +0 -0
  431. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toggleOn.png +0 -0
  432. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toolButton.png +0 -0
  433. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toolbar.png +0 -0
  434. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/whiteButton.png +0 -0
  435. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/radiobutton.png +0 -0
  436. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/select.png +0 -0
  437. data/platform/wp7/WPApplication/rho/apps/public/images/iphone/switch.png +0 -0
  438. data/platform/wp7/WPApplication/rho/apps/public/images/iui-logo-touch-icon.png +0 -0
  439. data/platform/wp7/WPApplication/rho/apps/public/images/listArrow.png +0 -0
  440. data/platform/wp7/WPApplication/rho/apps/public/images/listArrowDown.png +0 -0
  441. data/platform/wp7/WPApplication/rho/apps/public/images/listArrowSel.png +0 -0
  442. data/platform/wp7/WPApplication/rho/apps/public/images/listGroup.png +0 -0
  443. data/platform/wp7/WPApplication/rho/apps/public/images/loading.gif +0 -0
  444. data/platform/wp7/WPApplication/rho/apps/public/images/pinstripes.png +0 -0
  445. data/platform/wp7/WPApplication/rho/apps/public/images/right_button.png +0 -0
  446. data/platform/wp7/WPApplication/rho/apps/public/images/selection.png +0 -0
  447. data/platform/wp7/WPApplication/rho/apps/public/images/thumb.png +0 -0
  448. data/platform/wp7/WPApplication/rho/apps/public/images/toggle.png +0 -0
  449. data/platform/wp7/WPApplication/rho/apps/public/images/toggleOn.png +0 -0
  450. data/platform/wp7/WPApplication/rho/apps/public/images/toolButton.png +0 -0
  451. data/platform/wp7/WPApplication/rho/apps/public/images/toolButton_new.png +0 -0
  452. data/platform/wp7/WPApplication/rho/apps/public/images/toolbar.png +0 -0
  453. data/platform/wp7/WPApplication/rho/apps/public/images/whiteButton.png +0 -0
  454. data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch-iphone.css +9 -0
  455. data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch.css +374 -0
  456. data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch.js +742 -0
  457. data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch.transitions.js +60 -0
  458. data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jquery.1.3.2.min.js +19 -0
  459. data/platform/wp7/WPApplication/rho/apps/public/js/application.js +1 -0
  460. data/platform/wp7/WPApplication/rho/apps/public/js/rho.js +4 -0
  461. data/platform/wp7/WPApplication/rho/apps/public/js/rhogeolocation-wm.js +59 -0
  462. data/platform/wp7/WPApplication/rho/apps/public/js/rhogeolocation.js +11 -0
  463. data/platform/wp7/WPApplication/rho/apps/rhoconfig.txt +32 -0
  464. data/platform/wp7/WPApplication/rhoconfig.txt +32 -0
  465. data/platform/wp7/WPApplication/windows_mobile.css +222 -0
  466. data/platform/wp7/build/wp.rake +261 -0
  467. data/platform/wp7/rhodes.sln +79 -0
  468. data/platform/wp7/rhodes/App.xaml +19 -0
  469. data/platform/wp7/rhodes/App.xaml.cs +144 -0
  470. data/platform/wp7/rhodes/Background.png +0 -0
  471. data/platform/wp7/rhodes/MainPage.xaml +44 -0
  472. data/platform/wp7/rhodes/MainPage.xaml.cs +98 -0
  473. data/platform/wp7/rhodes/Properties/AppManifest.xml +6 -0
  474. data/platform/wp7/rhodes/Properties/AssemblyInfo.cs +35 -0
  475. data/platform/wp7/rhodes/Properties/WMAppManifest.xml +31 -0
  476. data/platform/wp7/rhodes/Rhodes.csproj +127 -0
  477. data/platform/wp7/rhodes/SplashScreenImage.jpg +0 -0
  478. data/platform/wp7/rhodes/icon.png +0 -0
  479. data/platform/wp7/sqlite3/Properties/AssemblyInfo.cs +35 -0
  480. data/platform/wp7/sqlite3/SQLiteClient.cs +550 -0
  481. data/platform/wp7/sqlite3/SqliteWrapper/BtreeInt_h.cs +774 -0
  482. data/platform/wp7/sqlite3/SqliteWrapper/Btree_h.cs +280 -0
  483. data/platform/wp7/sqlite3/SqliteWrapper/ClassDiagram1.cd +1306 -0
  484. data/platform/wp7/sqlite3/SqliteWrapper/Delagates.cs +365 -0
  485. data/platform/wp7/sqlite3/SqliteWrapper/Hash_h.cs +133 -0
  486. data/platform/wp7/sqlite3/SqliteWrapper/VdbeInt_h.cs +620 -0
  487. data/platform/wp7/sqlite3/SqliteWrapper/Vdbe_h.cs +302 -0
  488. data/platform/wp7/sqlite3/SqliteWrapper/_Custom.cs +449 -0
  489. data/platform/wp7/sqlite3/SqliteWrapper/alter_c.cs +872 -0
  490. data/platform/wp7/sqlite3/SqliteWrapper/analyze_c.cs +757 -0
  491. data/platform/wp7/sqlite3/SqliteWrapper/attach_c.cs +628 -0
  492. data/platform/wp7/sqlite3/SqliteWrapper/auth_c.cs +268 -0
  493. data/platform/wp7/sqlite3/SqliteWrapper/backup_c.cs +737 -0
  494. data/platform/wp7/sqlite3/SqliteWrapper/bitvec_c.cs +509 -0
  495. data/platform/wp7/sqlite3/SqliteWrapper/btmutex_c.cs +379 -0
  496. data/platform/wp7/sqlite3/SqliteWrapper/btree_c.cs +9138 -0
  497. data/platform/wp7/sqlite3/SqliteWrapper/build_c.cs +4189 -0
  498. data/platform/wp7/sqlite3/SqliteWrapper/callback_c.cs +548 -0
  499. data/platform/wp7/sqlite3/SqliteWrapper/complete_c.cs +342 -0
  500. data/platform/wp7/sqlite3/SqliteWrapper/ctime_cs.cs +408 -0
  501. data/platform/wp7/sqlite3/SqliteWrapper/date_c.cs +1317 -0
  502. data/platform/wp7/sqlite3/SqliteWrapper/delete_c.cs +726 -0
  503. data/platform/wp7/sqlite3/SqliteWrapper/expr_c.cs +4406 -0
  504. data/platform/wp7/sqlite3/SqliteWrapper/fault_c.cs +115 -0
  505. data/platform/wp7/sqlite3/SqliteWrapper/fkey_c.cs +1330 -0
  506. data/platform/wp7/sqlite3/SqliteWrapper/func_c.cs +2025 -0
  507. data/platform/wp7/sqlite3/SqliteWrapper/global_c.cs +228 -0
  508. data/platform/wp7/sqlite3/SqliteWrapper/hash_c.cs +351 -0
  509. data/platform/wp7/sqlite3/SqliteWrapper/hwtime_c.cs +101 -0
  510. data/platform/wp7/sqlite3/SqliteWrapper/insert_c.cs +2122 -0
  511. data/platform/wp7/sqlite3/SqliteWrapper/journal_c.cs +247 -0
  512. data/platform/wp7/sqlite3/SqliteWrapper/keywordhash_h.cs +302 -0
  513. data/platform/wp7/sqlite3/SqliteWrapper/legacy_c.cs +223 -0
  514. data/platform/wp7/sqlite3/SqliteWrapper/loadext_c.cs +683 -0
  515. data/platform/wp7/sqlite3/SqliteWrapper/main_c.cs +2716 -0
  516. data/platform/wp7/sqlite3/SqliteWrapper/malloc_c.cs +977 -0
  517. data/platform/wp7/sqlite3/SqliteWrapper/mem_Pool.cs +394 -0
  518. data/platform/wp7/sqlite3/SqliteWrapper/memjournal_c.cs +315 -0
  519. data/platform/wp7/sqlite3/SqliteWrapper/mutex_c.cs +182 -0
  520. data/platform/wp7/sqlite3/SqliteWrapper/mutex_h.cs +91 -0
  521. data/platform/wp7/sqlite3/SqliteWrapper/mutex_noop_c.cs +202 -0
  522. data/platform/wp7/sqlite3/SqliteWrapper/mutex_w32.cs +344 -0
  523. data/platform/wp7/sqlite3/SqliteWrapper/notify_c.cs +347 -0
  524. data/platform/wp7/sqlite3/SqliteWrapper/opcodes_c.cs +171 -0
  525. data/platform/wp7/sqlite3/SqliteWrapper/opcodes_h.cs +346 -0
  526. data/platform/wp7/sqlite3/SqliteWrapper/os_c.cs +367 -0
  527. data/platform/wp7/sqlite3/SqliteWrapper/os_common_h.cs +174 -0
  528. data/platform/wp7/sqlite3/SqliteWrapper/os_h.cs +295 -0
  529. data/platform/wp7/sqlite3/SqliteWrapper/os_win_c.cs +1255 -0
  530. data/platform/wp7/sqlite3/SqliteWrapper/pager_c.cs +6078 -0
  531. data/platform/wp7/sqlite3/SqliteWrapper/pager_h.cs +188 -0
  532. data/platform/wp7/sqlite3/SqliteWrapper/parse_c.cs +4045 -0
  533. data/platform/wp7/sqlite3/SqliteWrapper/parse_h.cs +331 -0
  534. data/platform/wp7/sqlite3/SqliteWrapper/pcache1_c.cs +969 -0
  535. data/platform/wp7/sqlite3/SqliteWrapper/pcache_c.cs +712 -0
  536. data/platform/wp7/sqlite3/SqliteWrapper/pcache_h.cs +213 -0
  537. data/platform/wp7/sqlite3/SqliteWrapper/pragma_c.cs +1767 -0
  538. data/platform/wp7/sqlite3/SqliteWrapper/prepare_c.cs +1015 -0
  539. data/platform/wp7/sqlite3/SqliteWrapper/printf_c.cs +1300 -0
  540. data/platform/wp7/sqlite3/SqliteWrapper/random_c.cs +201 -0
  541. data/platform/wp7/sqlite3/SqliteWrapper/resolve_c.cs +1396 -0
  542. data/platform/wp7/sqlite3/SqliteWrapper/rowset_c.cs +519 -0
  543. data/platform/wp7/sqlite3/SqliteWrapper/select_c.cs +4878 -0
  544. data/platform/wp7/sqlite3/SqliteWrapper/sqlite3_h.cs +6253 -0
  545. data/platform/wp7/sqlite3/SqliteWrapper/sqlite3ext_h.cs +397 -0
  546. data/platform/wp7/sqlite3/SqliteWrapper/sqliteInt_h.cs +4075 -0
  547. data/platform/wp7/sqlite3/SqliteWrapper/sqliteLimit_h.cs +214 -0
  548. data/platform/wp7/sqlite3/SqliteWrapper/sqliteicu_h.cs +39 -0
  549. data/platform/wp7/sqlite3/SqliteWrapper/status_c.cs +155 -0
  550. data/platform/wp7/sqlite3/SqliteWrapper/table_c.cs +222 -0
  551. data/platform/wp7/sqlite3/SqliteWrapper/tokenize_c.cs +673 -0
  552. data/platform/wp7/sqlite3/SqliteWrapper/trigger_c.cs +1219 -0
  553. data/platform/wp7/sqlite3/SqliteWrapper/update_c.cs +766 -0
  554. data/platform/wp7/sqlite3/SqliteWrapper/utf_c.cs +612 -0
  555. data/platform/wp7/sqlite3/SqliteWrapper/util_c.cs +1476 -0
  556. data/platform/wp7/sqlite3/SqliteWrapper/vacuum_c.cs +382 -0
  557. data/platform/wp7/sqlite3/SqliteWrapper/vdbe_c.cs +6566 -0
  558. data/platform/wp7/sqlite3/SqliteWrapper/vdbeapi_c.cs +1557 -0
  559. data/platform/wp7/sqlite3/SqliteWrapper/vdbeaux_c.cs +4019 -0
  560. data/platform/wp7/sqlite3/SqliteWrapper/vdbeblob_c.cs +396 -0
  561. data/platform/wp7/sqlite3/SqliteWrapper/vdbemem_c.cs +1480 -0
  562. data/platform/wp7/sqlite3/SqliteWrapper/vdbetrace_c.cs +181 -0
  563. data/platform/wp7/sqlite3/SqliteWrapper/vtab_c.cs +957 -0
  564. data/platform/wp7/sqlite3/SqliteWrapper/walker_c.cs +174 -0
  565. data/platform/wp7/sqlite3/SqliteWrapper/where_c.cs +4651 -0
  566. data/platform/wp7/sqlite3/sqlite3.csproj +155 -0
  567. data/rakefile.rb +60 -2
  568. data/res/build-tools/7za.exe +0 -0
  569. data/res/build-tools/RhoAppRunner.exe +0 -0
  570. data/res/build-tools/xruby-0.3.3.jar +0 -0
  571. data/res/generators/rhogen.rb +9 -1
  572. data/res/generators/templates/application/app/Settings/reset.erb +1 -1
  573. data/res/generators/templates/application/app/layout.erb +17 -10
  574. data/res/generators/templates/application/build.yml +5 -3
  575. data/res/generators/templates/application/public/jqtouch/changes.txt +20 -0
  576. data/res/generators/templates/application/public/jqtouch/jqtouch.js +12 -4
  577. data/res/generators/templates/application/public/jqtouch/jquery.1.3.2.min.js +1 -1
  578. data/res/generators/templates/application/public/js/wp7.js +7 -0
  579. data/res/generators/templates/model/controller.rb +5 -6
  580. data/rhobuild.yml.example +1 -0
  581. data/rhodes.gemspec +2 -1
  582. data/spec/framework_spec/app/spec/core/dir/close_spec.rb +1 -1
  583. data/spec/framework_spec/app/spec/core/dir/shared/pwd.rb +13 -11
  584. data/spec/framework_spec/app/spec/core/env/shared/store.rb +12 -10
  585. data/spec/framework_spec/app/spec/core/env/update_spec.rb +1 -0
  586. data/spec/framework_spec/app/spec/core/file/expand_path_spec.rb +3 -2
  587. data/spec/framework_spec/app/spec/core/file/fixtures/file_types.rb +7 -1
  588. data/spec/framework_spec/app/spec/core/file/flock_spec.rb +8 -1
  589. data/spec/framework_spec/app/spec/core/file/ftype_spec.rb +5 -3
  590. data/spec/framework_spec/app/spec/core/file/lchmod_spec.rb +1 -1
  591. data/spec/framework_spec/app/spec/core/file/setgid_spec.rb +1 -1
  592. data/spec/framework_spec/app/spec/core/file/setuid_spec.rb +1 -1
  593. data/spec/framework_spec/app/spec/core/file/stat/ftype_spec.rb +6 -4
  594. data/spec/framework_spec/app/spec/core/file/truncate_spec.rb +5 -1
  595. data/spec/framework_spec/app/spec/core/float/to_s_spec.rb +1 -1
  596. data/spec/framework_spec/app/spec/core/process/gid_spec.rb +5 -3
  597. data/spec/framework_spec/app/spec/core/process/groups_spec.rb +11 -9
  598. data/spec/framework_spec/app/spec/core/process/uid_spec.rb +5 -3
  599. data/spec/framework_spec/app/spec/language/execution_spec.rb +10 -6
  600. data/spec/framework_spec/app/spec/shared/file/directory.rb +6 -1
  601. data/spec/framework_spec/app/spec/shared/file/executable.rb +7 -1
  602. data/spec/framework_spec/app/spec/shared/file/file.rb +6 -1
  603. data/spec/framework_spec/app/spec/shared/file/readable.rb +13 -4
  604. data/spec/framework_spec/app/spec/shared/file/writable.rb +6 -1
  605. data/spec/phone_spec/app/spec/rho_controller_spec.rb +11 -0
  606. data/spec/phone_spec/app/spec/rho_spec.rb +11 -0
  607. data/spec/phone_spec/app/spec/rhom_object_spec.rb +102 -6
  608. data/spec/phone_spec/app/spec/string/end_with_spec.rb +4 -1
  609. data/spec/phone_spec/app/spec/string/slice_spec.rb +5 -1
  610. data/spec/phone_spec/app/spec/string/start_with_spec.rb +4 -0
  611. data/spec/phone_spec/app/spec/syncengine_spec.rb +73 -6
  612. data/spec/phone_spec/app/spec_runner.rb +7 -3
  613. metadata +380 -41
  614. data/Manifest.txt +0 -5819
  615. data/platform/bb/Hsqldb/Hsqldb.cso +0 -5
  616. data/platform/bb/Hsqldb/Hsqldb.jdp +0 -197
  617. data/platform/bb/RhoBundle/RhoBundle.cso +0 -5
  618. data/platform/bb/RhoBundle/RhoBundle.jdp +0 -42
  619. data/platform/bb/RubyVM/RubyVM.cso +0 -5
  620. data/platform/bb/RubyVM/RubyVM.jdp +0 -467
  621. data/platform/bb/rhodes/rhodes.csl +0 -3
  622. data/platform/bb/rhodes/rhodes.cso +0 -5
  623. data/platform/bb/rhodes/rhodes.jdp +0 -104
@@ -97,7 +97,7 @@ extern "C" {
97
97
  **
98
98
  ** Since version 3.6.18, SQLite source code has been stored in the
99
99
  ** <a href="http://www.fossil-scm.org/">Fossil configuration management
100
- ** system</a>. ^The SQLITE_SOURCE_ID macro evalutes to
100
+ ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
101
101
  ** a string which identifies a particular check-in of SQLite
102
102
  ** within its configuration management system. ^The SQLITE_SOURCE_ID
103
103
  ** string contains the date and time of the check-in (UTC) and an SHA1
@@ -107,9 +107,9 @@ extern "C" {
107
107
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108
108
  ** [sqlite_version()] and [sqlite_source_id()].
109
109
  */
110
- #define SQLITE_VERSION "3.6.23.1"
111
- #define SQLITE_VERSION_NUMBER 3006023
112
- #define SQLITE_SOURCE_ID "2010-03-26 22:28:06 b078b588d617e07886ad156e9f54ade6d823568e"
110
+ #define SQLITE_VERSION "3.7.5"
111
+ #define SQLITE_VERSION_NUMBER 3007005
112
+ #define SQLITE_SOURCE_ID "2011-01-28 17:03:50 ed759d5a9edb3bba5f48f243df47be29e3fe8cd7"
113
113
 
114
114
  /*
115
115
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -146,7 +146,6 @@ SQLITE_API const char *sqlite3_libversion(void);
146
146
  SQLITE_API const char *sqlite3_sourceid(void);
147
147
  SQLITE_API int sqlite3_libversion_number(void);
148
148
 
149
- #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
150
149
  /*
151
150
  ** CAPI3REF: Run-Time Library Compilation Options Diagnostics
152
151
  **
@@ -155,7 +154,7 @@ SQLITE_API int sqlite3_libversion_number(void);
155
154
  ** compile time. ^The SQLITE_ prefix may be omitted from the
156
155
  ** option name passed to sqlite3_compileoption_used().
157
156
  **
158
- ** ^The sqlite3_compileoption_get() function allows interating
157
+ ** ^The sqlite3_compileoption_get() function allows iterating
159
158
  ** over the list of options that were defined at compile time by
160
159
  ** returning the N-th compile time option string. ^If N is out of range,
161
160
  ** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_
@@ -163,15 +162,16 @@ SQLITE_API int sqlite3_libversion_number(void);
163
162
  ** sqlite3_compileoption_get().
164
163
  **
165
164
  ** ^Support for the diagnostic functions sqlite3_compileoption_used()
166
- ** and sqlite3_compileoption_get() may be omitted by specifing the
165
+ ** and sqlite3_compileoption_get() may be omitted by specifying the
167
166
  ** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.
168
167
  **
169
168
  ** See also: SQL functions [sqlite_compileoption_used()] and
170
169
  ** [sqlite_compileoption_get()] and the [compile_options pragma].
171
170
  */
171
+ #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
172
172
  SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
173
173
  SQLITE_API const char *sqlite3_compileoption_get(int N);
174
- #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
174
+ #endif
175
175
 
176
176
  /*
177
177
  ** CAPI3REF: Test To See If The Library Is Threadsafe
@@ -268,7 +268,7 @@ typedef sqlite_uint64 sqlite3_uint64;
268
268
  **
269
269
  ** ^The sqlite3_close() routine is the destructor for the [sqlite3] object.
270
270
  ** ^Calls to sqlite3_close() return SQLITE_OK if the [sqlite3] object is
271
- ** successfullly destroyed and all associated resources are deallocated.
271
+ ** successfully destroyed and all associated resources are deallocated.
272
272
  **
273
273
  ** Applications must [sqlite3_finalize | finalize] all [prepared statements]
274
274
  ** and [sqlite3_blob_close | close] all [BLOB handles] associated with
@@ -390,10 +390,10 @@ SQLITE_API int sqlite3_exec(
390
390
  #define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/
391
391
  #define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */
392
392
  #define SQLITE_CORRUPT 11 /* The database disk image is malformed */
393
- #define SQLITE_NOTFOUND 12 /* NOT USED. Table or record not found */
393
+ #define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */
394
394
  #define SQLITE_FULL 13 /* Insertion failed because database is full */
395
395
  #define SQLITE_CANTOPEN 14 /* Unable to open the database file */
396
- #define SQLITE_PROTOCOL 15 /* NOT USED. Database lock protocol error */
396
+ #define SQLITE_PROTOCOL 15 /* Database lock protocol error */
397
397
  #define SQLITE_EMPTY 16 /* Database is empty */
398
398
  #define SQLITE_SCHEMA 17 /* The database schema changed */
399
399
  #define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
@@ -449,7 +449,12 @@ SQLITE_API int sqlite3_exec(
449
449
  #define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15<<8))
450
450
  #define SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16<<8))
451
451
  #define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8))
452
- #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8) )
452
+ #define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18<<8))
453
+ #define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19<<8))
454
+ #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8))
455
+ #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
456
+ #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
457
+ #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8))
453
458
 
454
459
  /*
455
460
  ** CAPI3REF: Flags For File Open Operations
@@ -476,11 +481,12 @@ SQLITE_API int sqlite3_exec(
476
481
  #define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */
477
482
  #define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */
478
483
  #define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */
484
+ #define SQLITE_OPEN_WAL 0x00080000 /* VFS only */
479
485
 
480
486
  /*
481
487
  ** CAPI3REF: Device Characteristics
482
488
  **
483
- ** The xDeviceCapabilities method of the [sqlite3_io_methods]
489
+ ** The xDeviceCharacteristics method of the [sqlite3_io_methods]
484
490
  ** object returns an integer which is a vector of the these
485
491
  ** bit values expressing I/O characteristics of the mass storage
486
492
  ** device that holds the file that the [sqlite3_io_methods]
@@ -497,17 +503,18 @@ SQLITE_API int sqlite3_exec(
497
503
  ** information is written to disk in the same order as calls
498
504
  ** to xWrite().
499
505
  */
500
- #define SQLITE_IOCAP_ATOMIC 0x00000001
501
- #define SQLITE_IOCAP_ATOMIC512 0x00000002
502
- #define SQLITE_IOCAP_ATOMIC1K 0x00000004
503
- #define SQLITE_IOCAP_ATOMIC2K 0x00000008
504
- #define SQLITE_IOCAP_ATOMIC4K 0x00000010
505
- #define SQLITE_IOCAP_ATOMIC8K 0x00000020
506
- #define SQLITE_IOCAP_ATOMIC16K 0x00000040
507
- #define SQLITE_IOCAP_ATOMIC32K 0x00000080
508
- #define SQLITE_IOCAP_ATOMIC64K 0x00000100
509
- #define SQLITE_IOCAP_SAFE_APPEND 0x00000200
510
- #define SQLITE_IOCAP_SEQUENTIAL 0x00000400
506
+ #define SQLITE_IOCAP_ATOMIC 0x00000001
507
+ #define SQLITE_IOCAP_ATOMIC512 0x00000002
508
+ #define SQLITE_IOCAP_ATOMIC1K 0x00000004
509
+ #define SQLITE_IOCAP_ATOMIC2K 0x00000008
510
+ #define SQLITE_IOCAP_ATOMIC4K 0x00000010
511
+ #define SQLITE_IOCAP_ATOMIC8K 0x00000020
512
+ #define SQLITE_IOCAP_ATOMIC16K 0x00000040
513
+ #define SQLITE_IOCAP_ATOMIC32K 0x00000080
514
+ #define SQLITE_IOCAP_ATOMIC64K 0x00000100
515
+ #define SQLITE_IOCAP_SAFE_APPEND 0x00000200
516
+ #define SQLITE_IOCAP_SEQUENTIAL 0x00000400
517
+ #define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800
511
518
 
512
519
  /*
513
520
  ** CAPI3REF: File Locking Levels
@@ -535,6 +542,18 @@ SQLITE_API int sqlite3_exec(
535
542
  ** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.
536
543
  ** If the lower four bits equal SQLITE_SYNC_FULL, that means
537
544
  ** to use Mac OS X style fullsync instead of fsync().
545
+ **
546
+ ** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags
547
+ ** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL
548
+ ** settings. The [synchronous pragma] determines when calls to the
549
+ ** xSync VFS method occur and applies uniformly across all platforms.
550
+ ** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how
551
+ ** energetic or rigorous or forceful the sync operations are and
552
+ ** only make a difference on Mac OSX for the default SQLite code.
553
+ ** (Third-party VFS implementations might also make the distinction
554
+ ** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the
555
+ ** operating systems natively supported by SQLite, only Mac OSX
556
+ ** cares about the difference.)
538
557
  */
539
558
  #define SQLITE_SYNC_NORMAL 0x00002
540
559
  #define SQLITE_SYNC_FULL 0x00003
@@ -603,7 +622,9 @@ struct sqlite3_file {
603
622
  ** core reserves all opcodes less than 100 for its own use.
604
623
  ** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available.
605
624
  ** Applications that define a custom xFileControl method should use opcodes
606
- ** greater than 100 to avoid conflicts.
625
+ ** greater than 100 to avoid conflicts. VFS implementations should
626
+ ** return [SQLITE_NOTFOUND] for file control opcodes that they do not
627
+ ** recognize.
607
628
  **
608
629
  ** The xSectorSize() method returns the sector size of the
609
630
  ** device that underlies the file. The sector size is the
@@ -658,6 +679,12 @@ struct sqlite3_io_methods {
658
679
  int (*xFileControl)(sqlite3_file*, int op, void *pArg);
659
680
  int (*xSectorSize)(sqlite3_file*);
660
681
  int (*xDeviceCharacteristics)(sqlite3_file*);
682
+ /* Methods above are valid for version 1 */
683
+ int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**);
684
+ int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);
685
+ void (*xShmBarrier)(sqlite3_file*);
686
+ int (*xShmUnmap)(sqlite3_file*, int deleteFlag);
687
+ /* Methods above are valid for version 2 */
661
688
  /* Additional methods may be added in future releases */
662
689
  };
663
690
 
@@ -675,11 +702,46 @@ struct sqlite3_io_methods {
675
702
  ** into an integer that the pArg argument points to. This capability
676
703
  ** is used during testing and only needs to be supported when SQLITE_TEST
677
704
  ** is defined.
705
+ **
706
+ ** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
707
+ ** layer a hint of how large the database file will grow to be during the
708
+ ** current transaction. This hint is not guaranteed to be accurate but it
709
+ ** is often close. The underlying VFS might choose to preallocate database
710
+ ** file space based on this hint in order to help writes to the database
711
+ ** file run faster.
712
+ **
713
+ ** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS
714
+ ** extends and truncates the database file in chunks of a size specified
715
+ ** by the user. The fourth argument to [sqlite3_file_control()] should
716
+ ** point to an integer (type int) containing the new chunk-size to use
717
+ ** for the nominated database. Allocating database file space in large
718
+ ** chunks (say 1MB at a time), may reduce file-system fragmentation and
719
+ ** improve performance on some systems.
720
+ **
721
+ ** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
722
+ ** to the [sqlite3_file] object associated with a particular database
723
+ ** connection. See the [sqlite3_file_control()] documentation for
724
+ ** additional information.
725
+ **
726
+ ** ^(The [SQLITE_FCNTL_SYNC_OMITTED] opcode is generated internally by
727
+ ** SQLite and sent to all VFSes in place of a call to the xSync method
728
+ ** when the database connection has [PRAGMA synchronous] set to OFF.)^
729
+ ** Some specialized VFSes need this signal in order to operate correctly
730
+ ** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most
731
+ ** VFSes do not need this signal and should silently ignore this opcode.
732
+ ** Applications should not call [sqlite3_file_control()] with this
733
+ ** opcode as doing so may disrupt the operation of the specilized VFSes
734
+ ** that do require it.
678
735
  */
679
736
  #define SQLITE_FCNTL_LOCKSTATE 1
680
737
  #define SQLITE_GET_LOCKPROXYFILE 2
681
738
  #define SQLITE_SET_LOCKPROXYFILE 3
682
739
  #define SQLITE_LAST_ERRNO 4
740
+ #define SQLITE_FCNTL_SIZE_HINT 5
741
+ #define SQLITE_FCNTL_CHUNK_SIZE 6
742
+ #define SQLITE_FCNTL_FILE_POINTER 7
743
+ #define SQLITE_FCNTL_SYNC_OMITTED 8
744
+
683
745
 
684
746
  /*
685
747
  ** CAPI3REF: Mutex Handle
@@ -727,15 +789,19 @@ typedef struct sqlite3_mutex sqlite3_mutex;
727
789
  ** The zName field holds the name of the VFS module. The name must
728
790
  ** be unique across all VFS modules.
729
791
  **
730
- ** SQLite will guarantee that the zFilename parameter to xOpen
792
+ ** ^SQLite guarantees that the zFilename parameter to xOpen
731
793
  ** is either a NULL pointer or string obtained
732
- ** from xFullPathname(). SQLite further guarantees that
794
+ ** from xFullPathname() with an optional suffix added.
795
+ ** ^If a suffix is added to the zFilename parameter, it will
796
+ ** consist of a single "-" character followed by no more than
797
+ ** 10 alphanumeric and/or "-" characters.
798
+ ** ^SQLite further guarantees that
733
799
  ** the string will be valid and unchanged until xClose() is
734
800
  ** called. Because of the previous sentence,
735
801
  ** the [sqlite3_file] can safely store a pointer to the
736
802
  ** filename if it needs to remember the filename for some reason.
737
- ** If the zFilename parameter is xOpen is a NULL pointer then xOpen
738
- ** must invent its own temporary name for the file. Whenever the
803
+ ** If the zFilename parameter to xOpen is a NULL pointer then xOpen
804
+ ** must invent its own temporary name for the file. ^Whenever the
739
805
  ** xFilename parameter is NULL it will also be the case that the
740
806
  ** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
741
807
  **
@@ -746,7 +812,7 @@ typedef struct sqlite3_mutex sqlite3_mutex;
746
812
  ** If xOpen() opens a file read-only then it sets *pOutFlags to
747
813
  ** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set.
748
814
  **
749
- ** SQLite will also add one of the following flags to the xOpen()
815
+ ** ^(SQLite will also add one of the following flags to the xOpen()
750
816
  ** call, depending on the object being opened:
751
817
  **
752
818
  ** <ul>
@@ -757,7 +823,8 @@ typedef struct sqlite3_mutex sqlite3_mutex;
757
823
  ** <li> [SQLITE_OPEN_TRANSIENT_DB]
758
824
  ** <li> [SQLITE_OPEN_SUBJOURNAL]
759
825
  ** <li> [SQLITE_OPEN_MASTER_JOURNAL]
760
- ** </ul>
826
+ ** <li> [SQLITE_OPEN_WAL]
827
+ ** </ul>)^
761
828
  **
762
829
  ** The file I/O implementation can use the object type flags to
763
830
  ** change the way it deals with files. For example, an application
@@ -776,10 +843,11 @@ typedef struct sqlite3_mutex sqlite3_mutex;
776
843
  ** </ul>
777
844
  **
778
845
  ** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
779
- ** deleted when it is closed. The [SQLITE_OPEN_DELETEONCLOSE]
780
- ** will be set for TEMP databases, journals and for subjournals.
846
+ ** deleted when it is closed. ^The [SQLITE_OPEN_DELETEONCLOSE]
847
+ ** will be set for TEMP databases and their journals, transient
848
+ ** databases, and subjournals.
781
849
  **
782
- ** The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
850
+ ** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
783
851
  ** with the [SQLITE_OPEN_CREATE] flag, which are both directly
784
852
  ** analogous to the O_EXCL and O_CREAT flags of the POSIX open()
785
853
  ** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the
@@ -788,7 +856,7 @@ typedef struct sqlite3_mutex sqlite3_mutex;
788
856
  ** It is <i>not</i> used to indicate the file should be opened
789
857
  ** for exclusive access.
790
858
  **
791
- ** At least szOsFile bytes of memory are allocated by SQLite
859
+ ** ^At least szOsFile bytes of memory are allocated by SQLite
792
860
  ** to hold the [sqlite3_file] structure passed as the third
793
861
  ** argument to xOpen. The xOpen method does not have to
794
862
  ** allocate the structure; it should just fill it in. Note that
@@ -798,33 +866,40 @@ typedef struct sqlite3_mutex sqlite3_mutex;
798
866
  ** element will be valid after xOpen returns regardless of the success
799
867
  ** or failure of the xOpen call.
800
868
  **
801
- ** The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
869
+ ** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
802
870
  ** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
803
871
  ** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
804
872
  ** to test whether a file is at least readable. The file can be a
805
873
  ** directory.
806
874
  **
807
- ** SQLite will always allocate at least mxPathname+1 bytes for the
875
+ ** ^SQLite will always allocate at least mxPathname+1 bytes for the
808
876
  ** output buffer xFullPathname. The exact size of the output buffer
809
877
  ** is also passed as a parameter to both methods. If the output buffer
810
878
  ** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
811
879
  ** handled as a fatal error by SQLite, vfs implementations should endeavor
812
880
  ** to prevent this by setting mxPathname to a sufficiently large value.
813
881
  **
814
- ** The xRandomness(), xSleep(), and xCurrentTime() interfaces
815
- ** are not strictly a part of the filesystem, but they are
882
+ ** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()
883
+ ** interfaces are not strictly a part of the filesystem, but they are
816
884
  ** included in the VFS structure for completeness.
817
885
  ** The xRandomness() function attempts to return nBytes bytes
818
886
  ** of good-quality randomness into zOut. The return value is
819
887
  ** the actual number of bytes of randomness obtained.
820
888
  ** The xSleep() method causes the calling thread to sleep for at
821
- ** least the number of microseconds given. The xCurrentTime()
822
- ** method returns a Julian Day Number for the current date and time.
823
- **
889
+ ** least the number of microseconds given. ^The xCurrentTime()
890
+ ** method returns a Julian Day Number for the current date and time as
891
+ ** a floating point value.
892
+ ** ^The xCurrentTimeInt64() method returns, as an integer, the Julian
893
+ ** Day Number multipled by 86400000 (the number of milliseconds in
894
+ ** a 24-hour day).
895
+ ** ^SQLite will use the xCurrentTimeInt64() method to get the current
896
+ ** date and time if that method is available (if iVersion is 2 or
897
+ ** greater and the function pointer is not NULL) and will fall back
898
+ ** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
824
899
  */
825
900
  typedef struct sqlite3_vfs sqlite3_vfs;
826
901
  struct sqlite3_vfs {
827
- int iVersion; /* Structure version number */
902
+ int iVersion; /* Structure version number (currently 2) */
828
903
  int szOsFile; /* Size of subclassed sqlite3_file */
829
904
  int mxPathname; /* Maximum file pathname length */
830
905
  sqlite3_vfs *pNext; /* Next registered VFS */
@@ -843,8 +918,16 @@ struct sqlite3_vfs {
843
918
  int (*xSleep)(sqlite3_vfs*, int microseconds);
844
919
  int (*xCurrentTime)(sqlite3_vfs*, double*);
845
920
  int (*xGetLastError)(sqlite3_vfs*, int, char *);
846
- /* New fields may be appended in figure versions. The iVersion
847
- ** value will increment whenever this happens. */
921
+ /*
922
+ ** The methods above are in version 1 of the sqlite_vfs object
923
+ ** definition. Those that follow are added in version 2 or later
924
+ */
925
+ int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);
926
+ /*
927
+ ** The methods above are in versions 1 and 2 of the sqlite_vfs object.
928
+ ** New fields may be appended in figure versions. The iVersion
929
+ ** value will increment whenever this happens.
930
+ */
848
931
  };
849
932
 
850
933
  /*
@@ -856,13 +939,58 @@ struct sqlite3_vfs {
856
939
  ** With SQLITE_ACCESS_EXISTS, the xAccess method
857
940
  ** simply checks whether the file exists.
858
941
  ** With SQLITE_ACCESS_READWRITE, the xAccess method
859
- ** checks whether the file is both readable and writable.
942
+ ** checks whether the named directory is both readable and writable
943
+ ** (in other words, if files can be added, removed, and renamed within
944
+ ** the directory).
945
+ ** The SQLITE_ACCESS_READWRITE constant is currently used only by the
946
+ ** [temp_store_directory pragma], though this could change in a future
947
+ ** release of SQLite.
860
948
  ** With SQLITE_ACCESS_READ, the xAccess method
861
- ** checks whether the file is readable.
949
+ ** checks whether the file is readable. The SQLITE_ACCESS_READ constant is
950
+ ** currently unused, though it might be used in a future release of
951
+ ** SQLite.
862
952
  */
863
953
  #define SQLITE_ACCESS_EXISTS 0
864
- #define SQLITE_ACCESS_READWRITE 1
865
- #define SQLITE_ACCESS_READ 2
954
+ #define SQLITE_ACCESS_READWRITE 1 /* Used by PRAGMA temp_store_directory */
955
+ #define SQLITE_ACCESS_READ 2 /* Unused */
956
+
957
+ /*
958
+ ** CAPI3REF: Flags for the xShmLock VFS method
959
+ **
960
+ ** These integer constants define the various locking operations
961
+ ** allowed by the xShmLock method of [sqlite3_io_methods]. The
962
+ ** following are the only legal combinations of flags to the
963
+ ** xShmLock method:
964
+ **
965
+ ** <ul>
966
+ ** <li> SQLITE_SHM_LOCK | SQLITE_SHM_SHARED
967
+ ** <li> SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE
968
+ ** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED
969
+ ** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE
970
+ ** </ul>
971
+ **
972
+ ** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
973
+ ** was given no the corresponding lock.
974
+ **
975
+ ** The xShmLock method can transition between unlocked and SHARED or
976
+ ** between unlocked and EXCLUSIVE. It cannot transition between SHARED
977
+ ** and EXCLUSIVE.
978
+ */
979
+ #define SQLITE_SHM_UNLOCK 1
980
+ #define SQLITE_SHM_LOCK 2
981
+ #define SQLITE_SHM_SHARED 4
982
+ #define SQLITE_SHM_EXCLUSIVE 8
983
+
984
+ /*
985
+ ** CAPI3REF: Maximum xShmLock index
986
+ **
987
+ ** The xShmLock method on [sqlite3_io_methods] may use values
988
+ ** between 0 and this upper bound as its "offset" argument.
989
+ ** The SQLite core will never attempt to acquire or release a
990
+ ** lock outside of this range
991
+ */
992
+ #define SQLITE_SHM_NLOCK 8
993
+
866
994
 
867
995
  /*
868
996
  ** CAPI3REF: Initialize The SQLite Library
@@ -973,11 +1101,10 @@ SQLITE_API int sqlite3_os_end(void);
973
1101
  ** ^If the option is unknown or SQLite is unable to set the option
974
1102
  ** then this routine returns a non-zero [error code].
975
1103
  */
976
- SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_config(int, ...);
1104
+ SQLITE_API int sqlite3_config(int, ...);
977
1105
 
978
1106
  /*
979
1107
  ** CAPI3REF: Configure database connections
980
- ** EXPERIMENTAL
981
1108
  **
982
1109
  ** The sqlite3_db_config() interface is used to make configuration
983
1110
  ** changes to a [database connection]. The interface is similar to
@@ -997,11 +1124,10 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_config(int, ...);
997
1124
  ** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
998
1125
  ** the call is considered successful.
999
1126
  */
1000
- SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_db_config(sqlite3*, int op, ...);
1127
+ SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...);
1001
1128
 
1002
1129
  /*
1003
1130
  ** CAPI3REF: Memory Allocation Routines
1004
- ** EXPERIMENTAL
1005
1131
  **
1006
1132
  ** An instance of this object defines the interface between SQLite
1007
1133
  ** and low-level memory allocation routines.
@@ -1083,7 +1209,6 @@ struct sqlite3_mem_methods {
1083
1209
 
1084
1210
  /*
1085
1211
  ** CAPI3REF: Configuration Options
1086
- ** EXPERIMENTAL
1087
1212
  **
1088
1213
  ** These constants are the available integer configuration options that
1089
1214
  ** can be passed as the first argument to the [sqlite3_config()] interface.
@@ -1161,7 +1286,7 @@ struct sqlite3_mem_methods {
1161
1286
  ** <ul>
1162
1287
  ** <li> [sqlite3_memory_used()]
1163
1288
  ** <li> [sqlite3_memory_highwater()]
1164
- ** <li> [sqlite3_soft_heap_limit()]
1289
+ ** <li> [sqlite3_soft_heap_limit64()]
1165
1290
  ** <li> [sqlite3_status()]
1166
1291
  ** </ul>)^
1167
1292
  ** ^Memory allocation statistics are enabled by default unless SQLite is
@@ -1175,15 +1300,14 @@ struct sqlite3_mem_methods {
1175
1300
  ** aligned memory buffer from which the scrach allocations will be
1176
1301
  ** drawn, the size of each scratch allocation (sz),
1177
1302
  ** and the maximum number of scratch allocations (N). The sz
1178
- ** argument must be a multiple of 16. The sz parameter should be a few bytes
1179
- ** larger than the actual scratch space required due to internal overhead.
1303
+ ** argument must be a multiple of 16.
1180
1304
  ** The first argument must be a pointer to an 8-byte aligned buffer
1181
1305
  ** of at least sz*N bytes of memory.
1182
- ** ^SQLite will use no more than one scratch buffer per thread. So
1183
- ** N should be set to the expected maximum number of threads. ^SQLite will
1184
- ** never require a scratch buffer that is more than 6 times the database
1185
- ** page size. ^If SQLite needs needs additional scratch memory beyond
1186
- ** what is provided by this configuration option, then
1306
+ ** ^SQLite will use no more than two scratch buffers per thread. So
1307
+ ** N should be set to twice the expected maximum number of threads.
1308
+ ** ^SQLite will never require a scratch buffer that is more than 6
1309
+ ** times the database page size. ^If SQLite needs needs additional
1310
+ ** scratch memory beyond what is provided by this configuration option, then
1187
1311
  ** [sqlite3_malloc()] will be used to obtain the memory needed.</dd>
1188
1312
  **
1189
1313
  ** <dt>SQLITE_CONFIG_PAGECACHE</dt>
@@ -1203,8 +1327,7 @@ struct sqlite3_mem_methods {
1203
1327
  ** memory needs for the first N pages that it adds to cache. ^If additional
1204
1328
  ** page cache memory is needed beyond what is provided by this option, then
1205
1329
  ** SQLite goes to [sqlite3_malloc()] for the additional storage space.
1206
- ** ^The implementation might use one or more of the N buffers to hold
1207
- ** memory accounting information. The pointer in the first argument must
1330
+ ** The pointer in the first argument must
1208
1331
  ** be aligned to an 8-byte boundary or subsequent behavior of SQLite
1209
1332
  ** will be undefined.</dd>
1210
1333
  **
@@ -1269,6 +1392,24 @@ struct sqlite3_mem_methods {
1269
1392
  ** [sqlite3_pcache_methods] object. SQLite copies of the current
1270
1393
  ** page cache implementation into that object.)^ </dd>
1271
1394
  **
1395
+ ** <dt>SQLITE_CONFIG_LOG</dt>
1396
+ ** <dd> ^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
1397
+ ** function with a call signature of void(*)(void*,int,const char*),
1398
+ ** and a pointer to void. ^If the function pointer is not NULL, it is
1399
+ ** invoked by [sqlite3_log()] to process each logging event. ^If the
1400
+ ** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op.
1401
+ ** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is
1402
+ ** passed through as the first parameter to the application-defined logger
1403
+ ** function whenever that function is invoked. ^The second parameter to
1404
+ ** the logger function is a copy of the first parameter to the corresponding
1405
+ ** [sqlite3_log()] call and is intended to be a [result code] or an
1406
+ ** [extended result code]. ^The third parameter passed to the logger is
1407
+ ** log message after formatting via [sqlite3_snprintf()].
1408
+ ** The SQLite logging interface is not reentrant; the logger function
1409
+ ** supplied by the application must not invoke any SQLite interface.
1410
+ ** In a multi-threaded application, the application-defined logger
1411
+ ** function must be threadsafe. </dd>
1412
+ **
1272
1413
  ** </dl>
1273
1414
  */
1274
1415
  #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
@@ -1289,8 +1430,7 @@ struct sqlite3_mem_methods {
1289
1430
  #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
1290
1431
 
1291
1432
  /*
1292
- ** CAPI3REF: Configuration Options
1293
- ** EXPERIMENTAL
1433
+ ** CAPI3REF: Database Connection Configuration Options
1294
1434
  **
1295
1435
  ** These constants are the available integer configuration options that
1296
1436
  ** can be passed as the second argument to the [sqlite3_db_config()] interface.
@@ -1316,8 +1456,14 @@ struct sqlite3_mem_methods {
1316
1456
  ** or equal to the product of the second and third arguments. The buffer
1317
1457
  ** must be aligned to an 8-byte boundary. ^If the second argument to
1318
1458
  ** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally
1319
- ** rounded down to the next smaller
1320
- ** multiple of 8. See also: [SQLITE_CONFIG_LOOKASIDE]</dd>
1459
+ ** rounded down to the next smaller multiple of 8. ^(The lookaside memory
1460
+ ** configuration for a database connection can only be changed when that
1461
+ ** connection is not currently using lookaside memory, or in other words
1462
+ ** when the "current value" returned by
1463
+ ** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero.
1464
+ ** Any attempt to change the lookaside memory configuration when lookaside
1465
+ ** memory is in use leaves the configuration unchanged and returns
1466
+ ** [SQLITE_BUSY].)^</dd>
1321
1467
  **
1322
1468
  ** </dl>
1323
1469
  */
@@ -1622,6 +1768,9 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
1622
1768
  /*
1623
1769
  ** CAPI3REF: Convenience Routines For Running Queries
1624
1770
  **
1771
+ ** This is a legacy interface that is preserved for backwards compatibility.
1772
+ ** Use of this interface is not recommended.
1773
+ **
1625
1774
  ** Definition: A <b>result table</b> is memory data structure created by the
1626
1775
  ** [sqlite3_get_table()] interface. A result table records the
1627
1776
  ** complete query results from one or more queries.
@@ -1642,7 +1791,7 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
1642
1791
  ** It is not safe to pass a result table directly to [sqlite3_free()].
1643
1792
  ** A result table should be deallocated using [sqlite3_free_table()].
1644
1793
  **
1645
- ** As an example of the result table format, suppose a query result
1794
+ ** ^(As an example of the result table format, suppose a query result
1646
1795
  ** is as follows:
1647
1796
  **
1648
1797
  ** <blockquote><pre>
@@ -1666,7 +1815,7 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
1666
1815
  ** azResult&#91;5] = "28";
1667
1816
  ** azResult&#91;6] = "Cindy";
1668
1817
  ** azResult&#91;7] = "21";
1669
- ** </pre></blockquote>
1818
+ ** </pre></blockquote>)^
1670
1819
  **
1671
1820
  ** ^The sqlite3_get_table() function evaluates one or more
1672
1821
  ** semicolon-separated SQL statements in the zero-terminated UTF-8
@@ -1674,19 +1823,19 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
1674
1823
  ** pointer given in its 3rd parameter.
1675
1824
  **
1676
1825
  ** After the application has finished with the result from sqlite3_get_table(),
1677
- ** it should pass the result table pointer to sqlite3_free_table() in order to
1826
+ ** it must pass the result table pointer to sqlite3_free_table() in order to
1678
1827
  ** release the memory that was malloced. Because of the way the
1679
1828
  ** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling
1680
1829
  ** function must not try to call [sqlite3_free()] directly. Only
1681
1830
  ** [sqlite3_free_table()] is able to release the memory properly and safely.
1682
1831
  **
1683
- ** ^(The sqlite3_get_table() interface is implemented as a wrapper around
1832
+ ** The sqlite3_get_table() interface is implemented as a wrapper around
1684
1833
  ** [sqlite3_exec()]. The sqlite3_get_table() routine does not have access
1685
1834
  ** to any internal data structures of SQLite. It uses only the public
1686
1835
  ** interface defined here. As a consequence, errors that occur in the
1687
1836
  ** wrapper layer outside of the internal [sqlite3_exec()] call are not
1688
1837
  ** reflected in subsequent calls to [sqlite3_errcode()] or
1689
- ** [sqlite3_errmsg()].)^
1838
+ ** [sqlite3_errmsg()].
1690
1839
  */
1691
1840
  SQLITE_API int sqlite3_get_table(
1692
1841
  sqlite3 *db, /* An open database */
@@ -1711,7 +1860,7 @@ SQLITE_API void sqlite3_free_table(char **result);
1711
1860
  ** NULL pointer if [sqlite3_malloc()] is unable to allocate enough
1712
1861
  ** memory to hold the resulting string.
1713
1862
  **
1714
- ** ^(In sqlite3_snprintf() routine is similar to "snprintf()" from
1863
+ ** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from
1715
1864
  ** the standard C library. The result is written into the
1716
1865
  ** buffer supplied as the second parameter whose size is given by
1717
1866
  ** the first parameter. Note that the order of the
@@ -1730,6 +1879,8 @@ SQLITE_API void sqlite3_free_table(char **result);
1730
1879
  ** the zero terminator. So the longest string that can be completely
1731
1880
  ** written will be n-1 characters.
1732
1881
  **
1882
+ ** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf().
1883
+ **
1733
1884
  ** These routines all implement some additional formatting
1734
1885
  ** options that are useful for constructing SQL statements.
1735
1886
  ** All of the usual printf() formatting options apply. In addition, there
@@ -1793,6 +1944,7 @@ SQLITE_API void sqlite3_free_table(char **result);
1793
1944
  SQLITE_API char *sqlite3_mprintf(const char*,...);
1794
1945
  SQLITE_API char *sqlite3_vmprintf(const char*, va_list);
1795
1946
  SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);
1947
+ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
1796
1948
 
1797
1949
  /*
1798
1950
  ** CAPI3REF: Memory Allocation Subsystem
@@ -1838,7 +1990,9 @@ SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);
1838
1990
  ** is not freed.
1839
1991
  **
1840
1992
  ** ^The memory returned by sqlite3_malloc() and sqlite3_realloc()
1841
- ** is always aligned to at least an 8 byte boundary.
1993
+ ** is always aligned to at least an 8 byte boundary, or to a
1994
+ ** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time
1995
+ ** option is used.
1842
1996
  **
1843
1997
  ** In SQLite version 3.5.0 and 3.5.1, it was possible to define
1844
1998
  ** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in
@@ -2066,7 +2220,6 @@ SQLITE_API int sqlite3_set_authorizer(
2066
2220
 
2067
2221
  /*
2068
2222
  ** CAPI3REF: Tracing And Profiling Functions
2069
- ** EXPERIMENTAL
2070
2223
  **
2071
2224
  ** These routines register callback functions that can be used for
2072
2225
  ** tracing and profiling the execution of SQL statements.
@@ -2082,26 +2235,43 @@ SQLITE_API int sqlite3_set_authorizer(
2082
2235
  ** ^The callback function registered by sqlite3_profile() is invoked
2083
2236
  ** as each SQL statement finishes. ^The profile callback contains
2084
2237
  ** the original statement text and an estimate of wall-clock time
2085
- ** of how long that statement took to run.
2086
- */
2087
- SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
2238
+ ** of how long that statement took to run. ^The profile callback
2239
+ ** time is in units of nanoseconds, however the current implementation
2240
+ ** is only capable of millisecond resolution so the six least significant
2241
+ ** digits in the time are meaningless. Future versions of SQLite
2242
+ ** might provide greater resolution on the profiler callback. The
2243
+ ** sqlite3_profile() function is considered experimental and is
2244
+ ** subject to change in future versions of SQLite.
2245
+ */
2246
+ SQLITE_API void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
2088
2247
  SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*,
2089
2248
  void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
2090
2249
 
2091
2250
  /*
2092
2251
  ** CAPI3REF: Query Progress Callbacks
2093
2252
  **
2094
- ** ^This routine configures a callback function - the
2095
- ** progress callback - that is invoked periodically during long
2096
- ** running calls to [sqlite3_exec()], [sqlite3_step()] and
2097
- ** [sqlite3_get_table()]. An example use for this
2253
+ ** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback
2254
+ ** function X to be invoked periodically during long running calls to
2255
+ ** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for
2256
+ ** database connection D. An example use for this
2098
2257
  ** interface is to keep a GUI updated during a large query.
2099
2258
  **
2259
+ ** ^The parameter P is passed through as the only parameter to the
2260
+ ** callback function X. ^The parameter N is the number of
2261
+ ** [virtual machine instructions] that are evaluated between successive
2262
+ ** invocations of the callback X.
2263
+ **
2264
+ ** ^Only a single progress handler may be defined at one time per
2265
+ ** [database connection]; setting a new progress handler cancels the
2266
+ ** old one. ^Setting parameter X to NULL disables the progress handler.
2267
+ ** ^The progress handler is also disabled by setting N to a value less
2268
+ ** than 1.
2269
+ **
2100
2270
  ** ^If the progress callback returns non-zero, the operation is
2101
2271
  ** interrupted. This feature can be used to implement a
2102
2272
  ** "Cancel" button on a GUI progress dialog box.
2103
2273
  **
2104
- ** The progress handler must not do anything that will modify
2274
+ ** The progress handler callback must not do anything that will modify
2105
2275
  ** the database connection that invoked the progress handler.
2106
2276
  ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
2107
2277
  ** database connections for the meaning of "modify" in this paragraph.
@@ -2152,7 +2322,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
2152
2322
  ** case the database must already exist, otherwise an error is returned.</dd>)^
2153
2323
  **
2154
2324
  ** ^(<dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt>
2155
- ** <dd>The database is opened for reading and writing, and is creates it if
2325
+ ** <dd>The database is opened for reading and writing, and is created if
2156
2326
  ** it does not already exist. This is the behavior that is always used for
2157
2327
  ** sqlite3_open() and sqlite3_open16().</dd>)^
2158
2328
  ** </dl>
@@ -2160,7 +2330,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
2160
2330
  ** If the 3rd parameter to sqlite3_open_v2() is not one of the
2161
2331
  ** combinations shown above or one of the combinations shown above combined
2162
2332
  ** with the [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX],
2163
- ** [SQLITE_OPEN_SHAREDCACHE] and/or [SQLITE_OPEN_SHAREDCACHE] flags,
2333
+ ** [SQLITE_OPEN_SHAREDCACHE] and/or [SQLITE_OPEN_PRIVATECACHE] flags,
2164
2334
  ** then the behavior is undefined.
2165
2335
  **
2166
2336
  ** ^If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection
@@ -2285,17 +2455,22 @@ typedef struct sqlite3_stmt sqlite3_stmt;
2285
2455
  ** [database connection] whose limit is to be set or queried. The
2286
2456
  ** second parameter is one of the [limit categories] that define a
2287
2457
  ** class of constructs to be size limited. The third parameter is the
2288
- ** new limit for that construct. The function returns the old limit.)^
2458
+ ** new limit for that construct.)^
2289
2459
  **
2290
2460
  ** ^If the new limit is a negative number, the limit is unchanged.
2291
- ** ^(For the limit category of SQLITE_LIMIT_XYZ there is a
2461
+ ** ^(For each limit category SQLITE_LIMIT_<i>NAME</i> there is a
2292
2462
  ** [limits | hard upper bound]
2293
- ** set by a compile-time C preprocessor macro named
2294
- ** [limits | SQLITE_MAX_XYZ].
2463
+ ** set at compile-time by a C preprocessor macro called
2464
+ ** [limits | SQLITE_MAX_<i>NAME</i>].
2295
2465
  ** (The "_LIMIT_" in the name is changed to "_MAX_".))^
2296
2466
  ** ^Attempts to increase a limit above its hard upper bound are
2297
2467
  ** silently truncated to the hard upper bound.
2298
2468
  **
2469
+ ** ^Regardless of whether or not the limit was changed, the
2470
+ ** [sqlite3_limit()] interface returns the prior value of the limit.
2471
+ ** ^Hence, to find the current value of a limit without changing it,
2472
+ ** simply invoke this interface with the third parameter set to -1.
2473
+ **
2299
2474
  ** Run-time limits are intended for use in applications that manage
2300
2475
  ** both their own internal database and also databases that are controlled
2301
2476
  ** by untrusted external sources. An example application might be a
@@ -2324,7 +2499,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
2324
2499
  **
2325
2500
  ** <dl>
2326
2501
  ** ^(<dt>SQLITE_LIMIT_LENGTH</dt>
2327
- ** <dd>The maximum size of any string or BLOB or table row.<dd>)^
2502
+ ** <dd>The maximum size of any string or BLOB or table row, in bytes.<dd>)^
2328
2503
  **
2329
2504
  ** ^(<dt>SQLITE_LIMIT_SQL_LENGTH</dt>
2330
2505
  ** <dd>The maximum length of an SQL statement, in bytes.</dd>)^
@@ -2342,7 +2517,9 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
2342
2517
  **
2343
2518
  ** ^(<dt>SQLITE_LIMIT_VDBE_OP</dt>
2344
2519
  ** <dd>The maximum number of instructions in a virtual machine program
2345
- ** used to implement an SQL statement.</dd>)^
2520
+ ** used to implement an SQL statement. This limit is not currently
2521
+ ** enforced, though that might be added in some future release of
2522
+ ** SQLite.</dd>)^
2346
2523
  **
2347
2524
  ** ^(<dt>SQLITE_LIMIT_FUNCTION_ARG</dt>
2348
2525
  ** <dd>The maximum number of arguments on a function.</dd>)^
@@ -2355,8 +2532,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
2355
2532
  ** [GLOB] operators.</dd>)^
2356
2533
  **
2357
2534
  ** ^(<dt>SQLITE_LIMIT_VARIABLE_NUMBER</dt>
2358
- ** <dd>The maximum number of variables in an SQL statement that can
2359
- ** be bound.</dd>)^
2535
+ ** <dd>The maximum index number of any [parameter] in an SQL statement.)^
2360
2536
  **
2361
2537
  ** ^(<dt>SQLITE_LIMIT_TRIGGER_DEPTH</dt>
2362
2538
  ** <dd>The maximum depth of recursion for triggers.</dd>)^
@@ -2428,12 +2604,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
2428
2604
  ** <li>
2429
2605
  ** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
2430
2606
  ** always used to do, [sqlite3_step()] will automatically recompile the SQL
2431
- ** statement and try to run it again. ^If the schema has changed in
2432
- ** a way that makes the statement no longer valid, [sqlite3_step()] will still
2433
- ** return [SQLITE_SCHEMA]. But unlike the legacy behavior, [SQLITE_SCHEMA] is
2434
- ** now a fatal error. Calling [sqlite3_prepare_v2()] again will not make the
2435
- ** error go away. Note: use [sqlite3_errmsg()] to find the text
2436
- ** of the parsing error that results in an [SQLITE_SCHEMA] return.
2607
+ ** statement and try to run it again.
2437
2608
  ** </li>
2438
2609
  **
2439
2610
  ** <li>
@@ -2446,11 +2617,16 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
2446
2617
  ** </li>
2447
2618
  **
2448
2619
  ** <li>
2449
- ** ^If the value of a [parameter | host parameter] in the WHERE clause might
2450
- ** change the query plan for a statement, then the statement may be
2451
- ** automatically recompiled (as if there had been a schema change) on the first
2452
- ** [sqlite3_step()] call following any change to the
2453
- ** [sqlite3_bind_text | bindings] of the [parameter].
2620
+ ** ^If the specific value bound to [parameter | host parameter] in the
2621
+ ** WHERE clause might influence the choice of query plan for a statement,
2622
+ ** then the statement will be automatically recompiled, as if there had been
2623
+ ** a schema change, on the first [sqlite3_step()] call following any change
2624
+ ** to the [sqlite3_bind_text | bindings] of that [parameter].
2625
+ ** ^The specific value of WHERE-clause [parameter] might influence the
2626
+ ** choice of query plan if the parameter is the left-hand side of a [LIKE]
2627
+ ** or [GLOB] operator or if the parameter is compared to an indexed column
2628
+ ** and the [SQLITE_ENABLE_STAT2] compile-time option is enabled.
2629
+ ** the
2454
2630
  ** </li>
2455
2631
  ** </ol>
2456
2632
  */
@@ -2492,6 +2668,37 @@ SQLITE_API int sqlite3_prepare16_v2(
2492
2668
  */
2493
2669
  SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
2494
2670
 
2671
+ /*
2672
+ ** CAPI3REF: Determine If An SQL Statement Writes The Database
2673
+ **
2674
+ ** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if
2675
+ ** and only if the [prepared statement] X makes no direct changes to
2676
+ ** the content of the database file.
2677
+ **
2678
+ ** Note that [application-defined SQL functions] or
2679
+ ** [virtual tables] might change the database indirectly as a side effect.
2680
+ ** ^(For example, if an application defines a function "eval()" that
2681
+ ** calls [sqlite3_exec()], then the following SQL statement would
2682
+ ** change the database file through side-effects:
2683
+ **
2684
+ ** <blockquote><pre>
2685
+ ** SELECT eval('DELETE FROM t1') FROM t2;
2686
+ ** </pre></blockquote>
2687
+ **
2688
+ ** But because the [SELECT] statement does not change the database file
2689
+ ** directly, sqlite3_stmt_readonly() would still return true.)^
2690
+ **
2691
+ ** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK],
2692
+ ** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true,
2693
+ ** since the statements themselves do not actually modify the database but
2694
+ ** rather they control the timing of when other statements modify the
2695
+ ** database. ^The [ATTACH] and [DETACH] statements also cause
2696
+ ** sqlite3_stmt_readonly() to return true since, while those statements
2697
+ ** change the configuration of a database connection, they do not make
2698
+ ** changes to the content of the database files on disk.
2699
+ */
2700
+ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
2701
+
2495
2702
  /*
2496
2703
  ** CAPI3REF: Dynamically Typed Value Object
2497
2704
  ** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
@@ -2517,7 +2724,7 @@ SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
2517
2724
  ** then there is no distinction between protected and unprotected
2518
2725
  ** sqlite3_value objects and they can be used interchangeably. However,
2519
2726
  ** for maximum code portability it is recommended that applications
2520
- ** still make the distinction between between protected and unprotected
2727
+ ** still make the distinction between protected and unprotected
2521
2728
  ** sqlite3_value objects even when not strictly required.
2522
2729
  **
2523
2730
  ** ^The sqlite3_value objects that are passed as parameters into the
@@ -2563,7 +2770,7 @@ typedef struct sqlite3_context sqlite3_context;
2563
2770
  ** </ul>
2564
2771
  **
2565
2772
  ** In the templates above, NNN represents an integer literal,
2566
- ** and VVV represents an alphanumeric identifer.)^ ^The values of these
2773
+ ** and VVV represents an alphanumeric identifier.)^ ^The values of these
2567
2774
  ** parameters (also called "host parameter names" or "SQL parameters")
2568
2775
  ** can be set using the sqlite3_bind_*() routines defined here.
2569
2776
  **
@@ -2591,7 +2798,10 @@ typedef struct sqlite3_context sqlite3_context;
2591
2798
  **
2592
2799
  ** ^The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and
2593
2800
  ** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or
2594
- ** string after SQLite has finished with it. ^If the fifth argument is
2801
+ ** string after SQLite has finished with it. ^The destructor is called
2802
+ ** to dispose of the BLOB or string even if the call to sqlite3_bind_blob(),
2803
+ ** sqlite3_bind_text(), or sqlite3_bind_text16() fails.
2804
+ ** ^If the fifth argument is
2595
2805
  ** the special value [SQLITE_STATIC], then SQLite assumes that the
2596
2806
  ** information is in static, unmanaged space and does not need to be freed.
2597
2807
  ** ^If the fifth argument has the value [SQLITE_TRANSIENT], then
@@ -2712,6 +2922,8 @@ SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);
2712
2922
  ** ^Return the number of columns in the result set returned by the
2713
2923
  ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
2714
2924
  ** statement that does not return data (for example an [UPDATE]).
2925
+ **
2926
+ ** See also: [sqlite3_data_count()]
2715
2927
  */
2716
2928
  SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
2717
2929
 
@@ -2877,6 +3089,18 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
2877
3089
  ** be the case that the same database connection is being used by two or
2878
3090
  ** more threads at the same moment in time.
2879
3091
  **
3092
+ ** For all versions of SQLite up to and including 3.6.23.1, a call to
3093
+ ** [sqlite3_reset()] was required after sqlite3_step() returned anything
3094
+ ** other than [SQLITE_ROW] before any subsequent invocation of
3095
+ ** sqlite3_step(). Failure to reset the prepared statement using
3096
+ ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
3097
+ ** sqlite3_step(). But after version 3.6.23.1, sqlite3_step() began
3098
+ ** calling [sqlite3_reset()] automatically in this circumstance rather
3099
+ ** than returning [SQLITE_MISUSE]. This is not considered a compatibility
3100
+ ** break because any application that ever receives an SQLITE_MISUSE error
3101
+ ** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
3102
+ ** can be used to restore the legacy behavior.
3103
+ **
2880
3104
  ** <b>Goofy Interface Alert:</b> In the legacy interface, the sqlite3_step()
2881
3105
  ** API always returns a generic error code, [SQLITE_ERROR], following any
2882
3106
  ** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call
@@ -2894,8 +3118,14 @@ SQLITE_API int sqlite3_step(sqlite3_stmt*);
2894
3118
  /*
2895
3119
  ** CAPI3REF: Number of columns in a result set
2896
3120
  **
2897
- ** ^The sqlite3_data_count(P) the number of columns in the
2898
- ** of the result set of [prepared statement] P.
3121
+ ** ^The sqlite3_data_count(P) interface returns the number of columns in the
3122
+ ** current row of the result set of [prepared statement] P.
3123
+ ** ^If prepared statement P does not have results ready to return
3124
+ ** (via calls to the [sqlite3_column_int | sqlite3_column_*()] of
3125
+ ** interfaces) then sqlite3_data_count(P) returns 0.
3126
+ ** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer.
3127
+ **
3128
+ ** See also: [sqlite3_column_count()]
2899
3129
  */
2900
3130
  SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
2901
3131
 
@@ -2975,18 +3205,26 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
2975
3205
  ** ^If the result is a numeric value then sqlite3_column_bytes() uses
2976
3206
  ** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns
2977
3207
  ** the number of bytes in that string.
2978
- ** ^The value returned does not include the zero terminator at the end
2979
- ** of the string. ^For clarity: the value returned is the number of
3208
+ ** ^If the result is NULL, then sqlite3_column_bytes() returns zero.
3209
+ **
3210
+ ** ^If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16()
3211
+ ** routine returns the number of bytes in that BLOB or string.
3212
+ ** ^If the result is a UTF-8 string, then sqlite3_column_bytes16() converts
3213
+ ** the string to UTF-16 and then returns the number of bytes.
3214
+ ** ^If the result is a numeric value then sqlite3_column_bytes16() uses
3215
+ ** [sqlite3_snprintf()] to convert that value to a UTF-16 string and returns
3216
+ ** the number of bytes in that string.
3217
+ ** ^If the result is NULL, then sqlite3_column_bytes16() returns zero.
3218
+ **
3219
+ ** ^The values returned by [sqlite3_column_bytes()] and
3220
+ ** [sqlite3_column_bytes16()] do not include the zero terminators at the end
3221
+ ** of the string. ^For clarity: the values returned by
3222
+ ** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of
2980
3223
  ** bytes in the string, not the number of characters.
2981
3224
  **
2982
3225
  ** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(),
2983
3226
  ** even empty strings, are always zero terminated. ^The return
2984
- ** value from sqlite3_column_blob() for a zero-length BLOB is an arbitrary
2985
- ** pointer, possibly even a NULL pointer.
2986
- **
2987
- ** ^The sqlite3_column_bytes16() routine is similar to sqlite3_column_bytes()
2988
- ** but leaves the result in UTF-16 in native byte order instead of UTF-8.
2989
- ** ^The zero terminator is not included in this count.
3227
+ ** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.
2990
3228
  **
2991
3229
  ** ^The object returned by [sqlite3_column_value()] is an
2992
3230
  ** [unprotected sqlite3_value] object. An unprotected sqlite3_value object
@@ -3031,10 +3269,10 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3031
3269
  ** used in the table for brevity and because they are familiar to most
3032
3270
  ** C programmers.
3033
3271
  **
3034
- ** ^Note that when type conversions occur, pointers returned by prior
3272
+ ** Note that when type conversions occur, pointers returned by prior
3035
3273
  ** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or
3036
3274
  ** sqlite3_column_text16() may be invalidated.
3037
- ** ^(Type conversions and pointer invalidations might occur
3275
+ ** Type conversions and pointer invalidations might occur
3038
3276
  ** in the following cases:
3039
3277
  **
3040
3278
  ** <ul>
@@ -3047,22 +3285,22 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3047
3285
  ** <li> The initial content is UTF-16 text and sqlite3_column_bytes() or
3048
3286
  ** sqlite3_column_text() is called. The content must be converted
3049
3287
  ** to UTF-8.</li>
3050
- ** </ul>)^
3288
+ ** </ul>
3051
3289
  **
3052
3290
  ** ^Conversions between UTF-16be and UTF-16le are always done in place and do
3053
3291
  ** not invalidate a prior pointer, though of course the content of the buffer
3054
- ** that the prior pointer points to will have been modified. Other kinds
3292
+ ** that the prior pointer references will have been modified. Other kinds
3055
3293
  ** of conversion are done in place when it is possible, but sometimes they
3056
3294
  ** are not possible and in those cases prior pointers are invalidated.
3057
3295
  **
3058
- ** ^(The safest and easiest to remember policy is to invoke these routines
3296
+ ** The safest and easiest to remember policy is to invoke these routines
3059
3297
  ** in one of the following ways:
3060
3298
  **
3061
3299
  ** <ul>
3062
3300
  ** <li>sqlite3_column_text() followed by sqlite3_column_bytes()</li>
3063
3301
  ** <li>sqlite3_column_blob() followed by sqlite3_column_bytes()</li>
3064
3302
  ** <li>sqlite3_column_text16() followed by sqlite3_column_bytes16()</li>
3065
- ** </ul>)^
3303
+ ** </ul>
3066
3304
  **
3067
3305
  ** In other words, you should call sqlite3_column_text(),
3068
3306
  ** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result
@@ -3100,17 +3338,26 @@ SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
3100
3338
  ** CAPI3REF: Destroy A Prepared Statement Object
3101
3339
  **
3102
3340
  ** ^The sqlite3_finalize() function is called to delete a [prepared statement].
3103
- ** ^If the statement was executed successfully or not executed at all, then
3104
- ** SQLITE_OK is returned. ^If execution of the statement failed then an
3105
- ** [error code] or [extended error code] is returned.
3106
- **
3107
- ** ^This routine can be called at any point during the execution of the
3108
- ** [prepared statement]. ^If the virtual machine has not
3109
- ** completed execution when this routine is called, that is like
3110
- ** encountering an error or an [sqlite3_interrupt | interrupt].
3111
- ** ^Incomplete updates may be rolled back and transactions canceled,
3112
- ** depending on the circumstances, and the
3113
- ** [error code] returned will be [SQLITE_ABORT].
3341
+ ** ^If the most recent evaluation of the statement encountered no errors or
3342
+ ** or if the statement is never been evaluated, then sqlite3_finalize() returns
3343
+ ** SQLITE_OK. ^If the most recent evaluation of statement S failed, then
3344
+ ** sqlite3_finalize(S) returns the appropriate [error code] or
3345
+ ** [extended error code].
3346
+ **
3347
+ ** ^The sqlite3_finalize(S) routine can be called at any point during
3348
+ ** the life cycle of [prepared statement] S:
3349
+ ** before statement S is ever evaluated, after
3350
+ ** one or more calls to [sqlite3_reset()], or after any call
3351
+ ** to [sqlite3_step()] regardless of whether or not the statement has
3352
+ ** completed execution.
3353
+ **
3354
+ ** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op.
3355
+ **
3356
+ ** The application must finalize every [prepared statement] in order to avoid
3357
+ ** resource leaks. It is a grievous error for the application to try to use
3358
+ ** a prepared statement after it has been finalized. Any use of a prepared
3359
+ ** statement after it has been finalized can result in undefined and
3360
+ ** undesirable behavior such as segfaults and heap corruption.
3114
3361
  */
3115
3362
  SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
3116
3363
 
@@ -3146,23 +3393,25 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
3146
3393
  ** KEYWORDS: {application-defined SQL function}
3147
3394
  ** KEYWORDS: {application-defined SQL functions}
3148
3395
  **
3149
- ** ^These two functions (collectively known as "function creation routines")
3396
+ ** ^These functions (collectively known as "function creation routines")
3150
3397
  ** are used to add SQL functions or aggregates or to redefine the behavior
3151
- ** of existing SQL functions or aggregates. The only difference between the
3152
- ** two is that the second parameter, the name of the (scalar) function or
3153
- ** aggregate, is encoded in UTF-8 for sqlite3_create_function() and UTF-16
3154
- ** for sqlite3_create_function16().
3398
+ ** of existing SQL functions or aggregates. The only differences between
3399
+ ** these routines are the text encoding expected for
3400
+ ** the the second parameter (the name of the function being created)
3401
+ ** and the presence or absence of a destructor callback for
3402
+ ** the application data pointer.
3155
3403
  **
3156
3404
  ** ^The first parameter is the [database connection] to which the SQL
3157
3405
  ** function is to be added. ^If an application uses more than one database
3158
3406
  ** connection then application-defined SQL functions must be added
3159
3407
  ** to each database connection separately.
3160
3408
  **
3161
- ** The second parameter is the name of the SQL function to be created or
3162
- ** redefined. ^The length of the name is limited to 255 bytes, exclusive of
3163
- ** the zero-terminator. Note that the name length limit is in bytes, not
3164
- ** characters. ^Any attempt to create a function with a longer name
3165
- ** will result in [SQLITE_ERROR] being returned.
3409
+ ** ^The second parameter is the name of the SQL function to be created or
3410
+ ** redefined. ^The length of the name is limited to 255 bytes in a UTF-8
3411
+ ** representation, exclusive of the zero-terminator. ^Note that the name
3412
+ ** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes.
3413
+ ** ^Any attempt to create a function with a longer name
3414
+ ** will result in [SQLITE_MISUSE] being returned.
3166
3415
  **
3167
3416
  ** ^The third parameter (nArg)
3168
3417
  ** is the number of arguments that the SQL function or
@@ -3172,10 +3421,10 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
3172
3421
  ** parameter is less than -1 or greater than 127 then the behavior is
3173
3422
  ** undefined.
3174
3423
  **
3175
- ** The fourth parameter, eTextRep, specifies what
3424
+ ** ^The fourth parameter, eTextRep, specifies what
3176
3425
  ** [SQLITE_UTF8 | text encoding] this SQL function prefers for
3177
- ** its parameters. Any SQL function implementation should be able to work
3178
- ** work with UTF-8, UTF-16le, or UTF-16be. But some implementations may be
3426
+ ** its parameters. Every SQL function implementation must be able to work
3427
+ ** with UTF-8, UTF-16le, or UTF-16be. But some implementations may be
3179
3428
  ** more efficient with one encoding than another. ^An application may
3180
3429
  ** invoke sqlite3_create_function() or sqlite3_create_function16() multiple
3181
3430
  ** times with the same function but with different values of eTextRep.
@@ -3187,13 +3436,24 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
3187
3436
  ** ^(The fifth parameter is an arbitrary pointer. The implementation of the
3188
3437
  ** function can gain access to this pointer using [sqlite3_user_data()].)^
3189
3438
  **
3190
- ** The seventh, eighth and ninth parameters, xFunc, xStep and xFinal, are
3439
+ ** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are
3191
3440
  ** pointers to C-language functions that implement the SQL function or
3192
3441
  ** aggregate. ^A scalar SQL function requires an implementation of the xFunc
3193
- ** callback only; NULL pointers should be passed as the xStep and xFinal
3442
+ ** callback only; NULL pointers must be passed as the xStep and xFinal
3194
3443
  ** parameters. ^An aggregate SQL function requires an implementation of xStep
3195
- ** and xFinal and NULL should be passed for xFunc. ^To delete an existing
3196
- ** SQL function or aggregate, pass NULL for all three function callbacks.
3444
+ ** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing
3445
+ ** SQL function or aggregate, pass NULL poiners for all three function
3446
+ ** callbacks.
3447
+ **
3448
+ ** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL,
3449
+ ** then it is destructor for the application data pointer.
3450
+ ** The destructor is invoked when the function is deleted, either by being
3451
+ ** overloaded or when the database connection closes.)^
3452
+ ** ^The destructor is also invoked if the call to
3453
+ ** sqlite3_create_function_v2() fails.
3454
+ ** ^When the destructor callback of the tenth parameter is invoked, it
3455
+ ** is passed a single argument which is a copy of the application data
3456
+ ** pointer which was the fifth parameter to sqlite3_create_function_v2().
3197
3457
  **
3198
3458
  ** ^It is permitted to register multiple implementations of the same
3199
3459
  ** functions with the same name but with either differing numbers of
@@ -3209,11 +3469,6 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
3209
3469
  ** between UTF8 and UTF16.
3210
3470
  **
3211
3471
  ** ^Built-in functions may be overloaded by new application-defined functions.
3212
- ** ^The first application-defined function with a given name overrides all
3213
- ** built-in functions in the same [database connection] with the same name.
3214
- ** ^Subsequent application-defined functions of the same name only override
3215
- ** prior application-defined functions that are an exact match for the
3216
- ** number of parameters and preferred encoding.
3217
3472
  **
3218
3473
  ** ^An application-defined function is permitted to call other
3219
3474
  ** SQLite interfaces. However, such calls must not
@@ -3240,6 +3495,17 @@ SQLITE_API int sqlite3_create_function16(
3240
3495
  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
3241
3496
  void (*xFinal)(sqlite3_context*)
3242
3497
  );
3498
+ SQLITE_API int sqlite3_create_function_v2(
3499
+ sqlite3 *db,
3500
+ const char *zFunctionName,
3501
+ int nArg,
3502
+ int eTextRep,
3503
+ void *pApp,
3504
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
3505
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**),
3506
+ void (*xFinal)(sqlite3_context*),
3507
+ void(*xDestroy)(void*)
3508
+ );
3243
3509
 
3244
3510
  /*
3245
3511
  ** CAPI3REF: Text Encodings
@@ -3283,7 +3549,7 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
3283
3549
  ** The xFunc (for scalar functions) or xStep (for aggregates) parameters
3284
3550
  ** to [sqlite3_create_function()] and [sqlite3_create_function16()]
3285
3551
  ** define callbacks that implement the SQL functions and aggregates.
3286
- ** The 4th parameter to these callbacks is an array of pointers to
3552
+ ** The 3rd parameter to these callbacks is an array of pointers to
3287
3553
  ** [protected sqlite3_value] objects. There is one [sqlite3_value] object for
3288
3554
  ** each parameter to the SQL function. These routines are used to
3289
3555
  ** extract values from the [sqlite3_value] objects.
@@ -3334,7 +3600,7 @@ SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
3334
3600
  /*
3335
3601
  ** CAPI3REF: Obtain Aggregate Function Context
3336
3602
  **
3337
- ** Implementions of aggregate SQL functions use this
3603
+ ** Implementations of aggregate SQL functions use this
3338
3604
  ** routine to allocate memory for storing their state.
3339
3605
  **
3340
3606
  ** ^The first time the sqlite3_aggregate_context(C,N) routine is called
@@ -3586,46 +3852,79 @@ SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
3586
3852
  /*
3587
3853
  ** CAPI3REF: Define New Collating Sequences
3588
3854
  **
3589
- ** These functions are used to add new collation sequences to the
3590
- ** [database connection] specified as the first argument.
3855
+ ** ^These functions add, remove, or modify a [collation] associated
3856
+ ** with the [database connection] specified as the first argument.
3591
3857
  **
3592
- ** ^The name of the new collation sequence is specified as a UTF-8 string
3858
+ ** ^The name of the collation is a UTF-8 string
3593
3859
  ** for sqlite3_create_collation() and sqlite3_create_collation_v2()
3594
- ** and a UTF-16 string for sqlite3_create_collation16(). ^In all cases
3595
- ** the name is passed as the second function argument.
3596
- **
3597
- ** ^The third argument may be one of the constants [SQLITE_UTF8],
3598
- ** [SQLITE_UTF16LE], or [SQLITE_UTF16BE], indicating that the user-supplied
3599
- ** routine expects to be passed pointers to strings encoded using UTF-8,
3600
- ** UTF-16 little-endian, or UTF-16 big-endian, respectively. ^The
3601
- ** third argument might also be [SQLITE_UTF16] to indicate that the routine
3602
- ** expects pointers to be UTF-16 strings in the native byte order, or the
3603
- ** argument can be [SQLITE_UTF16_ALIGNED] if the
3604
- ** the routine expects pointers to 16-bit word aligned strings
3605
- ** of UTF-16 in the native byte order.
3606
- **
3607
- ** A pointer to the user supplied routine must be passed as the fifth
3608
- ** argument. ^If it is NULL, this is the same as deleting the collation
3609
- ** sequence (so that SQLite cannot call it anymore).
3610
- ** ^Each time the application supplied function is invoked, it is passed
3611
- ** as its first parameter a copy of the void* passed as the fourth argument
3612
- ** to sqlite3_create_collation() or sqlite3_create_collation16().
3613
- **
3614
- ** ^The remaining arguments to the application-supplied routine are two strings,
3615
- ** each represented by a (length, data) pair and encoded in the encoding
3616
- ** that was passed as the third argument when the collation sequence was
3617
- ** registered. The application defined collation routine should
3618
- ** return negative, zero or positive if the first string is less than,
3619
- ** equal to, or greater than the second string. i.e. (STRING1 - STRING2).
3860
+ ** and a UTF-16 string in native byte order for sqlite3_create_collation16().
3861
+ ** ^Collation names that compare equal according to [sqlite3_strnicmp()] are
3862
+ ** considered to be the same name.
3863
+ **
3864
+ ** ^(The third argument (eTextRep) must be one of the constants:
3865
+ ** <ul>
3866
+ ** <li> [SQLITE_UTF8],
3867
+ ** <li> [SQLITE_UTF16LE],
3868
+ ** <li> [SQLITE_UTF16BE],
3869
+ ** <li> [SQLITE_UTF16], or
3870
+ ** <li> [SQLITE_UTF16_ALIGNED].
3871
+ ** </ul>)^
3872
+ ** ^The eTextRep argument determines the encoding of strings passed
3873
+ ** to the collating function callback, xCallback.
3874
+ ** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep
3875
+ ** force strings to be UTF16 with native byte order.
3876
+ ** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin
3877
+ ** on an even byte address.
3878
+ **
3879
+ ** ^The fourth argument, pArg, is a application data pointer that is passed
3880
+ ** through as the first argument to the collating function callback.
3881
+ **
3882
+ ** ^The fifth argument, xCallback, is a pointer to the collating function.
3883
+ ** ^Multiple collating functions can be registered using the same name but
3884
+ ** with different eTextRep parameters and SQLite will use whichever
3885
+ ** function requires the least amount of data transformation.
3886
+ ** ^If the xCallback argument is NULL then the collating function is
3887
+ ** deleted. ^When all collating functions having the same name are deleted,
3888
+ ** that collation is no longer usable.
3889
+ **
3890
+ ** ^The collating function callback is invoked with a copy of the pArg
3891
+ ** application data pointer and with two strings in the encoding specified
3892
+ ** by the eTextRep argument. The collating function must return an
3893
+ ** integer that is negative, zero, or positive
3894
+ ** if the first string is less than, equal to, or greater than the second,
3895
+ ** respectively. A collating function must alway return the same answer
3896
+ ** given the same inputs. If two or more collating functions are registered
3897
+ ** to the same collation name (using different eTextRep values) then all
3898
+ ** must give an equivalent answer when invoked with equivalent strings.
3899
+ ** The collating function must obey the following properties for all
3900
+ ** strings A, B, and C:
3901
+ **
3902
+ ** <ol>
3903
+ ** <li> If A==B then B==A.
3904
+ ** <li> If A==B and B==C then A==C.
3905
+ ** <li> If A&lt;B THEN B&gt;A.
3906
+ ** <li> If A&lt;B and B&lt;C then A&lt;C.
3907
+ ** </ol>
3908
+ **
3909
+ ** If a collating function fails any of the above constraints and that
3910
+ ** collating function is registered and used, then the behavior of SQLite
3911
+ ** is undefined.
3620
3912
  **
3621
3913
  ** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation()
3622
- ** except that it takes an extra argument which is a destructor for
3623
- ** the collation. ^The destructor is called when the collation is
3624
- ** destroyed and is passed a copy of the fourth parameter void* pointer
3625
- ** of the sqlite3_create_collation_v2().
3626
- ** ^Collations are destroyed when they are overridden by later calls to the
3627
- ** collation creation functions or when the [database connection] is closed
3628
- ** using [sqlite3_close()].
3914
+ ** with the addition that the xDestroy callback is invoked on pArg when
3915
+ ** the collating function is deleted.
3916
+ ** ^Collating functions are deleted when they are overridden by later
3917
+ ** calls to the collation creation functions or when the
3918
+ ** [database connection] is closed using [sqlite3_close()].
3919
+ **
3920
+ ** ^The xDestroy callback is <u>not</u> called if the
3921
+ ** sqlite3_create_collation_v2() function fails. Applications that invoke
3922
+ ** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should
3923
+ ** check the return code and dispose of the application data pointer
3924
+ ** themselves rather than expecting SQLite to deal with it for them.
3925
+ ** This is different from every other SQLite interface. The inconsistency
3926
+ ** is unfortunate but cannot be changed without breaking backwards
3927
+ ** compatibility.
3629
3928
  **
3630
3929
  ** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
3631
3930
  */
@@ -3633,14 +3932,14 @@ SQLITE_API int sqlite3_create_collation(
3633
3932
  sqlite3*,
3634
3933
  const char *zName,
3635
3934
  int eTextRep,
3636
- void*,
3935
+ void *pArg,
3637
3936
  int(*xCompare)(void*,int,const void*,int,const void*)
3638
3937
  );
3639
3938
  SQLITE_API int sqlite3_create_collation_v2(
3640
3939
  sqlite3*,
3641
3940
  const char *zName,
3642
3941
  int eTextRep,
3643
- void*,
3942
+ void *pArg,
3644
3943
  int(*xCompare)(void*,int,const void*,int,const void*),
3645
3944
  void(*xDestroy)(void*)
3646
3945
  );
@@ -3648,7 +3947,7 @@ SQLITE_API int sqlite3_create_collation16(
3648
3947
  sqlite3*,
3649
3948
  const void *zName,
3650
3949
  int eTextRep,
3651
- void*,
3950
+ void *pArg,
3652
3951
  int(*xCompare)(void*,int,const void*,int,const void*)
3653
3952
  );
3654
3953
 
@@ -3689,7 +3988,7 @@ SQLITE_API int sqlite3_collation_needed16(
3689
3988
  void(*)(void*,sqlite3*,int eTextRep,const void*)
3690
3989
  );
3691
3990
 
3692
- #if SQLITE_HAS_CODEC
3991
+ #ifdef SQLITE_HAS_CODEC
3693
3992
  /*
3694
3993
  ** Specify the key for an encrypted database. This routine should be
3695
3994
  ** called right after sqlite3_open().
@@ -3737,16 +4036,19 @@ SQLITE_API void sqlite3_activate_cerod(
3737
4036
  /*
3738
4037
  ** CAPI3REF: Suspend Execution For A Short Time
3739
4038
  **
3740
- ** ^The sqlite3_sleep() function causes the current thread to suspend execution
4039
+ ** The sqlite3_sleep() function causes the current thread to suspend execution
3741
4040
  ** for at least a number of milliseconds specified in its parameter.
3742
4041
  **
3743
- ** ^If the operating system does not support sleep requests with
4042
+ ** If the operating system does not support sleep requests with
3744
4043
  ** millisecond time resolution, then the time will be rounded up to
3745
- ** the nearest second. ^The number of milliseconds of sleep actually
4044
+ ** the nearest second. The number of milliseconds of sleep actually
3746
4045
  ** requested from the operating system is returned.
3747
4046
  **
3748
4047
  ** ^SQLite implements this interface by calling the xSleep()
3749
- ** method of the default [sqlite3_vfs] object.
4048
+ ** method of the default [sqlite3_vfs] object. If the xSleep() method
4049
+ ** of the default VFS is not implemented correctly, or not implemented at
4050
+ ** all, then the behavior of sqlite3_sleep() may deviate from the description
4051
+ ** in the previous paragraphs.
3750
4052
  */
3751
4053
  SQLITE_API int sqlite3_sleep(int);
3752
4054
 
@@ -3872,8 +4174,6 @@ SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
3872
4174
  ** an error or constraint causes an implicit rollback to occur.
3873
4175
  ** ^The rollback callback is not invoked if a transaction is
3874
4176
  ** automatically rolled back because the database connection is closed.
3875
- ** ^The rollback callback is not invoked if a transaction is
3876
- ** rolled back because a commit callback returned non-zero.
3877
4177
  **
3878
4178
  ** See also the [sqlite3_update_hook()] interface.
3879
4179
  */
@@ -3970,40 +4270,73 @@ SQLITE_API int sqlite3_enable_shared_cache(int);
3970
4270
  ** pages to improve performance is an example of non-essential memory.
3971
4271
  ** ^sqlite3_release_memory() returns the number of bytes actually freed,
3972
4272
  ** which might be more or less than the amount requested.
4273
+ ** ^The sqlite3_release_memory() routine is a no-op returning zero
4274
+ ** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT].
3973
4275
  */
3974
4276
  SQLITE_API int sqlite3_release_memory(int);
3975
4277
 
3976
4278
  /*
3977
4279
  ** CAPI3REF: Impose A Limit On Heap Size
3978
4280
  **
3979
- ** ^The sqlite3_soft_heap_limit() interface places a "soft" limit
3980
- ** on the amount of heap memory that may be allocated by SQLite.
3981
- ** ^If an internal allocation is requested that would exceed the
3982
- ** soft heap limit, [sqlite3_release_memory()] is invoked one or
3983
- ** more times to free up some space before the allocation is performed.
4281
+ ** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
4282
+ ** soft limit on the amount of heap memory that may be allocated by SQLite.
4283
+ ** ^SQLite strives to keep heap memory utilization below the soft heap
4284
+ ** limit by reducing the number of pages held in the page cache
4285
+ ** as heap memory usages approaches the limit.
4286
+ ** ^The soft heap limit is "soft" because even though SQLite strives to stay
4287
+ ** below the limit, it will exceed the limit rather than generate
4288
+ ** an [SQLITE_NOMEM] error. In other words, the soft heap limit
4289
+ ** is advisory only.
3984
4290
  **
3985
- ** ^The limit is called "soft" because if [sqlite3_release_memory()]
3986
- ** cannot free sufficient memory to prevent the limit from being exceeded,
3987
- ** the memory is allocated anyway and the current operation proceeds.
4291
+ ** ^The return value from sqlite3_soft_heap_limit64() is the size of
4292
+ ** the soft heap limit prior to the call. ^If the argument N is negative
4293
+ ** then no change is made to the soft heap limit. Hence, the current
4294
+ ** size of the soft heap limit can be determined by invoking
4295
+ ** sqlite3_soft_heap_limit64() with a negative argument.
3988
4296
  **
3989
- ** ^A negative or zero value for N means that there is no soft heap limit and
3990
- ** [sqlite3_release_memory()] will only be called when memory is exhausted.
3991
- ** ^The default value for the soft heap limit is zero.
4297
+ ** ^If the argument N is zero then the soft heap limit is disabled.
3992
4298
  **
3993
- ** ^(SQLite makes a best effort to honor the soft heap limit.
3994
- ** But if the soft heap limit cannot be honored, execution will
3995
- ** continue without error or notification.)^ This is why the limit is
3996
- ** called a "soft" limit. It is advisory only.
4299
+ ** ^(The soft heap limit is not enforced in the current implementation
4300
+ ** if one or more of following conditions are true:
3997
4301
  **
3998
- ** Prior to SQLite version 3.5.0, this routine only constrained the memory
3999
- ** allocated by a single thread - the same thread in which this routine
4000
- ** runs. Beginning with SQLite version 3.5.0, the soft heap limit is
4001
- ** applied to all threads. The value specified for the soft heap limit
4002
- ** is an upper bound on the total memory allocation for all threads. In
4003
- ** version 3.5.0 there is no mechanism for limiting the heap usage for
4004
- ** individual threads.
4302
+ ** <ul>
4303
+ ** <li> The soft heap limit is set to zero.
4304
+ ** <li> Memory accounting is disabled using a combination of the
4305
+ ** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and
4306
+ ** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.
4307
+ ** <li> An alternative page cache implementation is specifed using
4308
+ ** [sqlite3_config]([SQLITE_CONFIG_PCACHE],...).
4309
+ ** <li> The page cache allocates from its own memory pool supplied
4310
+ ** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
4311
+ ** from the heap.
4312
+ ** </ul>)^
4313
+ **
4314
+ ** Beginning with SQLite version 3.7.3, the soft heap limit is enforced
4315
+ ** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT]
4316
+ ** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT],
4317
+ ** the soft heap limit is enforced on every memory allocation. Without
4318
+ ** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced
4319
+ ** when memory is allocated by the page cache. Testing suggests that because
4320
+ ** the page cache is the predominate memory user in SQLite, most
4321
+ ** applications will achieve adequate soft heap limit enforcement without
4322
+ ** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT].
4323
+ **
4324
+ ** The circumstances under which SQLite will enforce the soft heap limit may
4325
+ ** changes in future releases of SQLite.
4005
4326
  */
4006
- SQLITE_API void sqlite3_soft_heap_limit(int);
4327
+ SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
4328
+
4329
+ /*
4330
+ ** CAPI3REF: Deprecated Soft Heap Limit Interface
4331
+ ** DEPRECATED
4332
+ **
4333
+ ** This is a deprecated version of the [sqlite3_soft_heap_limit64()]
4334
+ ** interface. This routine is provided for historical compatibility
4335
+ ** only. All new applications should use the
4336
+ ** [sqlite3_soft_heap_limit64()] interface rather than this one.
4337
+ */
4338
+ SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
4339
+
4007
4340
 
4008
4341
  /*
4009
4342
  ** CAPI3REF: Extract Metadata About A Column Of A Table
@@ -4127,40 +4460,51 @@ SQLITE_API int sqlite3_load_extension(
4127
4460
  SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
4128
4461
 
4129
4462
  /*
4130
- ** CAPI3REF: Automatically Load An Extensions
4463
+ ** CAPI3REF: Automatically Load Statically Linked Extensions
4464
+ **
4465
+ ** ^This interface causes the xEntryPoint() function to be invoked for
4466
+ ** each new [database connection] that is created. The idea here is that
4467
+ ** xEntryPoint() is the entry point for a statically linked SQLite extension
4468
+ ** that is to be automatically loaded into all new database connections.
4131
4469
  **
4132
- ** ^This API can be invoked at program startup in order to register
4133
- ** one or more statically linked extensions that will be available
4134
- ** to all new [database connections].
4470
+ ** ^(Even though the function prototype shows that xEntryPoint() takes
4471
+ ** no arguments and returns void, SQLite invokes xEntryPoint() with three
4472
+ ** arguments and expects and integer result as if the signature of the
4473
+ ** entry point where as follows:
4135
4474
  **
4136
- ** ^(This routine stores a pointer to the extension entry point
4137
- ** in an array that is obtained from [sqlite3_malloc()]. That memory
4138
- ** is deallocated by [sqlite3_reset_auto_extension()].)^
4475
+ ** <blockquote><pre>
4476
+ ** &nbsp; int xEntryPoint(
4477
+ ** &nbsp; sqlite3 *db,
4478
+ ** &nbsp; const char **pzErrMsg,
4479
+ ** &nbsp; const struct sqlite3_api_routines *pThunk
4480
+ ** &nbsp; );
4481
+ ** </pre></blockquote>)^
4482
+ **
4483
+ ** If the xEntryPoint routine encounters an error, it should make *pzErrMsg
4484
+ ** point to an appropriate error message (obtained from [sqlite3_mprintf()])
4485
+ ** and return an appropriate [error code]. ^SQLite ensures that *pzErrMsg
4486
+ ** is NULL before calling the xEntryPoint(). ^SQLite will invoke
4487
+ ** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns. ^If any
4488
+ ** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()],
4489
+ ** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail.
4139
4490
  **
4140
- ** ^This function registers an extension entry point that is
4141
- ** automatically invoked whenever a new [database connection]
4142
- ** is opened using [sqlite3_open()], [sqlite3_open16()],
4143
- ** or [sqlite3_open_v2()].
4144
- ** ^Duplicate extensions are detected so calling this routine
4145
- ** multiple times with the same extension is harmless.
4146
- ** ^Automatic extensions apply across all threads.
4491
+ ** ^Calling sqlite3_auto_extension(X) with an entry point X that is already
4492
+ ** on the list of automatic extensions is a harmless no-op. ^No entry point
4493
+ ** will be called more than once for each database connection that is opened.
4494
+ **
4495
+ ** See also: [sqlite3_reset_auto_extension()].
4147
4496
  */
4148
4497
  SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void));
4149
4498
 
4150
4499
  /*
4151
4500
  ** CAPI3REF: Reset Automatic Extension Loading
4152
4501
  **
4153
- ** ^(This function disables all previously registered automatic
4154
- ** extensions. It undoes the effect of all prior
4155
- ** [sqlite3_auto_extension()] calls.)^
4156
- **
4157
- ** ^This function disables automatic extensions in all threads.
4502
+ ** ^This interface disables all automatic extensions previously
4503
+ ** registered using [sqlite3_auto_extension()].
4158
4504
  */
4159
4505
  SQLITE_API void sqlite3_reset_auto_extension(void);
4160
4506
 
4161
4507
  /*
4162
- ****** EXPERIMENTAL - subject to change without notice **************
4163
- **
4164
4508
  ** The interface to the virtual-table mechanism is currently considered
4165
4509
  ** to be experimental. The interface might change in incompatible ways.
4166
4510
  ** If this is a problem for you, do not use the interface at this time.
@@ -4180,7 +4524,6 @@ typedef struct sqlite3_module sqlite3_module;
4180
4524
  /*
4181
4525
  ** CAPI3REF: Virtual Table Object
4182
4526
  ** KEYWORDS: sqlite3_module {virtual table module}
4183
- ** EXPERIMENTAL
4184
4527
  **
4185
4528
  ** This structure, sometimes called a a "virtual table module",
4186
4529
  ** defines the implementation of a [virtual tables].
@@ -4227,9 +4570,9 @@ struct sqlite3_module {
4227
4570
  /*
4228
4571
  ** CAPI3REF: Virtual Table Indexing Information
4229
4572
  ** KEYWORDS: sqlite3_index_info
4230
- ** EXPERIMENTAL
4231
4573
  **
4232
- ** The sqlite3_index_info structure and its substructures is used to
4574
+ ** The sqlite3_index_info structure and its substructures is used as part
4575
+ ** of the [virtual table] interface to
4233
4576
  ** pass information into and receive the reply from the [xBestIndex]
4234
4577
  ** method of a [virtual table module]. The fields under **Inputs** are the
4235
4578
  ** inputs to xBestIndex and are read-only. xBestIndex inserts its
@@ -4237,10 +4580,12 @@ struct sqlite3_module {
4237
4580
  **
4238
4581
  ** ^(The aConstraint[] array records WHERE clause constraints of the form:
4239
4582
  **
4240
- ** <pre>column OP expr</pre>
4583
+ ** <blockquote>column OP expr</blockquote>
4241
4584
  **
4242
4585
  ** where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^ ^(The particular operator is
4243
- ** stored in aConstraint[].op.)^ ^(The index of the column is stored in
4586
+ ** stored in aConstraint[].op using one of the
4587
+ ** [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^
4588
+ ** ^(The index of the column is stored in
4244
4589
  ** aConstraint[].iColumn.)^ ^(aConstraint[].usable is TRUE if the
4245
4590
  ** expr on the right-hand side can be evaluated (and thus the constraint
4246
4591
  ** is usable) and false if it cannot.)^
@@ -4300,6 +4645,15 @@ struct sqlite3_index_info {
4300
4645
  int orderByConsumed; /* True if output is already ordered */
4301
4646
  double estimatedCost; /* Estimated cost of using this index */
4302
4647
  };
4648
+
4649
+ /*
4650
+ ** CAPI3REF: Virtual Table Constraint Operator Codes
4651
+ **
4652
+ ** These macros defined the allowed values for the
4653
+ ** [sqlite3_index_info].aConstraint[].op field. Each value represents
4654
+ ** an operator that is part of a constraint term in the wHERE clause of
4655
+ ** a query that uses a [virtual table].
4656
+ */
4303
4657
  #define SQLITE_INDEX_CONSTRAINT_EQ 2
4304
4658
  #define SQLITE_INDEX_CONSTRAINT_GT 4
4305
4659
  #define SQLITE_INDEX_CONSTRAINT_LE 8
@@ -4309,7 +4663,6 @@ struct sqlite3_index_info {
4309
4663
 
4310
4664
  /*
4311
4665
  ** CAPI3REF: Register A Virtual Table Implementation
4312
- ** EXPERIMENTAL
4313
4666
  **
4314
4667
  ** ^These routines are used to register a new [virtual table module] name.
4315
4668
  ** ^Module names must be registered before
@@ -4327,17 +4680,19 @@ struct sqlite3_index_info {
4327
4680
  ** ^The sqlite3_create_module_v2() interface has a fifth parameter which
4328
4681
  ** is a pointer to a destructor for the pClientData. ^SQLite will
4329
4682
  ** invoke the destructor function (if it is not NULL) when SQLite
4330
- ** no longer needs the pClientData pointer. ^The sqlite3_create_module()
4683
+ ** no longer needs the pClientData pointer. ^The destructor will also
4684
+ ** be invoked if the call to sqlite3_create_module_v2() fails.
4685
+ ** ^The sqlite3_create_module()
4331
4686
  ** interface is equivalent to sqlite3_create_module_v2() with a NULL
4332
4687
  ** destructor.
4333
4688
  */
4334
- SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_create_module(
4689
+ SQLITE_API int sqlite3_create_module(
4335
4690
  sqlite3 *db, /* SQLite connection to register module with */
4336
4691
  const char *zName, /* Name of the module */
4337
4692
  const sqlite3_module *p, /* Methods for the module */
4338
4693
  void *pClientData /* Client data for xCreate/xConnect */
4339
4694
  );
4340
- SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_create_module_v2(
4695
+ SQLITE_API int sqlite3_create_module_v2(
4341
4696
  sqlite3 *db, /* SQLite connection to register module with */
4342
4697
  const char *zName, /* Name of the module */
4343
4698
  const sqlite3_module *p, /* Methods for the module */
@@ -4348,7 +4703,6 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_create_module_v2(
4348
4703
  /*
4349
4704
  ** CAPI3REF: Virtual Table Instance Object
4350
4705
  ** KEYWORDS: sqlite3_vtab
4351
- ** EXPERIMENTAL
4352
4706
  **
4353
4707
  ** Every [virtual table module] implementation uses a subclass
4354
4708
  ** of this object to describe a particular instance
@@ -4374,7 +4728,6 @@ struct sqlite3_vtab {
4374
4728
  /*
4375
4729
  ** CAPI3REF: Virtual Table Cursor Object
4376
4730
  ** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor}
4377
- ** EXPERIMENTAL
4378
4731
  **
4379
4732
  ** Every [virtual table module] implementation uses a subclass of the
4380
4733
  ** following structure to describe cursors that point into the
@@ -4396,18 +4749,16 @@ struct sqlite3_vtab_cursor {
4396
4749
 
4397
4750
  /*
4398
4751
  ** CAPI3REF: Declare The Schema Of A Virtual Table
4399
- ** EXPERIMENTAL
4400
4752
  **
4401
4753
  ** ^The [xCreate] and [xConnect] methods of a
4402
4754
  ** [virtual table module] call this interface
4403
4755
  ** to declare the format (the names and datatypes of the columns) of
4404
4756
  ** the virtual tables they implement.
4405
4757
  */
4406
- SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
4758
+ SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
4407
4759
 
4408
4760
  /*
4409
4761
  ** CAPI3REF: Overload A Function For A Virtual Table
4410
- ** EXPERIMENTAL
4411
4762
  **
4412
4763
  ** ^(Virtual tables can provide alternative implementations of functions
4413
4764
  ** using the [xFindFunction] method of the [virtual table module].
@@ -4422,7 +4773,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_declare_vtab(sqlite3*, const char *zS
4422
4773
  ** purpose is to be a placeholder function that can be overloaded
4423
4774
  ** by a [virtual table].
4424
4775
  */
4425
- SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
4776
+ SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
4426
4777
 
4427
4778
  /*
4428
4779
  ** The interface to the virtual-table mechanism defined above (back up
@@ -4432,8 +4783,6 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_overload_function(sqlite3*, const cha
4432
4783
  **
4433
4784
  ** When the virtual-table mechanism stabilizes, we will declare the
4434
4785
  ** interface fixed, support it indefinitely, and remove this comment.
4435
- **
4436
- ****** EXPERIMENTAL - subject to change without notice **************
4437
4786
  */
4438
4787
 
4439
4788
  /*
@@ -4516,6 +4865,30 @@ SQLITE_API int sqlite3_blob_open(
4516
4865
  sqlite3_blob **ppBlob
4517
4866
  );
4518
4867
 
4868
+ /*
4869
+ ** CAPI3REF: Move a BLOB Handle to a New Row
4870
+ **
4871
+ ** ^This function is used to move an existing blob handle so that it points
4872
+ ** to a different row of the same database table. ^The new row is identified
4873
+ ** by the rowid value passed as the second argument. Only the row can be
4874
+ ** changed. ^The database, table and column on which the blob handle is open
4875
+ ** remain the same. Moving an existing blob handle to a new row can be
4876
+ ** faster than closing the existing handle and opening a new one.
4877
+ **
4878
+ ** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] -
4879
+ ** it must exist and there must be either a blob or text value stored in
4880
+ ** the nominated column.)^ ^If the new row is not present in the table, or if
4881
+ ** it does not contain a blob or text value, or if another error occurs, an
4882
+ ** SQLite error code is returned and the blob handle is considered aborted.
4883
+ ** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or
4884
+ ** [sqlite3_blob_reopen()] on an aborted blob handle immediately return
4885
+ ** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle
4886
+ ** always returns zero.
4887
+ **
4888
+ ** ^This function sets the database handle error code and message.
4889
+ */
4890
+ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
4891
+
4519
4892
  /*
4520
4893
  ** CAPI3REF: Close A BLOB Handle
4521
4894
  **
@@ -4776,7 +5149,6 @@ SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
4776
5149
 
4777
5150
  /*
4778
5151
  ** CAPI3REF: Mutex Methods Object
4779
- ** EXPERIMENTAL
4780
5152
  **
4781
5153
  ** An instance of this structure defines the low-level routines
4782
5154
  ** used to allocate and use mutexes.
@@ -4793,7 +5165,7 @@ SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
4793
5165
  **
4794
5166
  ** ^The xMutexInit method defined by this structure is invoked as
4795
5167
  ** part of system initialization by the sqlite3_initialize() function.
4796
- ** ^The xMutexInit routine is calle by SQLite exactly once for each
5168
+ ** ^The xMutexInit routine is called by SQLite exactly once for each
4797
5169
  ** effective call to [sqlite3_initialize()].
4798
5170
  **
4799
5171
  ** ^The xMutexEnd method defined by this structure is invoked as
@@ -4826,7 +5198,7 @@ SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
4826
5198
  ** it is passed a NULL pointer).
4827
5199
  **
4828
5200
  ** The xMutexInit() method must be threadsafe. ^It must be harmless to
4829
- ** invoke xMutexInit() mutiple times within the same process and without
5201
+ ** invoke xMutexInit() multiple times within the same process and without
4830
5202
  ** intervening calls to xMutexEnd(). Second and subsequent calls to
4831
5203
  ** xMutexInit() must be no-ops.
4832
5204
  **
@@ -4905,7 +5277,8 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
4905
5277
  #define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */
4906
5278
  #define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */
4907
5279
  #define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
4908
- #define SQLITE_MUTEX_STATIC_LRU2 7 /* lru page list */
5280
+ #define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */
5281
+ #define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */
4909
5282
 
4910
5283
  /*
4911
5284
  ** CAPI3REF: Retrieve the mutex for a database connection
@@ -4924,7 +5297,7 @@ SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
4924
5297
  ** ^The [sqlite3_file_control()] interface makes a direct call to the
4925
5298
  ** xFileControl method for the [sqlite3_io_methods] object associated
4926
5299
  ** with a particular database identified by the second argument. ^The
4927
- ** name of the database "main" for the main database or "temp" for the
5300
+ ** name of the database is "main" for the main database or "temp" for the
4928
5301
  ** TEMP database, or the name that appears after the AS keyword for
4929
5302
  ** databases that are added using the [ATTACH] SQL command.
4930
5303
  ** ^A NULL pointer can be used in place of "main" to refer to the
@@ -4934,6 +5307,12 @@ SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
4934
5307
  ** the xFileControl method. ^The return value of the xFileControl
4935
5308
  ** method becomes the return value of this routine.
4936
5309
  **
5310
+ ** ^The SQLITE_FCNTL_FILE_POINTER value for the op parameter causes
5311
+ ** a pointer to the underlying [sqlite3_file] object to be written into
5312
+ ** the space pointed to by the 4th parameter. ^The SQLITE_FCNTL_FILE_POINTER
5313
+ ** case is a short-circuit path which does not actually invoke the
5314
+ ** underlying sqlite3_io_methods.xFileControl method.
5315
+ **
4937
5316
  ** ^If the second parameter (zDbName) does not match the name of any
4938
5317
  ** open database file, then SQLITE_ERROR is returned. ^This error
4939
5318
  ** code is not remembered and will not be recalled by [sqlite3_errcode()]
@@ -4989,14 +5368,15 @@ SQLITE_API int sqlite3_test_control(int op, ...);
4989
5368
  #define SQLITE_TESTCTRL_RESERVE 14
4990
5369
  #define SQLITE_TESTCTRL_OPTIMIZATIONS 15
4991
5370
  #define SQLITE_TESTCTRL_ISKEYWORD 16
4992
- #define SQLITE_TESTCTRL_LAST 16
5371
+ #define SQLITE_TESTCTRL_PGHDRSZ 17
5372
+ #define SQLITE_TESTCTRL_SCRATCHMALLOC 18
5373
+ #define SQLITE_TESTCTRL_LAST 18
4993
5374
 
4994
5375
  /*
4995
5376
  ** CAPI3REF: SQLite Runtime Status
4996
- ** EXPERIMENTAL
4997
5377
  **
4998
5378
  ** ^This interface is used to retrieve runtime status information
4999
- ** about the preformance of SQLite, and optionally to reset various
5379
+ ** about the performance of SQLite, and optionally to reset various
5000
5380
  ** highwater marks. ^The first argument is an integer code for
5001
5381
  ** the specific parameter to measure. ^(Recognized integer codes
5002
5382
  ** are of the form [SQLITE_STATUS_MEMORY_USED | SQLITE_STATUS_...].)^
@@ -5009,7 +5389,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
5009
5389
  ** ^(Other parameters record only the highwater mark and not the current
5010
5390
  ** value. For these latter parameters nothing is written into *pCurrent.)^
5011
5391
  **
5012
- ** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
5392
+ ** ^The sqlite3_status() routine returns SQLITE_OK on success and a
5013
5393
  ** non-zero [error code] on failure.
5014
5394
  **
5015
5395
  ** This routine is threadsafe but is not atomic. This routine can be
@@ -5021,12 +5401,11 @@ SQLITE_API int sqlite3_test_control(int op, ...);
5021
5401
  **
5022
5402
  ** See also: [sqlite3_db_status()]
5023
5403
  */
5024
- SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
5404
+ SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
5025
5405
 
5026
5406
 
5027
5407
  /*
5028
5408
  ** CAPI3REF: Status Parameters
5029
- ** EXPERIMENTAL
5030
5409
  **
5031
5410
  ** These integer constants designate various run-time status parameters
5032
5411
  ** that can be returned by [sqlite3_status()].
@@ -5049,6 +5428,10 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_status(int op, int *pCurrent, int *pH
5049
5428
  ** *pHighwater parameter to [sqlite3_status()] is of interest.
5050
5429
  ** The value written into the *pCurrent parameter is undefined.</dd>)^
5051
5430
  **
5431
+ ** ^(<dt>SQLITE_STATUS_MALLOC_COUNT</dt>
5432
+ ** <dd>This parameter records the number of separate memory allocations
5433
+ ** currently checked out.</dd>)^
5434
+ **
5052
5435
  ** ^(<dt>SQLITE_STATUS_PAGECACHE_USED</dt>
5053
5436
  ** <dd>This parameter returns the number of pages used out of the
5054
5437
  ** [pagecache memory allocator] that was configured using
@@ -5057,7 +5440,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_status(int op, int *pCurrent, int *pH
5057
5440
  **
5058
5441
  ** ^(<dt>SQLITE_STATUS_PAGECACHE_OVERFLOW</dt>
5059
5442
  ** <dd>This parameter returns the number of bytes of page cache
5060
- ** allocation which could not be statisfied by the [SQLITE_CONFIG_PAGECACHE]
5443
+ ** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]
5061
5444
  ** buffer and where forced to overflow to [sqlite3_malloc()]. The
5062
5445
  ** returned value includes allocations that overflowed because they
5063
5446
  ** where too large (they were larger than the "sz" parameter to
@@ -5080,7 +5463,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_status(int op, int *pCurrent, int *pH
5080
5463
  **
5081
5464
  ** ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>
5082
5465
  ** <dd>This parameter returns the number of bytes of scratch memory
5083
- ** allocation which could not be statisfied by the [SQLITE_CONFIG_SCRATCH]
5466
+ ** allocation which could not be satisfied by the [SQLITE_CONFIG_SCRATCH]
5084
5467
  ** buffer and where forced to overflow to [sqlite3_malloc()]. The values
5085
5468
  ** returned include overflows because the requested allocation was too
5086
5469
  ** larger (that is, because the requested allocation was larger than the
@@ -5110,30 +5493,34 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_status(int op, int *pCurrent, int *pH
5110
5493
  #define SQLITE_STATUS_PARSER_STACK 6
5111
5494
  #define SQLITE_STATUS_PAGECACHE_SIZE 7
5112
5495
  #define SQLITE_STATUS_SCRATCH_SIZE 8
5496
+ #define SQLITE_STATUS_MALLOC_COUNT 9
5113
5497
 
5114
5498
  /*
5115
5499
  ** CAPI3REF: Database Connection Status
5116
- ** EXPERIMENTAL
5117
5500
  **
5118
5501
  ** ^This interface is used to retrieve runtime status information
5119
5502
  ** about a single [database connection]. ^The first argument is the
5120
5503
  ** database connection object to be interrogated. ^The second argument
5121
- ** is the parameter to interrogate. ^Currently, the only allowed value
5122
- ** for the second parameter is [SQLITE_DBSTATUS_LOOKASIDE_USED].
5123
- ** Additional options will likely appear in future releases of SQLite.
5504
+ ** is an integer constant, taken from the set of
5505
+ ** [SQLITE_DBSTATUS_LOOKASIDE_USED | SQLITE_DBSTATUS_*] macros, that
5506
+ ** determines the parameter to interrogate. The set of
5507
+ ** [SQLITE_DBSTATUS_LOOKASIDE_USED | SQLITE_DBSTATUS_*] macros is likely
5508
+ ** to grow in future releases of SQLite.
5124
5509
  **
5125
5510
  ** ^The current value of the requested parameter is written into *pCur
5126
5511
  ** and the highest instantaneous value is written into *pHiwtr. ^If
5127
5512
  ** the resetFlg is true, then the highest instantaneous value is
5128
5513
  ** reset back down to the current value.
5129
5514
  **
5515
+ ** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
5516
+ ** non-zero [error code] on failure.
5517
+ **
5130
5518
  ** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
5131
5519
  */
5132
- SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
5520
+ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
5133
5521
 
5134
5522
  /*
5135
5523
  ** CAPI3REF: Status Parameters for database connections
5136
- ** EXPERIMENTAL
5137
5524
  **
5138
5525
  ** These constants are the available integer "verbs" that can be passed as
5139
5526
  ** the second argument to the [sqlite3_db_status()] interface.
@@ -5148,14 +5535,63 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_db_status(sqlite3*, int op, int *pCur
5148
5535
  ** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_USED</dt>
5149
5536
  ** <dd>This parameter returns the number of lookaside memory slots currently
5150
5537
  ** checked out.</dd>)^
5538
+ **
5539
+ ** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>
5540
+ ** <dd>This parameter returns the number malloc attempts that were
5541
+ ** satisfied using lookaside memory. Only the high-water value is meaningful;
5542
+ ** the current value is always zero.
5543
+ ** checked out.</dd>)^
5544
+ **
5545
+ ** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>
5546
+ ** <dd>This parameter returns the number malloc attempts that might have
5547
+ ** been satisfied using lookaside memory but failed due to the amount of
5548
+ ** memory requested being larger than the lookaside slot size.
5549
+ ** Only the high-water value is meaningful;
5550
+ ** the current value is always zero.
5551
+ ** checked out.</dd>)^
5552
+ **
5553
+ ** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL</dt>
5554
+ ** <dd>This parameter returns the number malloc attempts that might have
5555
+ ** been satisfied using lookaside memory but failed due to all lookaside
5556
+ ** memory already being in use.
5557
+ ** Only the high-water value is meaningful;
5558
+ ** the current value is always zero.
5559
+ ** checked out.</dd>)^
5560
+ **
5561
+ ** ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>
5562
+ ** <dd>This parameter returns the approximate number of of bytes of heap
5563
+ ** memory used by all pager caches associated with the database connection.)^
5564
+ ** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
5565
+ **
5566
+ ** ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
5567
+ ** <dd>This parameter returns the approximate number of of bytes of heap
5568
+ ** memory used to store the schema for all databases associated
5569
+ ** with the connection - main, temp, and any [ATTACH]-ed databases.)^
5570
+ ** ^The full amount of memory used by the schemas is reported, even if the
5571
+ ** schema memory is shared with other database connections due to
5572
+ ** [shared cache mode] being enabled.
5573
+ ** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.
5574
+ **
5575
+ ** ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>
5576
+ ** <dd>This parameter returns the approximate number of of bytes of heap
5577
+ ** and lookaside memory used by all prepared statements associated with
5578
+ ** the database connection.)^
5579
+ ** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0.
5580
+ ** </dd>
5151
5581
  ** </dl>
5152
5582
  */
5153
- #define SQLITE_DBSTATUS_LOOKASIDE_USED 0
5583
+ #define SQLITE_DBSTATUS_LOOKASIDE_USED 0
5584
+ #define SQLITE_DBSTATUS_CACHE_USED 1
5585
+ #define SQLITE_DBSTATUS_SCHEMA_USED 2
5586
+ #define SQLITE_DBSTATUS_STMT_USED 3
5587
+ #define SQLITE_DBSTATUS_LOOKASIDE_HIT 4
5588
+ #define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5
5589
+ #define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6
5590
+ #define SQLITE_DBSTATUS_MAX 6 /* Largest defined DBSTATUS */
5154
5591
 
5155
5592
 
5156
5593
  /*
5157
5594
  ** CAPI3REF: Prepared Statement Status
5158
- ** EXPERIMENTAL
5159
5595
  **
5160
5596
  ** ^(Each prepared statement maintains various
5161
5597
  ** [SQLITE_STMTSTATUS_SORT | counters] that measure the number
@@ -5177,11 +5613,10 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_db_status(sqlite3*, int op, int *pCur
5177
5613
  **
5178
5614
  ** See also: [sqlite3_status()] and [sqlite3_db_status()].
5179
5615
  */
5180
- SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
5616
+ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
5181
5617
 
5182
5618
  /*
5183
5619
  ** CAPI3REF: Status Parameters for prepared statements
5184
- ** EXPERIMENTAL
5185
5620
  **
5186
5621
  ** These preprocessor macros define integer codes that name counter
5187
5622
  ** values associated with the [sqlite3_stmt_status()] interface.
@@ -5199,14 +5634,21 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_stmt_status(sqlite3_stmt*, int op,int
5199
5634
  ** A non-zero value in this counter may indicate an opportunity to
5200
5635
  ** improvement performance through careful use of indices.</dd>
5201
5636
  **
5637
+ ** <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
5638
+ ** <dd>^This is the number of rows inserted into transient indices that
5639
+ ** were created automatically in order to help joins run faster.
5640
+ ** A non-zero value in this counter may indicate an opportunity to
5641
+ ** improvement performance by adding permanent indices that do not
5642
+ ** need to be reinitialized each time the statement is run.</dd>
5643
+ **
5202
5644
  ** </dl>
5203
5645
  */
5204
5646
  #define SQLITE_STMTSTATUS_FULLSCAN_STEP 1
5205
5647
  #define SQLITE_STMTSTATUS_SORT 2
5648
+ #define SQLITE_STMTSTATUS_AUTOINDEX 3
5206
5649
 
5207
5650
  /*
5208
5651
  ** CAPI3REF: Custom Page Cache Object
5209
- ** EXPERIMENTAL
5210
5652
  **
5211
5653
  ** The sqlite3_pcache type is opaque. It is implemented by
5212
5654
  ** the pluggable module. The SQLite core has no knowledge of
@@ -5221,36 +5663,45 @@ typedef struct sqlite3_pcache sqlite3_pcache;
5221
5663
  /*
5222
5664
  ** CAPI3REF: Application Defined Page Cache.
5223
5665
  ** KEYWORDS: {page cache}
5224
- ** EXPERIMENTAL
5225
5666
  **
5226
5667
  ** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE], ...) interface can
5227
5668
  ** register an alternative page cache implementation by passing in an
5228
- ** instance of the sqlite3_pcache_methods structure.)^ The majority of the
5229
- ** heap memory used by SQLite is used by the page cache to cache data read
5230
- ** from, or ready to be written to, the database file. By implementing a
5231
- ** custom page cache using this API, an application can control more
5232
- ** precisely the amount of memory consumed by SQLite, the way in which
5669
+ ** instance of the sqlite3_pcache_methods structure.)^
5670
+ ** In many applications, most of the heap memory allocated by
5671
+ ** SQLite is used for the page cache.
5672
+ ** By implementing a
5673
+ ** custom page cache using this API, an application can better control
5674
+ ** the amount of memory consumed by SQLite, the way in which
5233
5675
  ** that memory is allocated and released, and the policies used to
5234
5676
  ** determine exactly which parts of a database file are cached and for
5235
5677
  ** how long.
5236
5678
  **
5679
+ ** The alternative page cache mechanism is an
5680
+ ** extreme measure that is only needed by the most demanding applications.
5681
+ ** The built-in page cache is recommended for most uses.
5682
+ **
5237
5683
  ** ^(The contents of the sqlite3_pcache_methods structure are copied to an
5238
5684
  ** internal buffer by SQLite within the call to [sqlite3_config]. Hence
5239
5685
  ** the application may discard the parameter after the call to
5240
5686
  ** [sqlite3_config()] returns.)^
5241
5687
  **
5242
- ** ^The xInit() method is called once for each call to [sqlite3_initialize()]
5688
+ ** ^(The xInit() method is called once for each effective
5689
+ ** call to [sqlite3_initialize()])^
5243
5690
  ** (usually only once during the lifetime of the process). ^(The xInit()
5244
5691
  ** method is passed a copy of the sqlite3_pcache_methods.pArg value.)^
5245
- ** ^The xInit() method can set up up global structures and/or any mutexes
5692
+ ** The intent of the xInit() method is to set up global data structures
5246
5693
  ** required by the custom page cache implementation.
5694
+ ** ^(If the xInit() method is NULL, then the
5695
+ ** built-in default page cache is used instead of the application defined
5696
+ ** page cache.)^
5247
5697
  **
5248
- ** ^The xShutdown() method is called from within [sqlite3_shutdown()],
5249
- ** if the application invokes this API. It can be used to clean up
5698
+ ** ^The xShutdown() method is called by [sqlite3_shutdown()].
5699
+ ** It can be used to clean up
5250
5700
  ** any outstanding resources before process shutdown, if required.
5701
+ ** ^The xShutdown() method may be NULL.
5251
5702
  **
5252
- ** ^SQLite holds a [SQLITE_MUTEX_RECURSIVE] mutex when it invokes
5253
- ** the xInit method, so the xInit method need not be threadsafe. ^The
5703
+ ** ^SQLite automatically serializes calls to the xInit method,
5704
+ ** so the xInit method need not be threadsafe. ^The
5254
5705
  ** xShutdown method is only called from [sqlite3_shutdown()] so it does
5255
5706
  ** not need to be threadsafe either. All other methods must be threadsafe
5256
5707
  ** in multithreaded applications.
@@ -5258,47 +5709,52 @@ typedef struct sqlite3_pcache sqlite3_pcache;
5258
5709
  ** ^SQLite will never invoke xInit() more than once without an intervening
5259
5710
  ** call to xShutdown().
5260
5711
  **
5261
- ** ^The xCreate() method is used to construct a new cache instance. SQLite
5262
- ** will typically create one cache instance for each open database file,
5712
+ ** ^SQLite invokes the xCreate() method to construct a new cache instance.
5713
+ ** SQLite will typically create one cache instance for each open database file,
5263
5714
  ** though this is not guaranteed. ^The
5264
5715
  ** first parameter, szPage, is the size in bytes of the pages that must
5265
5716
  ** be allocated by the cache. ^szPage will not be a power of two. ^szPage
5266
5717
  ** will the page size of the database file that is to be cached plus an
5267
- ** increment (here called "R") of about 100 or 200. ^SQLite will use the
5718
+ ** increment (here called "R") of less than 250. SQLite will use the
5268
5719
  ** extra R bytes on each page to store metadata about the underlying
5269
5720
  ** database page on disk. The value of R depends
5270
5721
  ** on the SQLite version, the target platform, and how SQLite was compiled.
5271
- ** ^R is constant for a particular build of SQLite. ^The second argument to
5722
+ ** ^(R is constant for a particular build of SQLite. Except, there are two
5723
+ ** distinct values of R when SQLite is compiled with the proprietary
5724
+ ** ZIPVFS extension.)^ ^The second argument to
5272
5725
  ** xCreate(), bPurgeable, is true if the cache being created will
5273
5726
  ** be used to cache database pages of a file stored on disk, or
5274
- ** false if it is used for an in-memory database. ^The cache implementation
5727
+ ** false if it is used for an in-memory database. The cache implementation
5275
5728
  ** does not have to do anything special based with the value of bPurgeable;
5276
5729
  ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
5277
5730
  ** never invoke xUnpin() except to deliberately delete a page.
5278
- ** ^In other words, a cache created with bPurgeable set to false will
5731
+ ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
5732
+ ** false will always have the "discard" flag set to true.
5733
+ ** ^Hence, a cache created with bPurgeable false will
5279
5734
  ** never contain any unpinned pages.
5280
5735
  **
5281
5736
  ** ^(The xCachesize() method may be called at any time by SQLite to set the
5282
5737
  ** suggested maximum cache-size (number of pages stored by) the cache
5283
5738
  ** instance passed as the first argument. This is the value configured using
5284
- ** the SQLite "[PRAGMA cache_size]" command.)^ ^As with the bPurgeable
5739
+ ** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
5285
5740
  ** parameter, the implementation is not required to do anything with this
5286
5741
  ** value; it is advisory only.
5287
5742
  **
5288
- ** ^The xPagecount() method should return the number of pages currently
5289
- ** stored in the cache.
5743
+ ** The xPagecount() method must return the number of pages currently
5744
+ ** stored in the cache, both pinned and unpinned.
5290
5745
  **
5291
- ** ^The xFetch() method is used to fetch a page and return a pointer to it.
5292
- ** ^A 'page', in this context, is a buffer of szPage bytes aligned at an
5293
- ** 8-byte boundary. ^The page to be fetched is determined by the key. ^The
5294
- ** mimimum key value is 1. After it has been retrieved using xFetch, the page
5746
+ ** The xFetch() method locates a page in the cache and returns a pointer to
5747
+ ** the page, or a NULL pointer.
5748
+ ** A "page", in this context, means a buffer of szPage bytes aligned at an
5749
+ ** 8-byte boundary. The page to be fetched is determined by the key. ^The
5750
+ ** mimimum key value is 1. After it has been retrieved using xFetch, the page
5295
5751
  ** is considered to be "pinned".
5296
5752
  **
5297
- ** ^If the requested page is already in the page cache, then the page cache
5753
+ ** If the requested page is already in the page cache, then the page cache
5298
5754
  ** implementation must return a pointer to the page buffer with its content
5299
- ** intact. ^(If the requested page is not already in the cache, then the
5300
- ** behavior of the cache implementation is determined by the value of the
5301
- ** createFlag parameter passed to xFetch, according to the following table:
5755
+ ** intact. If the requested page is not already in the cache, then the
5756
+ ** cache implementation should use the value of the createFlag
5757
+ ** parameter to help it determined what action to take:
5302
5758
  **
5303
5759
  ** <table border=1 width=85% align=center>
5304
5760
  ** <tr><th> createFlag <th> Behaviour when page is not already in cache
@@ -5307,36 +5763,35 @@ typedef struct sqlite3_pcache sqlite3_pcache;
5307
5763
  ** Otherwise return NULL.
5308
5764
  ** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
5309
5765
  ** NULL if allocating a new page is effectively impossible.
5310
- ** </table>)^
5766
+ ** </table>
5311
5767
  **
5312
- ** SQLite will normally invoke xFetch() with a createFlag of 0 or 1. If
5313
- ** a call to xFetch() with createFlag==1 returns NULL, then SQLite will
5768
+ ** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1. SQLite
5769
+ ** will only use a createFlag of 2 after a prior call with a createFlag of 1
5770
+ ** failed.)^ In between the to xFetch() calls, SQLite may
5314
5771
  ** attempt to unpin one or more cache pages by spilling the content of
5315
- ** pinned pages to disk and synching the operating system disk cache. After
5316
- ** attempting to unpin pages, the xFetch() method will be invoked again with
5317
- ** a createFlag of 2.
5772
+ ** pinned pages to disk and synching the operating system disk cache.
5318
5773
  **
5319
5774
  ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
5320
- ** as its second argument. ^(If the third parameter, discard, is non-zero,
5321
- ** then the page should be evicted from the cache. In this case SQLite
5322
- ** assumes that the next time the page is retrieved from the cache using
5323
- ** the xFetch() method, it will be zeroed.)^ ^If the discard parameter is
5324
- ** zero, then the page is considered to be unpinned. ^The cache implementation
5775
+ ** as its second argument. If the third parameter, discard, is non-zero,
5776
+ ** then the page must be evicted from the cache.
5777
+ ** ^If the discard parameter is
5778
+ ** zero, then the page may be discarded or retained at the discretion of
5779
+ ** page cache implementation. ^The page cache implementation
5325
5780
  ** may choose to evict unpinned pages at any time.
5326
5781
  **
5327
- ** ^(The cache is not required to perform any reference counting. A single
5782
+ ** The cache must not perform any reference counting. A single
5328
5783
  ** call to xUnpin() unpins the page regardless of the number of prior calls
5329
- ** to xFetch().)^
5784
+ ** to xFetch().
5330
5785
  **
5331
- ** ^The xRekey() method is used to change the key value associated with the
5332
- ** page passed as the second argument from oldKey to newKey. ^If the cache
5333
- ** previously contains an entry associated with newKey, it should be
5786
+ ** The xRekey() method is used to change the key value associated with the
5787
+ ** page passed as the second argument. If the cache
5788
+ ** previously contains an entry associated with newKey, it must be
5334
5789
  ** discarded. ^Any prior cache entry associated with newKey is guaranteed not
5335
5790
  ** to be pinned.
5336
5791
  **
5337
- ** ^When SQLite calls the xTruncate() method, the cache must discard all
5792
+ ** When SQLite calls the xTruncate() method, the cache must discard all
5338
5793
  ** existing cache entries with page numbers (keys) greater than or equal
5339
- ** to the value of the iLimit parameter passed to xTruncate(). ^If any
5794
+ ** to the value of the iLimit parameter passed to xTruncate(). If any
5340
5795
  ** of these pages are pinned, they are implicitly unpinned, meaning that
5341
5796
  ** they can be safely discarded.
5342
5797
  **
@@ -5363,7 +5818,6 @@ struct sqlite3_pcache_methods {
5363
5818
 
5364
5819
  /*
5365
5820
  ** CAPI3REF: Online Backup Object
5366
- ** EXPERIMENTAL
5367
5821
  **
5368
5822
  ** The sqlite3_backup object records state information about an ongoing
5369
5823
  ** online backup operation. ^The sqlite3_backup object is created by
@@ -5376,7 +5830,6 @@ typedef struct sqlite3_backup sqlite3_backup;
5376
5830
 
5377
5831
  /*
5378
5832
  ** CAPI3REF: Online Backup API.
5379
- ** EXPERIMENTAL
5380
5833
  **
5381
5834
  ** The backup API copies the content of one database into another.
5382
5835
  ** It is useful either for creating backups of databases or
@@ -5384,11 +5837,12 @@ typedef struct sqlite3_backup sqlite3_backup;
5384
5837
  **
5385
5838
  ** See Also: [Using the SQLite Online Backup API]
5386
5839
  **
5387
- ** ^Exclusive access is required to the destination database for the
5388
- ** duration of the operation. ^However the source database is only
5389
- ** read-locked while it is actually being read; it is not locked
5390
- ** continuously for the entire backup operation. ^Thus, the backup may be
5391
- ** performed on a live source database without preventing other users from
5840
+ ** ^SQLite holds a write transaction open on the destination database file
5841
+ ** for the duration of the backup operation.
5842
+ ** ^The source database is read-locked only while it is being read;
5843
+ ** it is not locked continuously for the entire backup operation.
5844
+ ** ^Thus, the backup may be performed on a live source database without
5845
+ ** preventing other database connections from
5392
5846
  ** reading or writing to the source database while the backup is underway.
5393
5847
  **
5394
5848
  ** ^(To perform a backup operation:
@@ -5415,11 +5869,11 @@ typedef struct sqlite3_backup sqlite3_backup;
5415
5869
  ** sqlite3_backup_init(D,N,S,M) identify the [database connection]
5416
5870
  ** and database name of the source database, respectively.
5417
5871
  ** ^The source and destination [database connections] (parameters S and D)
5418
- ** must be different or else sqlite3_backup_init(D,N,S,M) will file with
5872
+ ** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
5419
5873
  ** an error.
5420
5874
  **
5421
5875
  ** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
5422
- ** returned and an error code and error message are store3d in the
5876
+ ** returned and an error code and error message are stored in the
5423
5877
  ** destination [database connection] D.
5424
5878
  ** ^The error code and message for the failed call to sqlite3_backup_init()
5425
5879
  ** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or
@@ -5436,7 +5890,7 @@ typedef struct sqlite3_backup sqlite3_backup;
5436
5890
  ** the source and destination databases specified by [sqlite3_backup] object B.
5437
5891
  ** ^If N is negative, all remaining source pages are copied.
5438
5892
  ** ^If sqlite3_backup_step(B,N) successfully copies N pages and there
5439
- ** are still more pages to be copied, then the function resturns [SQLITE_OK].
5893
+ ** are still more pages to be copied, then the function returns [SQLITE_OK].
5440
5894
  ** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages
5441
5895
  ** from source to destination, then it returns [SQLITE_DONE].
5442
5896
  ** ^If an error occurs while running sqlite3_backup_step(B,N),
@@ -5445,10 +5899,14 @@ typedef struct sqlite3_backup sqlite3_backup;
5445
5899
  ** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an
5446
5900
  ** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code.
5447
5901
  **
5448
- ** ^The sqlite3_backup_step() might return [SQLITE_READONLY] if the destination
5449
- ** database was opened read-only or if
5450
- ** the destination is an in-memory database with a different page size
5451
- ** from the source database.
5902
+ ** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if
5903
+ ** <ol>
5904
+ ** <li> the destination database was opened read-only, or
5905
+ ** <li> the destination database is using write-ahead-log journaling
5906
+ ** and the destination and source page sizes differ, or
5907
+ ** <li> the destination database is an in-memory database and the
5908
+ ** destination and source page sizes differ.
5909
+ ** </ol>)^
5452
5910
  **
5453
5911
  ** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then
5454
5912
  ** the [sqlite3_busy_handler | busy-handler function]
@@ -5510,7 +5968,7 @@ typedef struct sqlite3_backup sqlite3_backup;
5510
5968
  **
5511
5969
  ** ^Each call to sqlite3_backup_step() sets two values inside
5512
5970
  ** the [sqlite3_backup] object: the number of pages still to be backed
5513
- ** up and the total number of pages in the source databae file.
5971
+ ** up and the total number of pages in the source database file.
5514
5972
  ** The sqlite3_backup_remaining() and sqlite3_backup_pagecount() interfaces
5515
5973
  ** retrieve these two values, respectively.
5516
5974
  **
@@ -5564,7 +6022,6 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
5564
6022
 
5565
6023
  /*
5566
6024
  ** CAPI3REF: Unlock Notification
5567
- ** EXPERIMENTAL
5568
6025
  **
5569
6026
  ** ^When running in shared-cache mode, a database operation may fail with
5570
6027
  ** an [SQLITE_LOCKED] error if the required locks on the shared-cache or
@@ -5607,7 +6064,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
5607
6064
  ** blocked connection already has a registered unlock-notify callback,
5608
6065
  ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
5609
6066
  ** called with a NULL pointer as its second argument, then any existing
5610
- ** unlock-notify callback is cancelled. ^The blocked connections
6067
+ ** unlock-notify callback is canceled. ^The blocked connections
5611
6068
  ** unlock-notify callback may also be canceled by closing the blocked
5612
6069
  ** connection using [sqlite3_close()].
5613
6070
  **
@@ -5686,23 +6143,21 @@ SQLITE_API int sqlite3_unlock_notify(
5686
6143
 
5687
6144
  /*
5688
6145
  ** CAPI3REF: String Comparison
5689
- ** EXPERIMENTAL
5690
6146
  **
5691
6147
  ** ^The [sqlite3_strnicmp()] API allows applications and extensions to
5692
6148
  ** compare the contents of two buffers containing UTF-8 strings in a
5693
- ** case-indendent fashion, using the same definition of case independence
6149
+ ** case-independent fashion, using the same definition of case independence
5694
6150
  ** that SQLite uses internally when comparing identifiers.
5695
6151
  */
5696
6152
  SQLITE_API int sqlite3_strnicmp(const char *, const char *, int);
5697
6153
 
5698
6154
  /*
5699
6155
  ** CAPI3REF: Error Logging Interface
5700
- ** EXPERIMENTAL
5701
6156
  **
5702
6157
  ** ^The [sqlite3_log()] interface writes a message into the error log
5703
6158
  ** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].
5704
6159
  ** ^If logging is enabled, the zFormat string and subsequent arguments are
5705
- ** passed through to [sqlite3_vmprintf()] to generate the final output string.
6160
+ ** used with [sqlite3_snprintf()] to generate the final output string.
5706
6161
  **
5707
6162
  ** The sqlite3_log() interface is intended for use by extensions such as
5708
6163
  ** virtual tables, collating functions, and SQL functions. While there is
@@ -5719,6 +6174,90 @@ SQLITE_API int sqlite3_strnicmp(const char *, const char *, int);
5719
6174
  */
5720
6175
  SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
5721
6176
 
6177
+ /*
6178
+ ** CAPI3REF: Write-Ahead Log Commit Hook
6179
+ **
6180
+ ** ^The [sqlite3_wal_hook()] function is used to register a callback that
6181
+ ** will be invoked each time a database connection commits data to a
6182
+ ** [write-ahead log] (i.e. whenever a transaction is committed in
6183
+ ** [journal_mode | journal_mode=WAL mode]).
6184
+ **
6185
+ ** ^The callback is invoked by SQLite after the commit has taken place and
6186
+ ** the associated write-lock on the database released, so the implementation
6187
+ ** may read, write or [checkpoint] the database as required.
6188
+ **
6189
+ ** ^The first parameter passed to the callback function when it is invoked
6190
+ ** is a copy of the third parameter passed to sqlite3_wal_hook() when
6191
+ ** registering the callback. ^The second is a copy of the database handle.
6192
+ ** ^The third parameter is the name of the database that was written to -
6193
+ ** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter
6194
+ ** is the number of pages currently in the write-ahead log file,
6195
+ ** including those that were just committed.
6196
+ **
6197
+ ** The callback function should normally return [SQLITE_OK]. ^If an error
6198
+ ** code is returned, that error will propagate back up through the
6199
+ ** SQLite code base to cause the statement that provoked the callback
6200
+ ** to report an error, though the commit will have still occurred. If the
6201
+ ** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value
6202
+ ** that does not correspond to any valid SQLite error code, the results
6203
+ ** are undefined.
6204
+ **
6205
+ ** A single database handle may have at most a single write-ahead log callback
6206
+ ** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any
6207
+ ** previously registered write-ahead log callback. ^Note that the
6208
+ ** [sqlite3_wal_autocheckpoint()] interface and the
6209
+ ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
6210
+ ** those overwrite any prior [sqlite3_wal_hook()] settings.
6211
+ */
6212
+ SQLITE_API void *sqlite3_wal_hook(
6213
+ sqlite3*,
6214
+ int(*)(void *,sqlite3*,const char*,int),
6215
+ void*
6216
+ );
6217
+
6218
+ /*
6219
+ ** CAPI3REF: Configure an auto-checkpoint
6220
+ **
6221
+ ** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around
6222
+ ** [sqlite3_wal_hook()] that causes any database on [database connection] D
6223
+ ** to automatically [checkpoint]
6224
+ ** after committing a transaction if there are N or
6225
+ ** more frames in the [write-ahead log] file. ^Passing zero or
6226
+ ** a negative value as the nFrame parameter disables automatic
6227
+ ** checkpoints entirely.
6228
+ **
6229
+ ** ^The callback registered by this function replaces any existing callback
6230
+ ** registered using [sqlite3_wal_hook()]. ^Likewise, registering a callback
6231
+ ** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism
6232
+ ** configured by this function.
6233
+ **
6234
+ ** ^The [wal_autocheckpoint pragma] can be used to invoke this interface
6235
+ ** from SQL.
6236
+ **
6237
+ ** ^Every new [database connection] defaults to having the auto-checkpoint
6238
+ ** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
6239
+ ** pages. The use of this interface
6240
+ ** is only necessary if the default setting is found to be suboptimal
6241
+ ** for a particular application.
6242
+ */
6243
+ SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
6244
+
6245
+ /*
6246
+ ** CAPI3REF: Checkpoint a database
6247
+ **
6248
+ ** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X
6249
+ ** on [database connection] D to be [checkpointed]. ^If X is NULL or an
6250
+ ** empty string, then a checkpoint is run on all databases of
6251
+ ** connection D. ^If the database connection D is not in
6252
+ ** [WAL | write-ahead log mode] then this interface is a harmless no-op.
6253
+ **
6254
+ ** ^The [wal_checkpoint pragma] can be used to invoke this interface
6255
+ ** from SQL. ^The [sqlite3_wal_autocheckpoint()] interface and the
6256
+ ** [wal_autocheckpoint pragma] can be used to cause this interface to be
6257
+ ** run whenever the WAL reaches a certain size threshold.
6258
+ */
6259
+ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
6260
+
5722
6261
  /*
5723
6262
  ** Undo the hack that converts floating point types to integer for
5724
6263
  ** builds on processors without floating point support.
@@ -5732,3 +6271,59 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
5732
6271
  #endif
5733
6272
  #endif
5734
6273
 
6274
+ /*
6275
+ ** 2010 August 30
6276
+ **
6277
+ ** The author disclaims copyright to this source code. In place of
6278
+ ** a legal notice, here is a blessing:
6279
+ **
6280
+ ** May you do good and not evil.
6281
+ ** May you find forgiveness for yourself and forgive others.
6282
+ ** May you share freely, never taking more than you give.
6283
+ **
6284
+ *************************************************************************
6285
+ */
6286
+
6287
+ #ifndef _SQLITE3RTREE_H_
6288
+ #define _SQLITE3RTREE_H_
6289
+
6290
+
6291
+ #ifdef __cplusplus
6292
+ extern "C" {
6293
+ #endif
6294
+
6295
+ typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry;
6296
+
6297
+ /*
6298
+ ** Register a geometry callback named zGeom that can be used as part of an
6299
+ ** R-Tree geometry query as follows:
6300
+ **
6301
+ ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
6302
+ */
6303
+ SQLITE_API int sqlite3_rtree_geometry_callback(
6304
+ sqlite3 *db,
6305
+ const char *zGeom,
6306
+ int (*xGeom)(sqlite3_rtree_geometry *, int nCoord, double *aCoord, int *pRes),
6307
+ void *pContext
6308
+ );
6309
+
6310
+
6311
+ /*
6312
+ ** A pointer to a structure of the following type is passed as the first
6313
+ ** argument to callbacks registered using rtree_geometry_callback().
6314
+ */
6315
+ struct sqlite3_rtree_geometry {
6316
+ void *pContext; /* Copy of pContext passed to s_r_g_c() */
6317
+ int nParam; /* Size of array aParam[] */
6318
+ double *aParam; /* Parameters passed to SQL geom function */
6319
+ void *pUser; /* Callback implementation user data */
6320
+ void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */
6321
+ };
6322
+
6323
+
6324
+ #ifdef __cplusplus
6325
+ } /* end of the 'extern "C"' block */
6326
+ #endif
6327
+
6328
+ #endif /* ifndef _SQLITE3RTREE_H_ */
6329
+