/core/externals/update-engine/externals/google-toolbox-for-mac/Foundation/GTMSQLite.h

http://macfuse.googlecode.com/ · C++ Header · 713 lines · 93 code · 71 blank · 549 comment · 0 complexity · 75ff73b1368ae1359a679c6a9cd1bf81 MD5 · raw file

  1. //
  2. // GTMSQLite.h
  3. //
  4. // Copyright 2006-2008 Google Inc.
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License"); you may not
  7. // use this file except in compliance with the License. You may obtain a copy
  8. // of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  14. // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  15. // License for the specific language governing permissions and limitations under
  16. // the License.
  17. //
  18. //
  19. // This class is a convenience wrapper for SQLite storage with
  20. // release/retain semantics. In its most basic form, that is all this
  21. // class offers. You have the option of activating "CFAdditions" on
  22. // init which patches or overrides the following SQLite functionality:
  23. //
  24. // - Strings you pass through the API layer will always be converted
  25. // to precomposed UTF-8 with compatibility mapping
  26. // (kCFStringNormalizationFormKC). This is done in an attempt to
  27. // make SQLite correctly handle string equality for composed
  28. // character sequences. This change applies only to
  29. // NSStrings/CFStrings passed through the GTMSQLiteDatabase or
  30. // GTMSQLiteStatement. Direct access to the database using the
  31. // underlying sqlite3_* handles is not affected.
  32. //
  33. // - The SQL UPPER/LOWER functions are replaced with CFString-based
  34. // implementations which (unlike SQLite's native implementation)
  35. // handle case conversion outside the ASCII range. These
  36. // implementations seem to be 20-30% slower than the SQLite
  37. // implementations but may be worth it for accuracy.
  38. //
  39. // - The SQLite "NOCASE" collation is replaced with a CFString-based
  40. // collation that is case insensitive but still uses literal
  41. // comparison (composition-sensitive).
  42. //
  43. // - Additional collation sequences can be created by using these keywords
  44. // separated by underscores. Each option corresponds to a CFStringCompareFlags
  45. // option.
  46. // NOCASE (kCFCompareCaseInsensitive)
  47. // NONLITERAL (kCFCompareNonliteral)
  48. // LOCALIZED (kCFCompareLocalized)
  49. // NUMERIC (kCFCompareNumerically)
  50. // These additional options are available when linking with the 10.5 SDK:
  51. // NODIACRITIC (kCFCompareDiacriticInsensitive)
  52. // WIDTHINSENSITIVE (kCFCompareWidthInsensitive)
  53. //
  54. // Ordering of the above options can be changed by adding "REVERSE".
  55. //
  56. // Thus, for a case-insensitive, width-insensitive, composition-insensitive
  57. // comparison that ignores diacritical marks and sorts in reverse use:
  58. //
  59. // NOCASE_NONLITERAL_NODIACRITIC_WIDTHINSENSITIVE_REVERSE
  60. //
  61. // - SQL LIKE and GLOB commands are implemented with CFString/CFCharacterSet
  62. // comparisons. As with the other CF additions, this gives us better handling
  63. // of case and composed character sequences. However, whereever reasonable,
  64. // SQLite semantics have been retained. Specific notes:
  65. //
  66. // * LIKE is case insensitive and uses non-literal comparison
  67. // (kCFCompareNonliteral) by default. It is possible to modify this
  68. // behavior using the accessor methods. You must use those methods
  69. // instead of the SQLite "PRAGMA case_sensitive_like" in order for them
  70. // to interact properly with our CFString implementations.
  71. //
  72. // * ESCAPE clauses to LIKE are honored, but the escape character must
  73. // be expressable as a single UniChar (UTF16). The escaped characters in
  74. // LIKE only escape the following UniChar, not a composed character
  75. // sequence. This is not viewed as a limitation since the use of ESCAPE
  76. // is typically only for characters with meaning to SQL LIKE ('%', '_')
  77. // all of which can be expressed as a single UniChar.
  78. //
  79. // * GLOB is by default case sensitive but non-literal. Again, accessor
  80. // methods are available to change this behavior.
  81. //
  82. // * Single character pattern matches ('_' for LIKE, '?' for GLOB) will
  83. // always consume a full composed character sequence.
  84. //
  85. // * As with the standard SQLite implementation, character set comparisons
  86. // are only available for GLOB.
  87. //
  88. // * Character set comparisons are always literal and case sensitive and do
  89. // not take into account composed character sequences. Essentially
  90. // character sets should always be expressed as a set of single UniChars
  91. // or ranges between single UniChars.
  92. //
  93. // SQLite is preinstalled on 10.4 only. As long as we're using the OS version
  94. // of the library, limit ourself to Tiger+
  95. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
  96. #error SQLite support is Tiger or later
  97. #endif
  98. #import <Foundation/Foundation.h>
  99. #import <sqlite3.h>
  100. /// Wrapper for SQLite with release/retain semantics and CFString convenience features
  101. @interface GTMSQLiteDatabase : NSObject {
  102. @protected
  103. sqlite3 *db_; // strong
  104. NSString *path_; // strong
  105. int timeoutMS_;
  106. BOOL hasCFAdditions_;
  107. CFOptionFlags likeOptions_;
  108. CFOptionFlags globOptions_;
  109. NSMutableArray *userArgDataPool_; // strong
  110. }
  111. // Get the numeric version number of the SQLite library (compiled in value
  112. // for SQLITE_VERSION_NUMBER).
  113. //
  114. // Returns:
  115. // Integer version number
  116. //
  117. + (int)sqliteVersionNumber;
  118. // Get the string version number of the SQLite library.
  119. //
  120. // Returns:
  121. // Autoreleased NSString version string
  122. //
  123. + (NSString *)sqliteVersionString;
  124. // Create and open a database instance on a file-based database.
  125. //
  126. // Args:
  127. // path: Path to the database. If it does not exist an empty database
  128. // will be created.
  129. // withCFAdditions: If true, the SQLite database will include CFString
  130. // based string functions and collation sequences. See
  131. // the class header for information on these differences
  132. // and performance impact.
  133. // err: Result code from SQLite. If nil is returned by this function
  134. // check the result code for the error. If NULL no result code is
  135. // reported.
  136. //
  137. - (id)initWithPath:(NSString *)path
  138. withCFAdditions:(BOOL)additions
  139. utf8:(BOOL)useUTF8
  140. errorCode:(int *)err;
  141. // Create and open a memory-based database. Memory-based databases
  142. // cannot be shared amongst threads, and each instance is unique. See
  143. // SQLite documentation for details.
  144. //
  145. // For argument details see [... initWithPath:withCFAdditions:errorCode:]
  146. //
  147. - (id)initInMemoryWithCFAdditions:(BOOL)additions
  148. utf8:(BOOL)useUTF8
  149. errorCode:(int *)err;
  150. // Get the underlying SQLite database handle. In general you should
  151. // never do this, if you do use this be careful with how you compose
  152. // and decompse strings you pass to the database.
  153. //
  154. // Returns:
  155. // sqlite3 pointer
  156. //
  157. - (sqlite3 *)sqlite3DB;
  158. // Enable/Disable the database synchronous mode. Disabling
  159. // synchronous mode results in much faster insert throughput at the
  160. // cost of safety. See the SQlite documentation for details.
  161. //
  162. // Args:
  163. // enable: Boolean flag to determine mode.
  164. //
  165. - (void)synchronousMode:(BOOL)enable;
  166. // Check if this database instance has our CFString functions and collation
  167. // sequences (see top of file for details).
  168. //
  169. // Returns:
  170. // YES if the GTMSQLiteDatabase instance has our CF additions
  171. //
  172. - (BOOL)hasCFAdditions;
  173. // Set comparison options for the "LIKE" operator for databases with
  174. // our CF addtions active.
  175. //
  176. // Args:
  177. // options: CFStringCompareFlags value. Note that a limited list
  178. // of options are supported. For example one cannot
  179. // use kCFCompareBackwards as an option.
  180. //
  181. - (void)setLikeComparisonOptions:(CFOptionFlags)options;
  182. // Get current comparison options for the "LIKE" operator in a database
  183. // with our CF additions active.
  184. //
  185. // Returns:
  186. // Current comparison options or zero if CF additions are inactive.
  187. //
  188. - (CFOptionFlags)likeComparisonOptions;
  189. // Set comparison options for the "GLOB" operator for databases with
  190. // our CF addtions active.
  191. //
  192. // Args:
  193. // options: CFStringCompareFlags value. Note that a limited list
  194. // of options are supported. For example one cannot
  195. // use kCFCompareBackwards as an option.
  196. //
  197. - (void)setGlobComparisonOptions:(CFOptionFlags)options;
  198. // Get current comparison options for the "GLOB" operator in a database
  199. // with our CF additions active.
  200. //
  201. // Returns:
  202. // Current comparison options or zero if CF additions are inactive.
  203. //
  204. - (CFOptionFlags)globComparisonOptions;
  205. // Obtain the last error code from the database
  206. //
  207. // Returns:
  208. // SQLite error code, if no error is pending returns SQLITE_OK
  209. //
  210. - (int)lastErrorCode;
  211. // Obtain an error string for the last error from the database
  212. //
  213. // Returns:
  214. // Autoreleased NSString error message
  215. //
  216. - (NSString *)lastErrorString;
  217. // Obtain a count of rows added, mmodified or deleted by the most recent
  218. // statement. See sqlite3_changes() for details and limitations.
  219. //
  220. // Returns:
  221. // Row count
  222. //
  223. - (int)lastChangeCount;
  224. // Obtain a count of rows added, mmodified or deleted since the database
  225. // was opened. See sqlite3_total_changes() for details and limitations.
  226. //
  227. // Returns:
  228. // Row count
  229. //
  230. - (int)totalChangeCount;
  231. // Obtain the last insert row ID
  232. //
  233. // Returns:
  234. // 64-bit row ID
  235. //
  236. - (unsigned long long)lastInsertRowID;
  237. // Interrupt any currently running database operations as soon as possible.
  238. // Running operations will receive a SQLITE_INTERRUPT and will need to
  239. // handle it correctly (this is the callers problem to deal with).
  240. //
  241. - (void)interrupt;
  242. // Set the timeout value in milliseconds. This is a database global affecting
  243. // all running and future statements.
  244. //
  245. // Args:
  246. // timeoutMS: Integer count in ms SQLite will wait for the database to
  247. // unlock before giving up and returning SQLITE_BUSY. A value
  248. // of 0 or less means the database always returns immediately.
  249. //
  250. // Returns:
  251. // SQLite result code, SQLITE_OK on no error
  252. //
  253. - (int)setBusyTimeoutMS:(int)timeoutMS;
  254. // Get the current busy timeout in milliseconds.
  255. //
  256. // Returns:
  257. // Current database busy timeout value in ms, 0 or less means no timeout.
  258. //
  259. - (int)busyTimeoutMS;
  260. // Execute a string containing one or more SQL statements. No returned data
  261. // is available, use GTMSQLiteStatement for that usage.
  262. //
  263. // Args:
  264. // sql: Raw SQL statement to prepare. It is the caller's responsibility
  265. // to properly escape the SQL.
  266. //
  267. // Returns:
  268. // SQLite result code, SQLITE_OK on no error
  269. //
  270. - (int)executeSQL:(NSString *)sql;
  271. // Convenience method to start a deferred transaction (most common case).
  272. //
  273. // Returns:
  274. // YES if the transaction started successfully
  275. //
  276. - (BOOL)beginDeferredTransaction;
  277. // Convenience method to roll back a transaction.
  278. //
  279. // Returns:
  280. // YES if the transaction rolled back successfully
  281. //
  282. - (BOOL)rollback;
  283. // Convenience method to commit a transaction.
  284. //
  285. // Returns:
  286. // YES if the transaction committed successfully
  287. //
  288. - (BOOL)commit;
  289. @end
  290. // Wrapper class for SQLite statements with retain/release semantics.
  291. // Attempts to behave like an NSEnumerator, however you should bind
  292. // your values before beginning enumeration and unlike NSEnumerator,
  293. // a reset is supported.
  294. //
  295. // The GTMSQLiteDatabase class has options to modify some SQL
  296. // functions and force particular string representations. This class
  297. // honors the database preferences for those options. See the
  298. // GTMSQLiteDatabase header for details.
  299. /// Wrapper class for SQLite statements with retain/release
  300. /// semantics.
  301. @interface GTMSQLiteStatement : NSObject {
  302. @protected
  303. sqlite3_stmt *statement_;
  304. BOOL hasCFAdditions_;
  305. }
  306. #pragma mark Creation, Access and Finalization
  307. // Create an autoreleased prepared statement, see initWithSQL: for arguments.
  308. //
  309. // NOTE: Even though this object is autoreleased you MUST call
  310. // [finalizeStatement] on this when your done. See the init for explanation.
  311. //
  312. // Returns:
  313. // Autoreleased GTMSQLiteStatement
  314. //
  315. + (id)statementWithSQL:(NSString *)sql
  316. inDatabase:(GTMSQLiteDatabase *)gtmdb
  317. errorCode:(int *)err;
  318. // Designated initializer, create a prepared statement. Positional and named
  319. // parameters are supported, see the SQLite documentation.
  320. //
  321. // NOTE: Although this object will clean up its statement when deallocated,
  322. // you are REQUIRED to "finalize" the statement when you are
  323. // through with it. Failing to do this will prevent the database from allowing
  324. // new transactions or queries. In other words, leaving an instance on the
  325. // autorelease pool unfinalized may interfere with other database usage if any
  326. // caller sharing the database uses transactions.
  327. //
  328. // Args:
  329. // sql: Raw SQL statement to prepare. It is the caller's responsibility
  330. // to properly escape the SQL and make sure that the SQL contains
  331. // only _one_ statement. Additional statements are silently ignored.
  332. // db: The GTMSQLiteDatabase (not retained)
  333. // err: Result code from SQLite. If nil is returned by this function
  334. // check the result code for the error. If NULL no result code is
  335. // reported.
  336. //
  337. - (id)initWithSQL:(NSString *)sql
  338. inDatabase:(GTMSQLiteDatabase *)gtmdb
  339. errorCode:(int *)err;
  340. // Get the underlying SQLite statement handle. In general you should never
  341. // do this, if you do use this be careful with how you compose and
  342. // decompse strings you pass to the database.
  343. //
  344. // Returns:
  345. // sqlite3_stmt pointer
  346. //
  347. - (sqlite3_stmt *)sqlite3Statement;
  348. // Finalize the statement, allowing other transactions to start on the database
  349. // This method MUST be called when you are done with a statement. Failure to
  350. // do so means that the database will not be torn down properly when it's
  351. // retain count drops to 0 or GC collects it.
  352. //
  353. // Returns:
  354. // SQLite result code, SQLITE_OK on no error
  355. //
  356. - (int)finalizeStatement;
  357. #pragma mark Parameters and Binding
  358. // Get the number of parameters that can be bound in the prepared statement.
  359. //
  360. // Returns:
  361. // Integer count of parameters or -1 on error
  362. //
  363. - (int)parameterCount;
  364. // Get the position of a parameter with a given name.
  365. //
  366. // Args:
  367. // paramName: String name of the parameter, including any leading punctuation
  368. // (see SQLite docs)
  369. //
  370. // Returns:
  371. // 1-based parameter position index or -1 on error
  372. //
  373. - (int)positionOfParameterNamed:(NSString *)paramName;
  374. // Get the name of a parameter at a particular index.
  375. //
  376. // Args:
  377. // position: Parameter position (1-based index)
  378. //
  379. // Returns:
  380. // Autoreleased string name of the parameter, including any leading
  381. // punctuation (see SQLite docs) or nil on error.
  382. //
  383. - (NSString *)nameOfParameterAtPosition:(int)position;
  384. // Bind a NULL at a given position
  385. //
  386. // Args:
  387. // position: Parameter position (1-based index)
  388. //
  389. // Returns:
  390. // SQLite result code, SQLITE_OK on no error
  391. //
  392. - (int)bindSQLNullAtPosition:(int)position;
  393. // Bind a blob parameter at a given position index to a raw pointer and
  394. // length. The data will be copied by SQLite
  395. //
  396. // Args:
  397. // position: Parameter position (1-based index)
  398. // bytes: Raw pointer to the data to copy/bind
  399. // length: Number of bytes in the blob
  400. //
  401. // Returns:
  402. // SQLite result code, SQLITE_OK on no error
  403. //
  404. - (int)bindBlobAtPosition:(int)position bytes:(void *)bytes length:(int)length;
  405. // Bind an NSData as a blob at a given position. The data will be copied
  406. // by SQLite.
  407. //
  408. // Args:
  409. // position: Parameter position (1-based index)
  410. // data: NSData to convert to blob
  411. //
  412. // Returns:
  413. // SQLite result code, SQLITE_OK on no error
  414. //
  415. - (int)bindBlobAtPosition:(int)position data:(NSData *)data;
  416. // Bind a double at the given position (for floats convert to double).
  417. //
  418. // Args:
  419. // position: Parameter position (1-based index)
  420. // value: Double to bind
  421. //
  422. // Returns:
  423. // SQLite result code, SQLITE_OK on no error
  424. //
  425. - (int)bindDoubleAtPosition:(int)position value:(double)value;
  426. // Bind an NSNumber as a double value at the given position.
  427. //
  428. // Args:
  429. // position: Parameter position (1-based index)
  430. // number: NSNumber to bind
  431. //
  432. // Returns:
  433. // SQLite result code, SQLITE_OK on no error
  434. //
  435. - (int)bindNumberAsDoubleAtPosition:(int)position number:(NSNumber *)number;
  436. // Bind a 32-bit integer at the given position.
  437. //
  438. // Args:
  439. // position: Parameter position (1-based index)
  440. // value: Integer to bind
  441. //
  442. // Returns:
  443. // SQLite result code, SQLITE_OK on no error
  444. //
  445. - (int)bindInt32AtPosition:(int)position value:(int)value;
  446. // Bind an NSNumber as a 32-bit integer value at the given position.
  447. //
  448. // Args:
  449. // position: Parameter position (1-based index)
  450. // number: NSNumber to bind
  451. //
  452. // Returns:
  453. // SQLite result code, SQLITE_OK on no error
  454. //
  455. - (int)bindNumberAsInt32AtPosition:(int)position number:(NSNumber *)number;
  456. // Bind a 64-bit integer at the given position.
  457. //
  458. // Args:
  459. // position: Parameter position (1-based index)
  460. // value: Int64 value to bind
  461. //
  462. // Returns:
  463. // SQLite result code, SQLITE_OK on no error
  464. //
  465. - (int)bindLongLongAtPosition:(int)position value:(long long)value;
  466. // Bind an NSNumber as a 64-bit integer value at the given position.
  467. //
  468. // Args:
  469. // position: Parameter position (1-based index)
  470. // number: NSNumber to bind
  471. //
  472. // Returns:
  473. // SQLite result code, SQLITE_OK on no error
  474. //
  475. - (int)bindNumberAsLongLongAtPosition:(int)position number:(NSNumber *)number;
  476. // Bind a string at the given position.
  477. //
  478. // Args:
  479. // position: Parameter position (1-based index)
  480. // string: String to bind (string will be converted to UTF8 and copied).
  481. // NOTE: For bindings it is not necessary for you to SQL escape
  482. // your strings.
  483. //
  484. // Returns:
  485. // SQLite result code, SQLITE_OK on no error
  486. //
  487. - (int)bindStringAtPosition:(int)position string:(NSString *)string;
  488. #pragma mark Results
  489. // Get the number of result columns per row this statement will generate.
  490. //
  491. // Returns:
  492. // Column count, 0 if no columns will be returned ("UPDATE.." etc.),
  493. // -1 on error.
  494. //
  495. - (int)resultColumnCount;
  496. // Get the name of result colument at a given index.
  497. //
  498. // Args:
  499. // position: Column position (0-based index)
  500. //
  501. // Returns:
  502. // Autoreleased NSString column name or nil if no column exists at that
  503. // position or error.
  504. //
  505. - (NSString *)resultColumnNameAtPosition:(int)position;
  506. // Get the number of data values in the current row of this statement.
  507. // Generally this will be the same as resultColumnCount:, except when row
  508. // iteration is done (see SQLite docs for sqlite3_data_count()).
  509. //
  510. // Returns:
  511. // Data count or 0 if no data will be returned, -1 on error.
  512. //
  513. - (int)rowDataCount;
  514. // Get the SQLite type constant for a column in a row. Note that because
  515. // SQLite does not enforce column type restrictions the type of a particular
  516. // column in a row may not match the declared type of the column.
  517. //
  518. // Args:
  519. // position: Column position (0-based index)
  520. //
  521. // Returns:
  522. // SQLite data type constant (i.e. SQLITE_INTEGER, SQLITE_FLOAT, etc.) or
  523. // -1 on error.
  524. //
  525. - (int)resultColumnTypeAtPosition:(int)position;
  526. // Get the data for a result row blob column as an NSData
  527. //
  528. // Args:
  529. // position: Column position (0-based index)
  530. //
  531. // Returns:
  532. // Autoreleased NSData, nil on error
  533. //
  534. - (NSData *)resultBlobDataAtPosition:(int)position;
  535. // Get the data for a result row blob column as a double
  536. //
  537. // Args:
  538. // position: Column position (0-based index)
  539. //
  540. // Returns:
  541. // Double value
  542. //
  543. - (double)resultDoubleAtPosition:(int)position;
  544. // Get the data for a result row blob column as an integer
  545. //
  546. // Args:
  547. // position: Column position (0-based index)
  548. //
  549. // Returns:
  550. // Integer value
  551. //
  552. - (int)resultInt32AtPosition:(int)position;
  553. // Get the data for a result row blob column as a long long
  554. //
  555. // Args:
  556. // position: Column position (0-based index)
  557. //
  558. // Returns:
  559. // Long long value
  560. //
  561. - (long long)resultLongLongAtPosition:(int)position;
  562. // Get the data for a result row blob column as an NSNumber
  563. //
  564. // Args:
  565. // position: Column position (0-based index)
  566. //
  567. // Returns:
  568. // Autoreleased NSNumber value or nil on error
  569. //
  570. - (NSNumber *)resultNumberAtPosition:(int)position;
  571. // Get the data for a result row blob column as an NSString
  572. //
  573. // Args:
  574. // position: Column position (0-based index)
  575. //
  576. // Returns:
  577. // Autoreleased NSString value or nil on error
  578. //
  579. - (NSString *)resultStringAtPosition:(int)position;
  580. // Get a Foundation object (NSData, NSNumber, NSString, NSNull) for the column,
  581. // autodetecting the most appropriate representation.
  582. //
  583. // Args:
  584. // position: Column position (0-based index)
  585. //
  586. // Returns:
  587. // Autoreleased Foundation type, nil on error
  588. //
  589. - (id)resultFoundationObjectAtPosition:(int)position;
  590. // Get an array of Foundation objects for the row in query column order.
  591. //
  592. // Returns:
  593. // Autoreleased array of Foundation types or nil if there is no
  594. // data in the row or error
  595. //
  596. - (NSArray *)resultRowArray;
  597. // Get a dictionary of Foundation objects for the row keyed by column name.
  598. //
  599. // Returns:
  600. // Autoreleased dictionary of Foundation types or nil if there is no
  601. // data in the row or error.
  602. //
  603. - (NSDictionary *)resultRowDictionary;
  604. #pragma mark Rows
  605. // Step the statement forward one row, potentially spinning forever till
  606. // the row can be located (if database is SQLITE_BUSY).
  607. //
  608. // Returns:
  609. // SQLite result code, SQLITE_ROW if a row was found or SQLITE_DONE if
  610. // no further rows match the statement.
  611. //
  612. - (int)stepRow;
  613. // Step the statement forward one row, waiting at most the currrent database
  614. // busy timeout (see [GTMSQLiteDatabase setBusyTimeoutMS]).
  615. //
  616. // Returns:
  617. // SQLite result code, SQLITE_ROW if a row was found or SQLITE_DONE if
  618. // no further rows match the statement. If SQLITE_BUSY is returned the
  619. // database did not unlock during the timeout.
  620. //
  621. - (int)stepRowWithTimeout;
  622. // Reset the statement starting again at the first row
  623. //
  624. // Returns:
  625. // SQLite result code, SQLITE_OK on no error
  626. //
  627. - (int)reset;
  628. // Check if the SQLite parser recognizes the receiver as one or more valid
  629. // SQLite statements.
  630. //
  631. // Returns:
  632. // YES if the string is a complete and valid SQLite statement
  633. //
  634. + (BOOL)isCompleteStatement:(NSString *)string;
  635. // Quote and escape the receiver for SQL.
  636. // Example: "This is wild! It's fun!"
  637. // Becomes: "'This is wild! It''s fun!'"
  638. //
  639. // Returns:
  640. // Autoreleased NSString
  641. + (NSString *)quoteAndEscapeString:(NSString *)string;
  642. @end