FMDatabase.html 129 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="html/html; charset=utf-8" />
  5. <title>FMDatabase Class Reference</title>
  6. <meta id="xcode-display" name="xcode-display" content="render"/>
  7. <meta name="viewport" content="width=550" />
  8. <link rel="stylesheet" type="text/css" href="../css/styles.css" media="all" />
  9. <link rel="stylesheet" type="text/css" media="print" href="../css/stylesPrint.css" />
  10. <meta name="generator" content="appledoc 2.1 (build 858)" />
  11. </head>
  12. <body>
  13. <header id="top_header">
  14. <div id="library" class="hideInXcode">
  15. <h1><a id="libraryTitle" href="../index.html">FMDB </a></h1>
  16. <a id="developerHome" href="../index.html">ccgus</a>
  17. </div>
  18. <div id="title" role="banner">
  19. <h1 class="hideInXcode">FMDatabase Class Reference</h1>
  20. </div>
  21. <ul id="headerButtons" role="toolbar">
  22. <li id="toc_button">
  23. <button aria-label="Show Table of Contents" role="checkbox" class="open" id="table_of_contents"><span class="disclosure"></span>Table of Contents</button>
  24. </li>
  25. <li id="jumpto_button" role="navigation">
  26. <select id="jumpTo">
  27. <option value="top">Jump To&#133;</option>
  28. <option value="overview">Overview</option>
  29. <option value="tasks">Tasks</option>
  30. <option value="properties">Properties</option>
  31. <option value="//api/name/busyRetryTimeout">&nbsp;&nbsp;&nbsp;&nbsp;busyRetryTimeout</option>
  32. <option value="//api/name/cachedStatements">&nbsp;&nbsp;&nbsp;&nbsp;cachedStatements</option>
  33. <option value="//api/name/checkedOut">&nbsp;&nbsp;&nbsp;&nbsp;checkedOut</option>
  34. <option value="//api/name/crashOnErrors">&nbsp;&nbsp;&nbsp;&nbsp;crashOnErrors</option>
  35. <option value="//api/name/logsErrors">&nbsp;&nbsp;&nbsp;&nbsp;logsErrors</option>
  36. <option value="//api/name/traceExecution">&nbsp;&nbsp;&nbsp;&nbsp;traceExecution</option>
  37. <option value="class_methods">Class Methods</option>
  38. <option value="//api/name/databaseWithPath:">&nbsp;&nbsp;&nbsp;&nbsp;+ databaseWithPath:</option>
  39. <option value="//api/name/isSQLiteThreadSafe">&nbsp;&nbsp;&nbsp;&nbsp;+ isSQLiteThreadSafe</option>
  40. <option value="//api/name/sqliteLibVersion">&nbsp;&nbsp;&nbsp;&nbsp;+ sqliteLibVersion</option>
  41. <option value="//api/name/storeableDateFormat:">&nbsp;&nbsp;&nbsp;&nbsp;+ storeableDateFormat:</option>
  42. <option value="instance_methods">Instance Methods</option>
  43. <option value="//api/name/beginDeferredTransaction">&nbsp;&nbsp;&nbsp;&nbsp;- beginDeferredTransaction</option>
  44. <option value="//api/name/beginTransaction">&nbsp;&nbsp;&nbsp;&nbsp;- beginTransaction</option>
  45. <option value="//api/name/changes">&nbsp;&nbsp;&nbsp;&nbsp;- changes</option>
  46. <option value="//api/name/clearCachedStatements">&nbsp;&nbsp;&nbsp;&nbsp;- clearCachedStatements</option>
  47. <option value="//api/name/close">&nbsp;&nbsp;&nbsp;&nbsp;- close</option>
  48. <option value="//api/name/closeOpenResultSets">&nbsp;&nbsp;&nbsp;&nbsp;- closeOpenResultSets</option>
  49. <option value="//api/name/commit">&nbsp;&nbsp;&nbsp;&nbsp;- commit</option>
  50. <option value="//api/name/databasePath">&nbsp;&nbsp;&nbsp;&nbsp;- databasePath</option>
  51. <option value="//api/name/dateFromString:">&nbsp;&nbsp;&nbsp;&nbsp;- dateFromString:</option>
  52. <option value="//api/name/executeQuery:">&nbsp;&nbsp;&nbsp;&nbsp;- executeQuery:</option>
  53. <option value="//api/name/executeQuery:withArgumentsInArray:">&nbsp;&nbsp;&nbsp;&nbsp;- executeQuery:withArgumentsInArray:</option>
  54. <option value="//api/name/executeQuery:withParameterDictionary:">&nbsp;&nbsp;&nbsp;&nbsp;- executeQuery:withParameterDictionary:</option>
  55. <option value="//api/name/executeQueryWithFormat:">&nbsp;&nbsp;&nbsp;&nbsp;- executeQueryWithFormat:</option>
  56. <option value="//api/name/executeUpdate:">&nbsp;&nbsp;&nbsp;&nbsp;- executeUpdate:</option>
  57. <option value="//api/name/executeUpdate:withArgumentsInArray:">&nbsp;&nbsp;&nbsp;&nbsp;- executeUpdate:withArgumentsInArray:</option>
  58. <option value="//api/name/executeUpdate:withParameterDictionary:">&nbsp;&nbsp;&nbsp;&nbsp;- executeUpdate:withParameterDictionary:</option>
  59. <option value="//api/name/executeUpdateWithFormat:">&nbsp;&nbsp;&nbsp;&nbsp;- executeUpdateWithFormat:</option>
  60. <option value="//api/name/goodConnection">&nbsp;&nbsp;&nbsp;&nbsp;- goodConnection</option>
  61. <option value="//api/name/hadError">&nbsp;&nbsp;&nbsp;&nbsp;- hadError</option>
  62. <option value="//api/name/hasDateFormatter">&nbsp;&nbsp;&nbsp;&nbsp;- hasDateFormatter</option>
  63. <option value="//api/name/hasOpenResultSets">&nbsp;&nbsp;&nbsp;&nbsp;- hasOpenResultSets</option>
  64. <option value="//api/name/inSavePoint:">&nbsp;&nbsp;&nbsp;&nbsp;- inSavePoint:</option>
  65. <option value="//api/name/inTransaction">&nbsp;&nbsp;&nbsp;&nbsp;- inTransaction</option>
  66. <option value="//api/name/initWithPath:">&nbsp;&nbsp;&nbsp;&nbsp;- initWithPath:</option>
  67. <option value="//api/name/lastError">&nbsp;&nbsp;&nbsp;&nbsp;- lastError</option>
  68. <option value="//api/name/lastErrorCode">&nbsp;&nbsp;&nbsp;&nbsp;- lastErrorCode</option>
  69. <option value="//api/name/lastErrorMessage">&nbsp;&nbsp;&nbsp;&nbsp;- lastErrorMessage</option>
  70. <option value="//api/name/lastInsertRowId">&nbsp;&nbsp;&nbsp;&nbsp;- lastInsertRowId</option>
  71. <option value="//api/name/makeFunctionNamed:maximumArguments:withBlock:">&nbsp;&nbsp;&nbsp;&nbsp;- makeFunctionNamed:maximumArguments:withBlock:</option>
  72. <option value="//api/name/open">&nbsp;&nbsp;&nbsp;&nbsp;- open</option>
  73. <option value="//api/name/openWithFlags:">&nbsp;&nbsp;&nbsp;&nbsp;- openWithFlags:</option>
  74. <option value="//api/name/rekey:">&nbsp;&nbsp;&nbsp;&nbsp;- rekey:</option>
  75. <option value="//api/name/rekeyWithData:">&nbsp;&nbsp;&nbsp;&nbsp;- rekeyWithData:</option>
  76. <option value="//api/name/releaseSavePointWithName:error:">&nbsp;&nbsp;&nbsp;&nbsp;- releaseSavePointWithName:error:</option>
  77. <option value="//api/name/rollback">&nbsp;&nbsp;&nbsp;&nbsp;- rollback</option>
  78. <option value="//api/name/rollbackToSavePointWithName:error:">&nbsp;&nbsp;&nbsp;&nbsp;- rollbackToSavePointWithName:error:</option>
  79. <option value="//api/name/setDateFormat:">&nbsp;&nbsp;&nbsp;&nbsp;- setDateFormat:</option>
  80. <option value="//api/name/setKey:">&nbsp;&nbsp;&nbsp;&nbsp;- setKey:</option>
  81. <option value="//api/name/setKeyWithData:">&nbsp;&nbsp;&nbsp;&nbsp;- setKeyWithData:</option>
  82. <option value="//api/name/setShouldCacheStatements:">&nbsp;&nbsp;&nbsp;&nbsp;- setShouldCacheStatements:</option>
  83. <option value="//api/name/shouldCacheStatements">&nbsp;&nbsp;&nbsp;&nbsp;- shouldCacheStatements</option>
  84. <option value="//api/name/sqliteHandle">&nbsp;&nbsp;&nbsp;&nbsp;- sqliteHandle</option>
  85. <option value="//api/name/startSavePointWithName:error:">&nbsp;&nbsp;&nbsp;&nbsp;- startSavePointWithName:error:</option>
  86. <option value="//api/name/stringFromDate:">&nbsp;&nbsp;&nbsp;&nbsp;- stringFromDate:</option>
  87. <option value="//api/name/update:withErrorAndBindings:">&nbsp;&nbsp;&nbsp;&nbsp;- update:withErrorAndBindings:</option>
  88. </select>
  89. </li>
  90. </ul>
  91. </header>
  92. <nav id="tocContainer" class="isShowingTOC">
  93. <ul id="toc" role="tree">
  94. <li role="treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#overview">Overview</a></span></li>
  95. <li role="treeitem" id="task_treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#tasks">Tasks</a></span><ul>
  96. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Properties">Properties</a></span></li>
  97. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Initialization">Initialization</a></span></li>
  98. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Opening and closing database">Opening and closing database</a></span></li>
  99. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Perform updates">Perform updates</a></span></li>
  100. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Retrieving results">Retrieving results</a></span></li>
  101. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Transactions">Transactions</a></span></li>
  102. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Cached statements and result sets">Cached statements and result sets</a></span></li>
  103. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Encryption methods">Encryption methods</a></span></li>
  104. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_General inquiry methods">General inquiry methods</a></span></li>
  105. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Retrieving error codes">Retrieving error codes</a></span></li>
  106. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Save points">Save points</a></span></li>
  107. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_SQLite library status">SQLite library status</a></span></li>
  108. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Make SQL function">Make SQL function</a></span></li>
  109. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Date formatter">Date formatter</a></span></li>
  110. </ul></li>
  111. <li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#properties">Properties</a></span><ul>
  112. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/busyRetryTimeout">busyRetryTimeout</a></span></li>
  113. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/cachedStatements">cachedStatements</a></span></li>
  114. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/checkedOut">checkedOut</a></span></li>
  115. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/crashOnErrors">crashOnErrors</a></span></li>
  116. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/logsErrors">logsErrors</a></span></li>
  117. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/traceExecution">traceExecution</a></span></li>
  118. </ul></li>
  119. <li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#class_methods">Class Methods</a></span><ul>
  120. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/databaseWithPath:">databaseWithPath:</a></span></li>
  121. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isSQLiteThreadSafe">isSQLiteThreadSafe</a></span></li>
  122. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/sqliteLibVersion">sqliteLibVersion</a></span></li>
  123. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/storeableDateFormat:">storeableDateFormat:</a></span></li>
  124. </ul></li>
  125. <li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#instance_methods">Instance Methods</a></span><ul>
  126. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/beginDeferredTransaction">beginDeferredTransaction</a></span></li>
  127. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/beginTransaction">beginTransaction</a></span></li>
  128. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/changes">changes</a></span></li>
  129. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/clearCachedStatements">clearCachedStatements</a></span></li>
  130. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/close">close</a></span></li>
  131. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/closeOpenResultSets">closeOpenResultSets</a></span></li>
  132. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/commit">commit</a></span></li>
  133. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/databasePath">databasePath</a></span></li>
  134. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/dateFromString:">dateFromString:</a></span></li>
  135. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/executeQuery:">executeQuery:</a></span></li>
  136. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/executeQuery:withArgumentsInArray:">executeQuery:withArgumentsInArray:</a></span></li>
  137. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/executeQuery:withParameterDictionary:">executeQuery:withParameterDictionary:</a></span></li>
  138. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/executeQueryWithFormat:">executeQueryWithFormat:</a></span></li>
  139. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/executeUpdate:">executeUpdate:</a></span></li>
  140. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/executeUpdate:withArgumentsInArray:">executeUpdate:withArgumentsInArray:</a></span></li>
  141. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/executeUpdate:withParameterDictionary:">executeUpdate:withParameterDictionary:</a></span></li>
  142. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/executeUpdateWithFormat:">executeUpdateWithFormat:</a></span></li>
  143. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/goodConnection">goodConnection</a></span></li>
  144. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/hadError">hadError</a></span></li>
  145. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/hasDateFormatter">hasDateFormatter</a></span></li>
  146. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/hasOpenResultSets">hasOpenResultSets</a></span></li>
  147. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/inSavePoint:">inSavePoint:</a></span></li>
  148. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/inTransaction">inTransaction</a></span></li>
  149. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/initWithPath:">initWithPath:</a></span></li>
  150. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/lastError">lastError</a></span></li>
  151. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/lastErrorCode">lastErrorCode</a></span></li>
  152. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/lastErrorMessage">lastErrorMessage</a></span></li>
  153. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/lastInsertRowId">lastInsertRowId</a></span></li>
  154. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/makeFunctionNamed:maximumArguments:withBlock:">makeFunctionNamed:maximumArguments:withBlock:</a></span></li>
  155. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/open">open</a></span></li>
  156. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/openWithFlags:">openWithFlags:</a></span></li>
  157. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/rekey:">rekey:</a></span></li>
  158. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/rekeyWithData:">rekeyWithData:</a></span></li>
  159. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/releaseSavePointWithName:error:">releaseSavePointWithName:error:</a></span></li>
  160. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/rollback">rollback</a></span></li>
  161. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/rollbackToSavePointWithName:error:">rollbackToSavePointWithName:error:</a></span></li>
  162. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setDateFormat:">setDateFormat:</a></span></li>
  163. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setKey:">setKey:</a></span></li>
  164. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setKeyWithData:">setKeyWithData:</a></span></li>
  165. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setShouldCacheStatements:">setShouldCacheStatements:</a></span></li>
  166. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/shouldCacheStatements">shouldCacheStatements</a></span></li>
  167. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/sqliteHandle">sqliteHandle</a></span></li>
  168. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/startSavePointWithName:error:">startSavePointWithName:error:</a></span></li>
  169. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/stringFromDate:">stringFromDate:</a></span></li>
  170. <li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/update:withErrorAndBindings:">update:withErrorAndBindings:</a></span></li>
  171. </ul></li>
  172. </ul>
  173. </nav>
  174. <article>
  175. <div id="contents" class="isShowingTOC" role="main">
  176. <a title="FMDatabase Class Reference" name="top"></a>
  177. <div class="main-navigation navigation-top">
  178. <ul>
  179. <li><a href="../index.html">Index</a></li>
  180. <li><a href="../hierarchy.html">Hierarchy</a></li>
  181. </ul>
  182. </div>
  183. <div id="header">
  184. <div class="section-header">
  185. <h1 class="title title-header">FMDatabase Class Reference</h1>
  186. </div>
  187. </div>
  188. <div id="container">
  189. <div class="section section-specification"><table cellspacing="0"><tbody>
  190. <tr>
  191. <td class="specification-title">Inherits from</td>
  192. <td class="specification-value">NSObject</td>
  193. </tr><tr>
  194. <td class="specification-title">Declared in</td>
  195. <td class="specification-value">FMDatabase.h<br />FMDatabase.m</td>
  196. </tr>
  197. </tbody></table></div>
  198. <div class="section section-overview">
  199. <a title="Overview" name="overview"></a>
  200. <h2 class="subtitle subtitle-overview">Overview</h2>
  201. <p>A SQLite (<a href="http://sqlite.org/">http://sqlite.org/</a>) Objective-C wrapper.</p>
  202. <h3>Usage</h3>
  203. <p>The three main classes in FMDB are:</p>
  204. <ul>
  205. <li><code>FMDatabase</code> - Represents a single SQLite database. Used for executing SQL statements.</li>
  206. <li><a href="../Classes/FMResultSet.html"><code>FMResultSet</code></a> - Represents the results of executing a query on an <code>FMDatabase</code>.</li>
  207. <li><a href="../Classes/FMDatabaseQueue.html"><code>FMDatabaseQueue</code></a> - If you want to perform queries and updates on multiple threads, you&rsquo;ll want to use this class.</li>
  208. </ul>
  209. <h3>See also</h3>
  210. <ul>
  211. <li><a href="../Classes/FMDatabasePool.html"><code>FMDatabasePool</code></a> - A pool of <code>FMDatabase</code> objects.</li>
  212. <li><a href="../Classes/FMStatement.html"><code>FMStatement</code></a> - A wrapper for <code>sqlite_stmt</code>.</li>
  213. </ul>
  214. <h3>External links</h3>
  215. <ul>
  216. <li><a href="https://github.com/ccgus/fmdb">FMDB on GitHub</a> including introductory documentation</li>
  217. <li><a href="http://sqlite.org/">SQLite web site</a></li>
  218. <li><a href="http://groups.google.com/group/fmdb">FMDB mailing list</a></li>
  219. <li><a href="http://www.sqlite.org/faq.html">SQLite FAQ</a></li>
  220. </ul>
  221. <div class="warning"><p><strong>Warning:</strong> Do not instantiate a single <code>FMDatabase</code> object and use it across multiple threads. Instead, use <a href="../Classes/FMDatabaseQueue.html"><code>FMDatabaseQueue</code></a>.</p></div>
  222. </div>
  223. <div class="section section-tasks">
  224. <a title="Tasks" name="tasks"></a>
  225. <h2 class="subtitle subtitle-tasks">Tasks</h2>
  226. <a title="Properties" name="task_Properties"></a>
  227. <h3 class="subsubtitle task-title">Properties</h3>
  228. <ul class="task-list">
  229. <li>
  230. <span class="tooltip">
  231. <code><a href="#//api/name/traceExecution">&nbsp;&nbsp;traceExecution</a></code>
  232. <span class="tooltip"><p>Whether should trace execution</p></span>
  233. </span>
  234. <span class="task-item-suffix">property</span>
  235. </li><li>
  236. <span class="tooltip">
  237. <code><a href="#//api/name/checkedOut">&nbsp;&nbsp;checkedOut</a></code>
  238. <span class="tooltip"><p>Whether checked out or not</p></span>
  239. </span>
  240. <span class="task-item-suffix">property</span>
  241. </li><li>
  242. <span class="tooltip">
  243. <code><a href="#//api/name/busyRetryTimeout">&nbsp;&nbsp;busyRetryTimeout</a></code>
  244. <span class="tooltip"><p>Busy retry timeout</p></span>
  245. </span>
  246. <span class="task-item-suffix">property</span>
  247. </li><li>
  248. <span class="tooltip">
  249. <code><a href="#//api/name/crashOnErrors">&nbsp;&nbsp;crashOnErrors</a></code>
  250. <span class="tooltip"><p>Crash on errors</p></span>
  251. </span>
  252. <span class="task-item-suffix">property</span>
  253. </li><li>
  254. <span class="tooltip">
  255. <code><a href="#//api/name/logsErrors">&nbsp;&nbsp;logsErrors</a></code>
  256. <span class="tooltip"><p>Logs errors</p></span>
  257. </span>
  258. <span class="task-item-suffix">property</span>
  259. </li><li>
  260. <span class="tooltip">
  261. <code><a href="#//api/name/cachedStatements">&nbsp;&nbsp;cachedStatements</a></code>
  262. <span class="tooltip"><p>Dictionary of cached statements</p></span>
  263. </span>
  264. <span class="task-item-suffix">property</span>
  265. </li>
  266. </ul>
  267. <a title="Initialization" name="task_Initialization"></a>
  268. <h3 class="subsubtitle task-title">Initialization</h3>
  269. <ul class="task-list">
  270. <li>
  271. <span class="tooltip">
  272. <code><a href="#//api/name/databaseWithPath:">+&nbsp;databaseWithPath:</a></code>
  273. <span class="tooltip"><p>Create a <code>FMDatabase</code> object.</p></span>
  274. </span>
  275. </li><li>
  276. <span class="tooltip">
  277. <code><a href="#//api/name/initWithPath:">&ndash;&nbsp;initWithPath:</a></code>
  278. <span class="tooltip"><p>Initialize a <code>FMDatabase</code> object.</p></span>
  279. </span>
  280. </li>
  281. </ul>
  282. <a title="Opening and closing database" name="task_Opening and closing database"></a>
  283. <h3 class="subsubtitle task-title">Opening and closing database</h3>
  284. <ul class="task-list">
  285. <li>
  286. <span class="tooltip">
  287. <code><a href="#//api/name/open">&ndash;&nbsp;open</a></code>
  288. <span class="tooltip"><p>Opening a new database connection</p></span>
  289. </span>
  290. </li><li>
  291. <span class="tooltip">
  292. <code><a href="#//api/name/openWithFlags:">&ndash;&nbsp;openWithFlags:</a></code>
  293. <span class="tooltip"><p>Opening a new database connection with flags</p></span>
  294. </span>
  295. </li><li>
  296. <span class="tooltip">
  297. <code><a href="#//api/name/close">&ndash;&nbsp;close</a></code>
  298. <span class="tooltip"><p>Closing a database connection</p></span>
  299. </span>
  300. </li><li>
  301. <span class="tooltip">
  302. <code><a href="#//api/name/goodConnection">&ndash;&nbsp;goodConnection</a></code>
  303. <span class="tooltip"><p>Test to see if we have a good connection to the database.</p></span>
  304. </span>
  305. </li>
  306. </ul>
  307. <a title="Perform updates" name="task_Perform updates"></a>
  308. <h3 class="subsubtitle task-title">Perform updates</h3>
  309. <ul class="task-list">
  310. <li>
  311. <span class="tooltip">
  312. <code><a href="#//api/name/update:withErrorAndBindings:">&ndash;&nbsp;update:withErrorAndBindings:</a></code>
  313. <span class="tooltip"><p>Execute update statement</p></span>
  314. </span>
  315. </li><li>
  316. <span class="tooltip">
  317. <code><a href="#//api/name/executeUpdate:">&ndash;&nbsp;executeUpdate:</a></code>
  318. <span class="tooltip"><p>Execute update statement</p></span>
  319. </span>
  320. </li><li>
  321. <span class="tooltip">
  322. <code><a href="#//api/name/executeUpdateWithFormat:">&ndash;&nbsp;executeUpdateWithFormat:</a></code>
  323. <span class="tooltip"><p>Execute update statement</p></span>
  324. </span>
  325. </li><li>
  326. <span class="tooltip">
  327. <code><a href="#//api/name/executeUpdate:withArgumentsInArray:">&ndash;&nbsp;executeUpdate:withArgumentsInArray:</a></code>
  328. <span class="tooltip"><p>Execute update statement</p></span>
  329. </span>
  330. </li><li>
  331. <span class="tooltip">
  332. <code><a href="#//api/name/executeUpdate:withParameterDictionary:">&ndash;&nbsp;executeUpdate:withParameterDictionary:</a></code>
  333. <span class="tooltip"><p>Execute update statement</p></span>
  334. </span>
  335. </li><li>
  336. <span class="tooltip">
  337. <code><a href="#//api/name/lastInsertRowId">&ndash;&nbsp;lastInsertRowId</a></code>
  338. <span class="tooltip"><p>Last insert rowid</p></span>
  339. </span>
  340. </li><li>
  341. <span class="tooltip">
  342. <code><a href="#//api/name/changes">&ndash;&nbsp;changes</a></code>
  343. <span class="tooltip"><p>The number of rows changed by prior SQL statement.</p></span>
  344. </span>
  345. </li>
  346. </ul>
  347. <a title="Retrieving results" name="task_Retrieving results"></a>
  348. <h3 class="subsubtitle task-title">Retrieving results</h3>
  349. <ul class="task-list">
  350. <li>
  351. <span class="tooltip">
  352. <code><a href="#//api/name/executeQuery:">&ndash;&nbsp;executeQuery:</a></code>
  353. <span class="tooltip"><p>Execute select statement</p></span>
  354. </span>
  355. </li><li>
  356. <span class="tooltip">
  357. <code><a href="#//api/name/executeQueryWithFormat:">&ndash;&nbsp;executeQueryWithFormat:</a></code>
  358. <span class="tooltip"><p>Execute select statement</p></span>
  359. </span>
  360. </li><li>
  361. <span class="tooltip">
  362. <code><a href="#//api/name/executeQuery:withArgumentsInArray:">&ndash;&nbsp;executeQuery:withArgumentsInArray:</a></code>
  363. <span class="tooltip"><p>Execute select statement</p></span>
  364. </span>
  365. </li><li>
  366. <span class="tooltip">
  367. <code><a href="#//api/name/executeQuery:withParameterDictionary:">&ndash;&nbsp;executeQuery:withParameterDictionary:</a></code>
  368. <span class="tooltip"><p>Execute select statement</p></span>
  369. </span>
  370. </li>
  371. </ul>
  372. <a title="Transactions" name="task_Transactions"></a>
  373. <h3 class="subsubtitle task-title">Transactions</h3>
  374. <ul class="task-list">
  375. <li>
  376. <span class="tooltip">
  377. <code><a href="#//api/name/beginTransaction">&ndash;&nbsp;beginTransaction</a></code>
  378. <span class="tooltip"><p>Begin a transaction</p></span>
  379. </span>
  380. </li><li>
  381. <span class="tooltip">
  382. <code><a href="#//api/name/beginDeferredTransaction">&ndash;&nbsp;beginDeferredTransaction</a></code>
  383. <span class="tooltip"><p>Begin a deferred transaction</p></span>
  384. </span>
  385. </li><li>
  386. <span class="tooltip">
  387. <code><a href="#//api/name/commit">&ndash;&nbsp;commit</a></code>
  388. <span class="tooltip"><p>Commit a transaction</p></span>
  389. </span>
  390. </li><li>
  391. <span class="tooltip">
  392. <code><a href="#//api/name/rollback">&ndash;&nbsp;rollback</a></code>
  393. <span class="tooltip"><p>Rollback a transaction</p></span>
  394. </span>
  395. </li><li>
  396. <span class="tooltip">
  397. <code><a href="#//api/name/inTransaction">&ndash;&nbsp;inTransaction</a></code>
  398. <span class="tooltip"><p>Identify whether currently in a transaction or not</p></span>
  399. </span>
  400. </li>
  401. </ul>
  402. <a title="Cached statements and result sets" name="task_Cached statements and result sets"></a>
  403. <h3 class="subsubtitle task-title">Cached statements and result sets</h3>
  404. <ul class="task-list">
  405. <li>
  406. <span class="tooltip">
  407. <code><a href="#//api/name/clearCachedStatements">&ndash;&nbsp;clearCachedStatements</a></code>
  408. <span class="tooltip"><p>Clear cached statements</p></span>
  409. </span>
  410. </li><li>
  411. <span class="tooltip">
  412. <code><a href="#//api/name/closeOpenResultSets">&ndash;&nbsp;closeOpenResultSets</a></code>
  413. <span class="tooltip"><p>Close all open result sets</p></span>
  414. </span>
  415. </li><li>
  416. <span class="tooltip">
  417. <code><a href="#//api/name/hasOpenResultSets">&ndash;&nbsp;hasOpenResultSets</a></code>
  418. <span class="tooltip"><p>Whether database has any open result sets</p></span>
  419. </span>
  420. </li><li>
  421. <span class="tooltip">
  422. <code><a href="#//api/name/shouldCacheStatements">&ndash;&nbsp;shouldCacheStatements</a></code>
  423. <span class="tooltip"><p>Return whether should cache statements or not</p></span>
  424. </span>
  425. </li><li>
  426. <span class="tooltip">
  427. <code><a href="#//api/name/setShouldCacheStatements:">&ndash;&nbsp;setShouldCacheStatements:</a></code>
  428. <span class="tooltip"><p>Set whether should cache statements or not</p></span>
  429. </span>
  430. </li>
  431. </ul>
  432. <a title="Encryption methods" name="task_Encryption methods"></a>
  433. <h3 class="subsubtitle task-title">Encryption methods</h3>
  434. <ul class="task-list">
  435. <li>
  436. <span class="tooltip">
  437. <code><a href="#//api/name/setKey:">&ndash;&nbsp;setKey:</a></code>
  438. <span class="tooltip"><p>Set encryption key.</p></span>
  439. </span>
  440. </li><li>
  441. <span class="tooltip">
  442. <code><a href="#//api/name/rekey:">&ndash;&nbsp;rekey:</a></code>
  443. <span class="tooltip"><p>Reset encryption key</p></span>
  444. </span>
  445. </li><li>
  446. <span class="tooltip">
  447. <code><a href="#//api/name/setKeyWithData:">&ndash;&nbsp;setKeyWithData:</a></code>
  448. <span class="tooltip"><p>Set encryption key using <code>keyData</code>.</p></span>
  449. </span>
  450. </li><li>
  451. <span class="tooltip">
  452. <code><a href="#//api/name/rekeyWithData:">&ndash;&nbsp;rekeyWithData:</a></code>
  453. <span class="tooltip"><p>Reset encryption key using <code>keyData</code>.</p></span>
  454. </span>
  455. </li>
  456. </ul>
  457. <a title="General inquiry methods" name="task_General inquiry methods"></a>
  458. <h3 class="subsubtitle task-title">General inquiry methods</h3>
  459. <ul class="task-list">
  460. <li>
  461. <span class="tooltip">
  462. <code><a href="#//api/name/databasePath">&ndash;&nbsp;databasePath</a></code>
  463. <span class="tooltip"><p>The path of the database file</p></span>
  464. </span>
  465. </li><li>
  466. <span class="tooltip">
  467. <code><a href="#//api/name/sqliteHandle">&ndash;&nbsp;sqliteHandle</a></code>
  468. <span class="tooltip"><p>The underlying SQLite handle</p></span>
  469. </span>
  470. </li>
  471. </ul>
  472. <a title="Retrieving error codes" name="task_Retrieving error codes"></a>
  473. <h3 class="subsubtitle task-title">Retrieving error codes</h3>
  474. <ul class="task-list">
  475. <li>
  476. <span class="tooltip">
  477. <code><a href="#//api/name/lastErrorMessage">&ndash;&nbsp;lastErrorMessage</a></code>
  478. <span class="tooltip"><p>Last error message</p></span>
  479. </span>
  480. </li><li>
  481. <span class="tooltip">
  482. <code><a href="#//api/name/lastErrorCode">&ndash;&nbsp;lastErrorCode</a></code>
  483. <span class="tooltip"><p>Last error code</p></span>
  484. </span>
  485. </li><li>
  486. <span class="tooltip">
  487. <code><a href="#//api/name/hadError">&ndash;&nbsp;hadError</a></code>
  488. <span class="tooltip"><p>Had error</p></span>
  489. </span>
  490. </li><li>
  491. <span class="tooltip">
  492. <code><a href="#//api/name/lastError">&ndash;&nbsp;lastError</a></code>
  493. <span class="tooltip"><p>Last error</p></span>
  494. </span>
  495. </li>
  496. </ul>
  497. <a title="Save points" name="task_Save points"></a>
  498. <h3 class="subsubtitle task-title">Save points</h3>
  499. <ul class="task-list">
  500. <li>
  501. <span class="tooltip">
  502. <code><a href="#//api/name/startSavePointWithName:error:">&ndash;&nbsp;startSavePointWithName:error:</a></code>
  503. <span class="tooltip"><p>Start save point</p></span>
  504. </span>
  505. </li><li>
  506. <span class="tooltip">
  507. <code><a href="#//api/name/releaseSavePointWithName:error:">&ndash;&nbsp;releaseSavePointWithName:error:</a></code>
  508. <span class="tooltip"><p>Release save point</p></span>
  509. </span>
  510. </li><li>
  511. <span class="tooltip">
  512. <code><a href="#//api/name/rollbackToSavePointWithName:error:">&ndash;&nbsp;rollbackToSavePointWithName:error:</a></code>
  513. <span class="tooltip"><p>Roll back to save point</p></span>
  514. </span>
  515. </li><li>
  516. <span class="tooltip">
  517. <code><a href="#//api/name/inSavePoint:">&ndash;&nbsp;inSavePoint:</a></code>
  518. <span class="tooltip"><p>Start save point</p></span>
  519. </span>
  520. </li>
  521. </ul>
  522. <a title="SQLite library status" name="task_SQLite library status"></a>
  523. <h3 class="subsubtitle task-title">SQLite library status</h3>
  524. <ul class="task-list">
  525. <li>
  526. <span class="tooltip">
  527. <code><a href="#//api/name/isSQLiteThreadSafe">+&nbsp;isSQLiteThreadSafe</a></code>
  528. <span class="tooltip"><p>Test to see if the library is threadsafe</p></span>
  529. </span>
  530. </li><li>
  531. <span class="tooltip">
  532. <code><a href="#//api/name/sqliteLibVersion">+&nbsp;sqliteLibVersion</a></code>
  533. <span class="tooltip"><p>Run-time library version numbers</p></span>
  534. </span>
  535. </li>
  536. </ul>
  537. <a title="Make SQL function" name="task_Make SQL function"></a>
  538. <h3 class="subsubtitle task-title">Make SQL function</h3>
  539. <ul class="task-list">
  540. <li>
  541. <span class="tooltip">
  542. <code><a href="#//api/name/makeFunctionNamed:maximumArguments:withBlock:">&ndash;&nbsp;makeFunctionNamed:maximumArguments:withBlock:</a></code>
  543. <span class="tooltip"><p>Adds SQL functions or aggregates or to redefine the behavior of existing SQL functions or aggregates.</p></span>
  544. </span>
  545. </li>
  546. </ul>
  547. <a title="Date formatter" name="task_Date formatter"></a>
  548. <h3 class="subsubtitle task-title">Date formatter</h3>
  549. <ul class="task-list">
  550. <li>
  551. <span class="tooltip">
  552. <code><a href="#//api/name/storeableDateFormat:">+&nbsp;storeableDateFormat:</a></code>
  553. <span class="tooltip"><p>Generate an <code>NSDateFormatter</code> that won&rsquo;t be broken by permutations of timezones or locales.</p></span>
  554. </span>
  555. </li><li>
  556. <span class="tooltip">
  557. <code><a href="#//api/name/hasDateFormatter">&ndash;&nbsp;hasDateFormatter</a></code>
  558. <span class="tooltip"><p>Test whether the database has a date formatter assigned.</p></span>
  559. </span>
  560. </li><li>
  561. <span class="tooltip">
  562. <code><a href="#//api/name/setDateFormat:">&ndash;&nbsp;setDateFormat:</a></code>
  563. <span class="tooltip"><p>Set to a date formatter to use string dates with sqlite instead of the default UNIX timestamps.</p></span>
  564. </span>
  565. </li><li>
  566. <span class="tooltip">
  567. <code><a href="#//api/name/dateFromString:">&ndash;&nbsp;dateFromString:</a></code>
  568. <span class="tooltip"><p>Convert the supplied NSString to NSDate, using the current database formatter.</p></span>
  569. </span>
  570. </li><li>
  571. <span class="tooltip">
  572. <code><a href="#//api/name/stringFromDate:">&ndash;&nbsp;stringFromDate:</a></code>
  573. <span class="tooltip"><p>Convert the supplied NSDate to NSString, using the current database formatter.</p></span>
  574. </span>
  575. </li>
  576. </ul>
  577. </div>
  578. <div class="section section-methods">
  579. <a title="Properties" name="properties"></a>
  580. <h2 class="subtitle subtitle-methods">Properties</h2>
  581. <div class="section-method">
  582. <a name="//api/name/busyRetryTimeout" title="busyRetryTimeout"></a>
  583. <h3 class="subsubtitle method-title">busyRetryTimeout</h3>
  584. <div class="method-subsection brief-description">
  585. <p>Busy retry timeout</p>
  586. </div>
  587. <div class="method-subsection method-declaration"><code>@property (atomic, assign) int busyRetryTimeout</code></div>
  588. <div class="method-subsection declared-in-section">
  589. <h4 class="method-subtitle">Declared In</h4>
  590. <code class="declared-in-ref">FMDatabase.h</code><br />
  591. </div>
  592. </div>
  593. <div class="section-method">
  594. <a name="//api/name/cachedStatements" title="cachedStatements"></a>
  595. <h3 class="subsubtitle method-title">cachedStatements</h3>
  596. <div class="method-subsection brief-description">
  597. <p>Dictionary of cached statements</p>
  598. </div>
  599. <div class="method-subsection method-declaration"><code>@property (atomic, retain) NSMutableDictionary *cachedStatements</code></div>
  600. <div class="method-subsection declared-in-section">
  601. <h4 class="method-subtitle">Declared In</h4>
  602. <code class="declared-in-ref">FMDatabase.h</code><br />
  603. </div>
  604. </div>
  605. <div class="section-method">
  606. <a name="//api/name/checkedOut" title="checkedOut"></a>
  607. <h3 class="subsubtitle method-title">checkedOut</h3>
  608. <div class="method-subsection brief-description">
  609. <p>Whether checked out or not</p>
  610. </div>
  611. <div class="method-subsection method-declaration"><code>@property (atomic, assign) BOOL checkedOut</code></div>
  612. <div class="method-subsection declared-in-section">
  613. <h4 class="method-subtitle">Declared In</h4>
  614. <code class="declared-in-ref">FMDatabase.h</code><br />
  615. </div>
  616. </div>
  617. <div class="section-method">
  618. <a name="//api/name/crashOnErrors" title="crashOnErrors"></a>
  619. <h3 class="subsubtitle method-title">crashOnErrors</h3>
  620. <div class="method-subsection brief-description">
  621. <p>Crash on errors</p>
  622. </div>
  623. <div class="method-subsection method-declaration"><code>@property (atomic, assign) BOOL crashOnErrors</code></div>
  624. <div class="method-subsection declared-in-section">
  625. <h4 class="method-subtitle">Declared In</h4>
  626. <code class="declared-in-ref">FMDatabase.h</code><br />
  627. </div>
  628. </div>
  629. <div class="section-method">
  630. <a name="//api/name/logsErrors" title="logsErrors"></a>
  631. <h3 class="subsubtitle method-title">logsErrors</h3>
  632. <div class="method-subsection brief-description">
  633. <p>Logs errors</p>
  634. </div>
  635. <div class="method-subsection method-declaration"><code>@property (atomic, assign) BOOL logsErrors</code></div>
  636. <div class="method-subsection declared-in-section">
  637. <h4 class="method-subtitle">Declared In</h4>
  638. <code class="declared-in-ref">FMDatabase.h</code><br />
  639. </div>
  640. </div>
  641. <div class="section-method">
  642. <a name="//api/name/traceExecution" title="traceExecution"></a>
  643. <h3 class="subsubtitle method-title">traceExecution</h3>
  644. <div class="method-subsection brief-description">
  645. <p>Whether should trace execution</p>
  646. </div>
  647. <div class="method-subsection method-declaration"><code>@property (atomic, assign) BOOL traceExecution</code></div>
  648. <div class="method-subsection declared-in-section">
  649. <h4 class="method-subtitle">Declared In</h4>
  650. <code class="declared-in-ref">FMDatabase.h</code><br />
  651. </div>
  652. </div>
  653. </div>
  654. <div class="section section-methods">
  655. <a title="Class Methods" name="class_methods"></a>
  656. <h2 class="subtitle subtitle-methods">Class Methods</h2>
  657. <div class="section-method">
  658. <a name="//api/name/databaseWithPath:" title="databaseWithPath:"></a>
  659. <h3 class="subsubtitle method-title">databaseWithPath:</h3>
  660. <div class="method-subsection brief-description">
  661. <p>Create a <code>FMDatabase</code> object.</p>
  662. </div>
  663. <div class="method-subsection method-declaration"><code>+ (instancetype)databaseWithPath:(NSString *)<em>inPath</em></code></div>
  664. <div class="method-subsection arguments-section parameters">
  665. <h4 class="method-subtitle parameter-title">Parameters</h4>
  666. <dl class="argument-def parameter-def">
  667. <dt><em>inPath</em></dt>
  668. <dd><p>Path of database file</p></dd>
  669. </dl>
  670. </div>
  671. <div class="method-subsection return">
  672. <h4 class="method-subtitle parameter-title">Return Value</h4>
  673. <p><code>FMDatabase</code> object if successful; <code>nil</code> if failure.</p>
  674. </div>
  675. <div class="method-subsection discussion-section">
  676. <h4 class="method-subtitle">Discussion</h4>
  677. <p>An <code>FMDatabase</code> is created with a path to a SQLite database file. This path can be one of these three:</p>
  678. <ol>
  679. <li>A file system path. The file does not have to exist on disk. If it does not exist, it is created for you.</li>
  680. <li>An empty string (<code>@""</code>). An empty database is created at a temporary location. This database is deleted with the <code>FMDatabase</code> connection is closed.</li>
  681. <li><code>nil</code>. An in-memory database is created. This database will be destroyed with the <code>FMDatabase</code> connection is closed.</li>
  682. </ol>
  683. <p>For example, to create/open a database in your Mac OS X <code>tmp</code> folder:</p>
  684. <pre><code>FMDatabase *db = [FMDatabase databaseWithPath:@"/tmp/tmp.db"];
  685. </code></pre>
  686. <p>Or, in iOS, you might open a database in the app&rsquo;s <code>Documents</code> directory:</p>
  687. <pre><code>NSString *docsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
  688. NSString *dbPath = [docsPath stringByAppendingPathComponent:@"test.db"];
  689. FMDatabase *db = [FMDatabase databaseWithPath:dbPath];
  690. </code></pre>
  691. <p>(For more information on temporary and in-memory databases, read the sqlite documentation on the subject: <a href="http://www.sqlite.org/inmemorydb.html">http://www.sqlite.org/inmemorydb.html</a>)</p>
  692. </div>
  693. <div class="method-subsection declared-in-section">
  694. <h4 class="method-subtitle">Declared In</h4>
  695. <code class="declared-in-ref">FMDatabase.h</code><br />
  696. </div>
  697. </div>
  698. <div class="section-method">
  699. <a name="//api/name/isSQLiteThreadSafe" title="isSQLiteThreadSafe"></a>
  700. <h3 class="subsubtitle method-title">isSQLiteThreadSafe</h3>
  701. <div class="method-subsection brief-description">
  702. <p>Test to see if the library is threadsafe</p>
  703. </div>
  704. <div class="method-subsection method-declaration"><code>+ (BOOL)isSQLiteThreadSafe</code></div>
  705. <div class="method-subsection return">
  706. <h4 class="method-subtitle parameter-title">Return Value</h4>
  707. <p>Zero if and only if SQLite was compiled with mutexing code omitted due to the SQLITE_THREADSAFE compile-time option being set to 0.</p>
  708. </div>
  709. <div class="method-subsection see-also-section">
  710. <h4 class="method-subtitle">See Also</h4>
  711. <ul>
  712. <li><code><p><a href="http://sqlite.org/c3ref/threadsafe.html">sqlite3_threadsafe()</a></p></code></li>
  713. </ul>
  714. </div>
  715. <div class="method-subsection declared-in-section">
  716. <h4 class="method-subtitle">Declared In</h4>
  717. <code class="declared-in-ref">FMDatabase.h</code><br />
  718. </div>
  719. </div>
  720. <div class="section-method">
  721. <a name="//api/name/sqliteLibVersion" title="sqliteLibVersion"></a>
  722. <h3 class="subsubtitle method-title">sqliteLibVersion</h3>
  723. <div class="method-subsection brief-description">
  724. <p>Run-time library version numbers</p>
  725. </div>
  726. <div class="method-subsection method-declaration"><code>+ (NSString *)sqliteLibVersion</code></div>
  727. <div class="method-subsection see-also-section">
  728. <h4 class="method-subtitle">See Also</h4>
  729. <ul>
  730. <li><code><p><a href="http://sqlite.org/c3ref/libversion.html">sqlite3_libversion()</a></p></code></li>
  731. </ul>
  732. </div>
  733. <div class="method-subsection declared-in-section">
  734. <h4 class="method-subtitle">Declared In</h4>
  735. <code class="declared-in-ref">FMDatabase.h</code><br />
  736. </div>
  737. </div>
  738. <div class="section-method">
  739. <a name="//api/name/storeableDateFormat:" title="storeableDateFormat:"></a>
  740. <h3 class="subsubtitle method-title">storeableDateFormat:</h3>
  741. <div class="method-subsection brief-description">
  742. <p>Generate an <code>NSDateFormatter</code> that won&rsquo;t be broken by permutations of timezones or locales.</p>
  743. </div>
  744. <div class="method-subsection method-declaration"><code>+ (NSDateFormatter *)storeableDateFormat:(NSString *)<em>format</em></code></div>
  745. <div class="method-subsection arguments-section parameters">
  746. <h4 class="method-subtitle parameter-title">Parameters</h4>
  747. <dl class="argument-def parameter-def">
  748. <dt><em>format</em></dt>
  749. <dd><p>A valid NSDateFormatter format string.</p></dd>
  750. </dl>
  751. </div>
  752. <div class="method-subsection return">
  753. <h4 class="method-subtitle parameter-title">Return Value</h4>
  754. <p>A <code>NSDateFormatter</code> that can be used for converting dates to strings and vice versa.</p>
  755. </div>
  756. <div class="method-subsection discussion-section">
  757. <h4 class="method-subtitle">Discussion</h4>
  758. <p>Use this method to generate values to set the dateFormat property.</p>
  759. <p>Example:</p>
  760. <pre><code>myDB.dateFormat = [FMDatabase storeableDateFormat:@"yyyy-MM-dd HH:mm:ss"];
  761. </code></pre><div class="warning"><p><strong>Warning:</strong> Note that <code>NSDateFormatter</code> is not thread-safe, so the formatter generated by this method should be assigned to only one FMDB instance and should not be used for other purposes.</p></div>
  762. </div>
  763. <div class="method-subsection see-also-section">
  764. <h4 class="method-subtitle">See Also</h4>
  765. <ul>
  766. <li><code><p><a href="#//api/name/hasDateFormatter">- hasDateFormatter</a></p></code></li>
  767. <li><code><p><a href="#//api/name/setDateFormat:">- setDateFormat:</a></p></code></li>
  768. <li><code><p><a href="#//api/name/dateFromString:">- dateFromString:</a></p></code></li>
  769. <li><code><p><a href="#//api/name/stringFromDate:">- stringFromDate:</a></p></code></li>
  770. <li><code><p><a href="#//api/name/storeableDateFormat:">+ storeableDateFormat:</a></p></code></li>
  771. </ul>
  772. </div>
  773. <div class="method-subsection declared-in-section">
  774. <h4 class="method-subtitle">Declared In</h4>
  775. <code class="declared-in-ref">FMDatabase.h</code><br />
  776. </div>
  777. </div>
  778. </div>
  779. <div class="section section-methods">
  780. <a title="Instance Methods" name="instance_methods"></a>
  781. <h2 class="subtitle subtitle-methods">Instance Methods</h2>
  782. <div class="section-method">
  783. <a name="//api/name/beginDeferredTransaction" title="beginDeferredTransaction"></a>
  784. <h3 class="subsubtitle method-title">beginDeferredTransaction</h3>
  785. <div class="method-subsection brief-description">
  786. <p>Begin a deferred transaction</p>
  787. </div>
  788. <div class="method-subsection method-declaration"><code>- (BOOL)beginDeferredTransaction</code></div>
  789. <div class="method-subsection return">
  790. <h4 class="method-subtitle parameter-title">Return Value</h4>
  791. <p><code>YES</code> on success; <code>NO</code> on failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  792. </div>
  793. <div class="method-subsection see-also-section">
  794. <h4 class="method-subtitle">See Also</h4>
  795. <ul>
  796. <li><code><p><a href="#//api/name/commit">- commit</a></p></code></li>
  797. <li><code><p><a href="#//api/name/rollback">- rollback</a></p></code></li>
  798. <li><code><p><a href="#//api/name/beginTransaction">- beginTransaction</a></p></code></li>
  799. <li><code><p><a href="#//api/name/inTransaction">- inTransaction</a></p></code></li>
  800. </ul>
  801. </div>
  802. <div class="method-subsection declared-in-section">
  803. <h4 class="method-subtitle">Declared In</h4>
  804. <code class="declared-in-ref">FMDatabase.h</code><br />
  805. </div>
  806. </div>
  807. <div class="section-method">
  808. <a name="//api/name/beginTransaction" title="beginTransaction"></a>
  809. <h3 class="subsubtitle method-title">beginTransaction</h3>
  810. <div class="method-subsection brief-description">
  811. <p>Begin a transaction</p>
  812. </div>
  813. <div class="method-subsection method-declaration"><code>- (BOOL)beginTransaction</code></div>
  814. <div class="method-subsection return">
  815. <h4 class="method-subtitle parameter-title">Return Value</h4>
  816. <p><code>YES</code> on success; <code>NO</code> on failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  817. </div>
  818. <div class="method-subsection see-also-section">
  819. <h4 class="method-subtitle">See Also</h4>
  820. <ul>
  821. <li><code><p><a href="#//api/name/commit">- commit</a></p></code></li>
  822. <li><code><p><a href="#//api/name/rollback">- rollback</a></p></code></li>
  823. <li><code><p><a href="#//api/name/beginDeferredTransaction">- beginDeferredTransaction</a></p></code></li>
  824. <li><code><p><a href="#//api/name/inTransaction">- inTransaction</a></p></code></li>
  825. </ul>
  826. </div>
  827. <div class="method-subsection declared-in-section">
  828. <h4 class="method-subtitle">Declared In</h4>
  829. <code class="declared-in-ref">FMDatabase.h</code><br />
  830. </div>
  831. </div>
  832. <div class="section-method">
  833. <a name="//api/name/changes" title="changes"></a>
  834. <h3 class="subsubtitle method-title">changes</h3>
  835. <div class="method-subsection brief-description">
  836. <p>The number of rows changed by prior SQL statement.</p>
  837. </div>
  838. <div class="method-subsection method-declaration"><code>- (int)changes</code></div>
  839. <div class="method-subsection discussion-section">
  840. <h4 class="method-subtitle">Discussion</h4>
  841. <p>This function returns the number of database rows that were changed or inserted or deleted by the most recently completed SQL statement on the database connection specified by the first parameter. Only changes that are directly specified by the INSERT, UPDATE, or DELETE statement are counted.</p>
  842. </div>
  843. <div class="method-subsection see-also-section">
  844. <h4 class="method-subtitle">See Also</h4>
  845. <ul>
  846. <li><code><p><a href="http://sqlite.org/c3ref/changes.html">sqlite3_changes()</a></p></code></li>
  847. </ul>
  848. </div>
  849. <div class="method-subsection declared-in-section">
  850. <h4 class="method-subtitle">Declared In</h4>
  851. <code class="declared-in-ref">FMDatabase.h</code><br />
  852. </div>
  853. </div>
  854. <div class="section-method">
  855. <a name="//api/name/clearCachedStatements" title="clearCachedStatements"></a>
  856. <h3 class="subsubtitle method-title">clearCachedStatements</h3>
  857. <div class="method-subsection brief-description">
  858. <p>Clear cached statements</p>
  859. </div>
  860. <div class="method-subsection method-declaration"><code>- (void)clearCachedStatements</code></div>
  861. <div class="method-subsection declared-in-section">
  862. <h4 class="method-subtitle">Declared In</h4>
  863. <code class="declared-in-ref">FMDatabase.h</code><br />
  864. </div>
  865. </div>
  866. <div class="section-method">
  867. <a name="//api/name/close" title="close"></a>
  868. <h3 class="subsubtitle method-title">close</h3>
  869. <div class="method-subsection brief-description">
  870. <p>Closing a database connection</p>
  871. </div>
  872. <div class="method-subsection method-declaration"><code>- (BOOL)close</code></div>
  873. <div class="method-subsection return">
  874. <h4 class="method-subtitle parameter-title">Return Value</h4>
  875. <p><code>YES</code> if success, <code>NO</code> on error.</p>
  876. </div>
  877. <div class="method-subsection see-also-section">
  878. <h4 class="method-subtitle">See Also</h4>
  879. <ul>
  880. <li><code><p><a href="http://sqlite.org/c3ref/close.html">sqlite3_close()</a></p></code></li>
  881. <li><code><p><a href="#//api/name/open">- open</a></p></code></li>
  882. <li><code><p><a href="#//api/name/openWithFlags:">- openWithFlags:</a></p></code></li>
  883. </ul>
  884. </div>
  885. <div class="method-subsection declared-in-section">
  886. <h4 class="method-subtitle">Declared In</h4>
  887. <code class="declared-in-ref">FMDatabase.h</code><br />
  888. </div>
  889. </div>
  890. <div class="section-method">
  891. <a name="//api/name/closeOpenResultSets" title="closeOpenResultSets"></a>
  892. <h3 class="subsubtitle method-title">closeOpenResultSets</h3>
  893. <div class="method-subsection brief-description">
  894. <p>Close all open result sets</p>
  895. </div>
  896. <div class="method-subsection method-declaration"><code>- (void)closeOpenResultSets</code></div>
  897. <div class="method-subsection declared-in-section">
  898. <h4 class="method-subtitle">Declared In</h4>
  899. <code class="declared-in-ref">FMDatabase.h</code><br />
  900. </div>
  901. </div>
  902. <div class="section-method">
  903. <a name="//api/name/commit" title="commit"></a>
  904. <h3 class="subsubtitle method-title">commit</h3>
  905. <div class="method-subsection brief-description">
  906. <p>Commit a transaction</p>
  907. </div>
  908. <div class="method-subsection method-declaration"><code>- (BOOL)commit</code></div>
  909. <div class="method-subsection return">
  910. <h4 class="method-subtitle parameter-title">Return Value</h4>
  911. <p><code>YES</code> on success; <code>NO</code> on failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  912. </div>
  913. <div class="method-subsection discussion-section">
  914. <h4 class="method-subtitle">Discussion</h4>
  915. <p>Commit a transaction that was initiated with either <a href="#//api/name/beginTransaction"><code>beginTransaction</code></a> or with <a href="#//api/name/beginDeferredTransaction"><code>beginDeferredTransaction</code></a>.</p>
  916. </div>
  917. <div class="method-subsection see-also-section">
  918. <h4 class="method-subtitle">See Also</h4>
  919. <ul>
  920. <li><code><p><a href="#//api/name/beginTransaction">- beginTransaction</a></p></code></li>
  921. <li><code><p><a href="#//api/name/beginDeferredTransaction">- beginDeferredTransaction</a></p></code></li>
  922. <li><code><p><a href="#//api/name/rollback">- rollback</a></p></code></li>
  923. <li><code><p><a href="#//api/name/inTransaction">- inTransaction</a></p></code></li>
  924. </ul>
  925. </div>
  926. <div class="method-subsection declared-in-section">
  927. <h4 class="method-subtitle">Declared In</h4>
  928. <code class="declared-in-ref">FMDatabase.h</code><br />
  929. </div>
  930. </div>
  931. <div class="section-method">
  932. <a name="//api/name/databasePath" title="databasePath"></a>
  933. <h3 class="subsubtitle method-title">databasePath</h3>
  934. <div class="method-subsection brief-description">
  935. <p>The path of the database file</p>
  936. </div>
  937. <div class="method-subsection method-declaration"><code>- (NSString *)databasePath</code></div>
  938. <div class="method-subsection return">
  939. <h4 class="method-subtitle parameter-title">Return Value</h4>
  940. <p>path of database.</p>
  941. </div>
  942. <div class="method-subsection declared-in-section">
  943. <h4 class="method-subtitle">Declared In</h4>
  944. <code class="declared-in-ref">FMDatabase.h</code><br />
  945. </div>
  946. </div>
  947. <div class="section-method">
  948. <a name="//api/name/dateFromString:" title="dateFromString:"></a>
  949. <h3 class="subsubtitle method-title">dateFromString:</h3>
  950. <div class="method-subsection brief-description">
  951. <p>Convert the supplied NSString to NSDate, using the current database formatter.</p>
  952. </div>
  953. <div class="method-subsection method-declaration"><code>- (NSDate *)dateFromString:(NSString *)<em>s</em></code></div>
  954. <div class="method-subsection arguments-section parameters">
  955. <h4 class="method-subtitle parameter-title">Parameters</h4>
  956. <dl class="argument-def parameter-def">
  957. <dt><em>s</em></dt>
  958. <dd><p><code>NSString</code> to convert to <code>NSDate</code>.</p></dd>
  959. </dl>
  960. </div>
  961. <div class="method-subsection return">
  962. <h4 class="method-subtitle parameter-title">Return Value</h4>
  963. <p><code>nil</code> if no formatter is set.</p>
  964. </div>
  965. <div class="method-subsection see-also-section">
  966. <h4 class="method-subtitle">See Also</h4>
  967. <ul>
  968. <li><code><p><a href="#//api/name/hasDateFormatter">- hasDateFormatter</a></p></code></li>
  969. <li><code><p><a href="#//api/name/setDateFormat:">- setDateFormat:</a></p></code></li>
  970. <li><code><p><a href="#//api/name/dateFromString:">- dateFromString:</a></p></code></li>
  971. <li><code><p><a href="#//api/name/stringFromDate:">- stringFromDate:</a></p></code></li>
  972. <li><code><p><a href="#//api/name/storeableDateFormat:">+ storeableDateFormat:</a></p></code></li>
  973. </ul>
  974. </div>
  975. <div class="method-subsection declared-in-section">
  976. <h4 class="method-subtitle">Declared In</h4>
  977. <code class="declared-in-ref">FMDatabase.h</code><br />
  978. </div>
  979. </div>
  980. <div class="section-method">
  981. <a name="//api/name/executeQuery:" title="executeQuery:"></a>
  982. <h3 class="subsubtitle method-title">executeQuery:</h3>
  983. <div class="method-subsection brief-description">
  984. <p>Execute select statement</p>
  985. </div>
  986. <div class="method-subsection method-declaration"><code>- (FMResultSet *)executeQuery:(NSString *)<em>sql</em>, <em>...</em></code></div>
  987. <div class="method-subsection arguments-section parameters">
  988. <h4 class="method-subtitle parameter-title">Parameters</h4>
  989. <dl class="argument-def parameter-def">
  990. <dt><em>sql</em></dt>
  991. <dd><p>The SELECT statement to be performed, with optional <code>?</code> placeholders.</p></dd>
  992. </dl>
  993. <dl class="argument-def parameter-def">
  994. <dt><em>...</em></dt>
  995. <dd><p>Optional parameters to bind to <code>?</code> placeholders in the SQL statement. These should be Objective-C objects (e.g. <code>NSString</code>, <code>NSNumber</code>, etc.), not fundamental C data types (e.g. <code>int</code>, <code>char *</code>, etc.).</p></dd>
  996. </dl>
  997. </div>
  998. <div class="method-subsection return">
  999. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1000. <p>A <a href="../Classes/FMResultSet.html"><code>FMResultSet</code></a> for the result set upon success; <code>nil</code> upon failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  1001. </div>
  1002. <div class="method-subsection discussion-section">
  1003. <h4 class="method-subtitle">Discussion</h4>
  1004. <p>Executing queries returns an <a href="../Classes/FMResultSet.html"><code>FMResultSet</code></a> object if successful, and <code>nil</code> upon failure. Like executing updates, there is a variant that accepts an <code>NSError **</code> parameter. Otherwise you should use the <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> and <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> methods to determine why a query failed.</p>
  1005. <p>In order to iterate through the results of your query, you use a <code>while()</code> loop. You also need to &ldquo;step&rdquo; (via <a href="../Classes/FMResultSet.html#//api/name/next"><code>[FMResultSet next]</code></a>) from one record to the other.</p>
  1006. <p>This method employs <a href="http://sqlite.org/c3ref/bind_blob.html"><code>sqlite3_bind</code></a> for any optional value parameters. This properly escapes any characters that need escape sequences (e.g. quotation marks), which eliminates simple SQL errors as well as protects against SQL injection attacks. This method natively handles <code>NSString</code>, <code>NSNumber</code>, <code>NSNull</code>, <code>NSDate</code>, and <code>NSData</code> objects. All other object types will be interpreted as text values using the object&rsquo;s <code>description</code> method.</p>
  1007. </div>
  1008. <div class="method-subsection see-also-section">
  1009. <h4 class="method-subtitle">See Also</h4>
  1010. <ul>
  1011. <li><code><p><a href="../Classes/FMResultSet.html">FMResultSet</a></p></code></li>
  1012. <li><code><p><a href="../Classes/FMResultSet.html#//api/name/next"><code>FMResultSet next</code></a></p></code></li>
  1013. <li><code><p><a href="http://sqlite.org/c3ref/bind_blob.html"><code>sqlite3_bind</code></a></p></code></li>
  1014. </ul>
  1015. </div>
  1016. <div class="method-subsection declared-in-section">
  1017. <h4 class="method-subtitle">Declared In</h4>
  1018. <code class="declared-in-ref">FMDatabase.h</code><br />
  1019. </div>
  1020. </div>
  1021. <div class="section-method">
  1022. <a name="//api/name/executeQuery:withArgumentsInArray:" title="executeQuery:withArgumentsInArray:"></a>
  1023. <h3 class="subsubtitle method-title">executeQuery:withArgumentsInArray:</h3>
  1024. <div class="method-subsection brief-description">
  1025. <p>Execute select statement</p>
  1026. </div>
  1027. <div class="method-subsection method-declaration"><code>- (FMResultSet *)executeQuery:(NSString *)<em>sql</em> withArgumentsInArray:(NSArray *)<em>arguments</em></code></div>
  1028. <div class="method-subsection arguments-section parameters">
  1029. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1030. <dl class="argument-def parameter-def">
  1031. <dt><em>sql</em></dt>
  1032. <dd><p>The SELECT statement to be performed, with optional <code>?</code> placeholders.</p></dd>
  1033. </dl>
  1034. <dl class="argument-def parameter-def">
  1035. <dt><em>arguments</em></dt>
  1036. <dd><p>A <code>NSArray</code> of objects to be used when binding values to the <code>?</code> placeholders in the SQL statement.</p></dd>
  1037. </dl>
  1038. </div>
  1039. <div class="method-subsection return">
  1040. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1041. <p>A <a href="../Classes/FMResultSet.html"><code>FMResultSet</code></a> for the result set upon success; <code>nil</code> upon failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  1042. </div>
  1043. <div class="method-subsection discussion-section">
  1044. <h4 class="method-subtitle">Discussion</h4>
  1045. <p>Executing queries returns an <a href="../Classes/FMResultSet.html"><code>FMResultSet</code></a> object if successful, and <code>nil</code> upon failure. Like executing updates, there is a variant that accepts an <code>NSError **</code> parameter. Otherwise you should use the <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> and <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> methods to determine why a query failed.</p>
  1046. <p>In order to iterate through the results of your query, you use a <code>while()</code> loop. You also need to &ldquo;step&rdquo; (via <a href="../Classes/FMResultSet.html#//api/name/next"><code>[FMResultSet next]</code></a>) from one record to the other.</p>
  1047. </div>
  1048. <div class="method-subsection see-also-section">
  1049. <h4 class="method-subtitle">See Also</h4>
  1050. <ul>
  1051. <li><code><p><a href="../Classes/FMResultSet.html">FMResultSet</a></p></code></li>
  1052. <li><code><p><a href="../Classes/FMResultSet.html#//api/name/next"><code>FMResultSet next</code></a></p></code></li>
  1053. </ul>
  1054. </div>
  1055. <div class="method-subsection declared-in-section">
  1056. <h4 class="method-subtitle">Declared In</h4>
  1057. <code class="declared-in-ref">FMDatabase.h</code><br />
  1058. </div>
  1059. </div>
  1060. <div class="section-method">
  1061. <a name="//api/name/executeQuery:withParameterDictionary:" title="executeQuery:withParameterDictionary:"></a>
  1062. <h3 class="subsubtitle method-title">executeQuery:withParameterDictionary:</h3>
  1063. <div class="method-subsection brief-description">
  1064. <p>Execute select statement</p>
  1065. </div>
  1066. <div class="method-subsection method-declaration"><code>- (FMResultSet *)executeQuery:(NSString *)<em>sql</em> withParameterDictionary:(NSDictionary *)<em>arguments</em></code></div>
  1067. <div class="method-subsection arguments-section parameters">
  1068. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1069. <dl class="argument-def parameter-def">
  1070. <dt><em>sql</em></dt>
  1071. <dd><p>The SELECT statement to be performed, with optional <code>?</code> placeholders.</p></dd>
  1072. </dl>
  1073. <dl class="argument-def parameter-def">
  1074. <dt><em>arguments</em></dt>
  1075. <dd><p>A <code>NSDictionary</code> of objects keyed by column names that will be used when binding values to the <code>?</code> placeholders in the SQL statement.</p></dd>
  1076. </dl>
  1077. </div>
  1078. <div class="method-subsection return">
  1079. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1080. <p>A <a href="../Classes/FMResultSet.html"><code>FMResultSet</code></a> for the result set upon success; <code>nil</code> upon failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  1081. </div>
  1082. <div class="method-subsection discussion-section">
  1083. <h4 class="method-subtitle">Discussion</h4>
  1084. <p>Executing queries returns an <a href="../Classes/FMResultSet.html"><code>FMResultSet</code></a> object if successful, and <code>nil</code> upon failure. Like executing updates, there is a variant that accepts an <code>NSError **</code> parameter. Otherwise you should use the <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> and <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> methods to determine why a query failed.</p>
  1085. <p>In order to iterate through the results of your query, you use a <code>while()</code> loop. You also need to &ldquo;step&rdquo; (via <a href="../Classes/FMResultSet.html#//api/name/next"><code>[FMResultSet next]</code></a>) from one record to the other.</p>
  1086. </div>
  1087. <div class="method-subsection see-also-section">
  1088. <h4 class="method-subtitle">See Also</h4>
  1089. <ul>
  1090. <li><code><p><a href="../Classes/FMResultSet.html">FMResultSet</a></p></code></li>
  1091. <li><code><p><a href="../Classes/FMResultSet.html#//api/name/next"><code>FMResultSet next</code></a></p></code></li>
  1092. </ul>
  1093. </div>
  1094. <div class="method-subsection declared-in-section">
  1095. <h4 class="method-subtitle">Declared In</h4>
  1096. <code class="declared-in-ref">FMDatabase.h</code><br />
  1097. </div>
  1098. </div>
  1099. <div class="section-method">
  1100. <a name="//api/name/executeQueryWithFormat:" title="executeQueryWithFormat:"></a>
  1101. <h3 class="subsubtitle method-title">executeQueryWithFormat:</h3>
  1102. <div class="method-subsection brief-description">
  1103. <p>Execute select statement</p>
  1104. </div>
  1105. <div class="method-subsection method-declaration"><code>- (FMResultSet *)executeQueryWithFormat:(NSString *)<em>format</em>, <em>...</em></code></div>
  1106. <div class="method-subsection arguments-section parameters">
  1107. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1108. <dl class="argument-def parameter-def">
  1109. <dt><em>format</em></dt>
  1110. <dd><p>The SQL to be performed, with <code>printf</code>-style escape sequences.</p></dd>
  1111. </dl>
  1112. <dl class="argument-def parameter-def">
  1113. <dt><em>...</em></dt>
  1114. <dd><p>Optional parameters to bind to use in conjunction with the <code>printf</code>-style escape sequences in the SQL statement.</p></dd>
  1115. </dl>
  1116. </div>
  1117. <div class="method-subsection return">
  1118. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1119. <p>A <a href="../Classes/FMResultSet.html"><code>FMResultSet</code></a> for the result set upon success; <code>nil</code> upon failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  1120. </div>
  1121. <div class="method-subsection discussion-section">
  1122. <h4 class="method-subtitle">Discussion</h4>
  1123. <p>Executing queries returns an <a href="../Classes/FMResultSet.html"><code>FMResultSet</code></a> object if successful, and <code>nil</code> upon failure. Like executing updates, there is a variant that accepts an <code>NSError **</code> parameter. Otherwise you should use the <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> and <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> methods to determine why a query failed.</p>
  1124. <p>In order to iterate through the results of your query, you use a <code>while()</code> loop. You also need to &ldquo;step&rdquo; (via <a href="../Classes/FMResultSet.html#//api/name/next"><code>[FMResultSet next]</code></a>) from one record to the other.</p><div class="warning"><p><strong>Warning:</strong> This should be used with great care. Generally, instead of this method, you should use <a href="#//api/name/executeQuery:"><code>executeQuery:</code></a> (with <code>?</code> placeholders in the SQL), which properly escapes quotation marks encountered inside the values (minimizing errors and protecting against SQL injection attack) and handles a wider variety of data types. See <a href="#//api/name/executeQuery:"><code>executeQuery:</code></a> for more information.</p></div>
  1125. </div>
  1126. <div class="method-subsection see-also-section">
  1127. <h4 class="method-subtitle">See Also</h4>
  1128. <ul>
  1129. <li><code><p><a href="#//api/name/executeQuery:">- executeQuery:</a></p></code></li>
  1130. <li><code><p><a href="../Classes/FMResultSet.html">FMResultSet</a></p></code></li>
  1131. <li><code><p><a href="../Classes/FMResultSet.html#//api/name/next"><code>FMResultSet next</code></a></p></code></li>
  1132. </ul>
  1133. </div>
  1134. <div class="method-subsection declared-in-section">
  1135. <h4 class="method-subtitle">Declared In</h4>
  1136. <code class="declared-in-ref">FMDatabase.h</code><br />
  1137. </div>
  1138. </div>
  1139. <div class="section-method">
  1140. <a name="//api/name/executeUpdate:" title="executeUpdate:"></a>
  1141. <h3 class="subsubtitle method-title">executeUpdate:</h3>
  1142. <div class="method-subsection brief-description">
  1143. <p>Execute update statement</p>
  1144. </div>
  1145. <div class="method-subsection method-declaration"><code>- (BOOL)executeUpdate:(NSString *)<em>sql</em>, <em>...</em></code></div>
  1146. <div class="method-subsection arguments-section parameters">
  1147. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1148. <dl class="argument-def parameter-def">
  1149. <dt><em>sql</em></dt>
  1150. <dd><p>The SQL to be performed, with optional <code>?</code> placeholders.</p></dd>
  1151. </dl>
  1152. <dl class="argument-def parameter-def">
  1153. <dt><em>...</em></dt>
  1154. <dd><p>Optional parameters to bind to <code>?</code> placeholders in the SQL statement. These should be Objective-C objects (e.g. <code>NSString</code>, <code>NSNumber</code>, etc.), not fundamental C data types (e.g. <code>int</code>, <code>char *</code>, etc.).</p></dd>
  1155. </dl>
  1156. </div>
  1157. <div class="method-subsection return">
  1158. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1159. <p><code>YES</code> upon success; <code>NO</code> upon failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  1160. </div>
  1161. <div class="method-subsection discussion-section">
  1162. <h4 class="method-subtitle">Discussion</h4>
  1163. <p>This method employs <a href="http://sqlite.org/c3ref/bind_blob.html"><code>sqlite3_bind</code></a> for any optional value parameters. This properly escapes any characters that need escape sequences (e.g. quotation marks), which eliminates simple SQL errors as well as protects against SQL injection attacks. This method natively handles <code>NSString</code>, <code>NSNumber</code>, <code>NSNull</code>, <code>NSDate</code>, and <code>NSData</code> objects. All other object types will be interpreted as text values using the object&rsquo;s <code>description</code> method.</p>
  1164. </div>
  1165. <div class="method-subsection see-also-section">
  1166. <h4 class="method-subtitle">See Also</h4>
  1167. <ul>
  1168. <li><code><p><a href="#//api/name/lastError">- lastError</a></p></code></li>
  1169. <li><code><p><a href="#//api/name/lastErrorCode">- lastErrorCode</a></p></code></li>
  1170. <li><code><p><a href="#//api/name/lastErrorMessage">- lastErrorMessage</a></p></code></li>
  1171. <li><code><p><a href="http://sqlite.org/c3ref/bind_blob.html"><code>sqlite3_bind</code></a></p></code></li>
  1172. </ul>
  1173. </div>
  1174. <div class="method-subsection declared-in-section">
  1175. <h4 class="method-subtitle">Declared In</h4>
  1176. <code class="declared-in-ref">FMDatabase.h</code><br />
  1177. </div>
  1178. </div>
  1179. <div class="section-method">
  1180. <a name="//api/name/executeUpdate:withArgumentsInArray:" title="executeUpdate:withArgumentsInArray:"></a>
  1181. <h3 class="subsubtitle method-title">executeUpdate:withArgumentsInArray:</h3>
  1182. <div class="method-subsection brief-description">
  1183. <p>Execute update statement</p>
  1184. </div>
  1185. <div class="method-subsection method-declaration"><code>- (BOOL)executeUpdate:(NSString *)<em>sql</em> withArgumentsInArray:(NSArray *)<em>arguments</em></code></div>
  1186. <div class="method-subsection arguments-section parameters">
  1187. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1188. <dl class="argument-def parameter-def">
  1189. <dt><em>sql</em></dt>
  1190. <dd><p>The SQL to be performed, with optional <code>?</code> placeholders.</p></dd>
  1191. </dl>
  1192. <dl class="argument-def parameter-def">
  1193. <dt><em>arguments</em></dt>
  1194. <dd><p>A <code>NSArray</code> of objects to be used when binding values to the <code>?</code> placeholders in the SQL statement.</p></dd>
  1195. </dl>
  1196. </div>
  1197. <div class="method-subsection return">
  1198. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1199. <p><code>YES</code> upon success; <code>NO</code> upon failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  1200. </div>
  1201. <div class="method-subsection discussion-section">
  1202. <h4 class="method-subtitle">Discussion</h4>
  1203. <p>Any sort of SQL statement which is not a <code>SELECT</code> statement qualifies as an update. This includes <code>CREATE</code>, <code>UPDATE</code>, <code>INSERT</code>, <code>ALTER</code>, <code>COMMIT</code>, <code>BEGIN</code>, <code>DETACH</code>, <code>DELETE</code>, <code>DROP</code>, <code>END</code>, <code>EXPLAIN</code>, <code>VACUUM</code>, and <code>REPLACE</code> statements (plus many more). Basically, if your SQL statement does not begin with <code>SELECT</code>, it is an update statement.</p>
  1204. </div>
  1205. <div class="method-subsection see-also-section">
  1206. <h4 class="method-subtitle">See Also</h4>
  1207. <ul>
  1208. <li><code><p><a href="#//api/name/lastError">- lastError</a></p></code></li>
  1209. <li><code><p><a href="#//api/name/lastErrorCode">- lastErrorCode</a></p></code></li>
  1210. <li><code><p><a href="#//api/name/lastErrorMessage">- lastErrorMessage</a></p></code></li>
  1211. </ul>
  1212. </div>
  1213. <div class="method-subsection declared-in-section">
  1214. <h4 class="method-subtitle">Declared In</h4>
  1215. <code class="declared-in-ref">FMDatabase.h</code><br />
  1216. </div>
  1217. </div>
  1218. <div class="section-method">
  1219. <a name="//api/name/executeUpdate:withParameterDictionary:" title="executeUpdate:withParameterDictionary:"></a>
  1220. <h3 class="subsubtitle method-title">executeUpdate:withParameterDictionary:</h3>
  1221. <div class="method-subsection brief-description">
  1222. <p>Execute update statement</p>
  1223. </div>
  1224. <div class="method-subsection method-declaration"><code>- (BOOL)executeUpdate:(NSString *)<em>sql</em> withParameterDictionary:(NSDictionary *)<em>arguments</em></code></div>
  1225. <div class="method-subsection arguments-section parameters">
  1226. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1227. <dl class="argument-def parameter-def">
  1228. <dt><em>sql</em></dt>
  1229. <dd><p>The SQL to be performed, with optional <code>?</code> placeholders.</p></dd>
  1230. </dl>
  1231. <dl class="argument-def parameter-def">
  1232. <dt><em>arguments</em></dt>
  1233. <dd><p>A <code>NSDictionary</code> of objects keyed by column names that will be used when binding values to the <code>?</code> placeholders in the SQL statement.</p></dd>
  1234. </dl>
  1235. </div>
  1236. <div class="method-subsection return">
  1237. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1238. <p><code>YES</code> upon success; <code>NO</code> upon failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  1239. </div>
  1240. <div class="method-subsection discussion-section">
  1241. <h4 class="method-subtitle">Discussion</h4>
  1242. <p>Any sort of SQL statement which is not a <code>SELECT</code> statement qualifies as an update. This includes <code>CREATE</code>, <code>UPDATE</code>, <code>INSERT</code>, <code>ALTER</code>, <code>COMMIT</code>, <code>BEGIN</code>, <code>DETACH</code>, <code>DELETE</code>, <code>DROP</code>, <code>END</code>, <code>EXPLAIN</code>, <code>VACUUM</code>, and <code>REPLACE</code> statements (plus many more). Basically, if your SQL statement does not begin with <code>SELECT</code>, it is an update statement.</p>
  1243. </div>
  1244. <div class="method-subsection see-also-section">
  1245. <h4 class="method-subtitle">See Also</h4>
  1246. <ul>
  1247. <li><code><p><a href="#//api/name/lastError">- lastError</a></p></code></li>
  1248. <li><code><p><a href="#//api/name/lastErrorCode">- lastErrorCode</a></p></code></li>
  1249. <li><code><p><a href="#//api/name/lastErrorMessage">- lastErrorMessage</a></p></code></li>
  1250. </ul>
  1251. </div>
  1252. <div class="method-subsection declared-in-section">
  1253. <h4 class="method-subtitle">Declared In</h4>
  1254. <code class="declared-in-ref">FMDatabase.h</code><br />
  1255. </div>
  1256. </div>
  1257. <div class="section-method">
  1258. <a name="//api/name/executeUpdateWithFormat:" title="executeUpdateWithFormat:"></a>
  1259. <h3 class="subsubtitle method-title">executeUpdateWithFormat:</h3>
  1260. <div class="method-subsection brief-description">
  1261. <p>Execute update statement</p>
  1262. </div>
  1263. <div class="method-subsection method-declaration"><code>- (BOOL)executeUpdateWithFormat:(NSString *)<em>format</em>, <em>...</em></code></div>
  1264. <div class="method-subsection arguments-section parameters">
  1265. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1266. <dl class="argument-def parameter-def">
  1267. <dt><em>format</em></dt>
  1268. <dd><p>The SQL to be performed, with <code>printf</code>-style escape sequences.</p></dd>
  1269. </dl>
  1270. <dl class="argument-def parameter-def">
  1271. <dt><em>...</em></dt>
  1272. <dd><p>Optional parameters to bind to use in conjunction with the <code>printf</code>-style escape sequences in the SQL statement.</p></dd>
  1273. </dl>
  1274. </div>
  1275. <div class="method-subsection return">
  1276. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1277. <p><code>YES</code> upon success; <code>NO</code> upon failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  1278. </div>
  1279. <div class="method-subsection discussion-section">
  1280. <h4 class="method-subtitle">Discussion</h4>
  1281. <p>Any sort of SQL statement which is not a <code>SELECT</code> statement qualifies as an update. This includes <code>CREATE</code>, <code>UPDATE</code>, <code>INSERT</code>, <code>ALTER</code>, <code>COMMIT</code>, <code>BEGIN</code>, <code>DETACH</code>, <code>DELETE</code>, <code>DROP</code>, <code>END</code>, <code>EXPLAIN</code>, <code>VACUUM</code>, and <code>REPLACE</code> statements (plus many more). Basically, if your SQL statement does not begin with <code>SELECT</code>, it is an update statement.</p><div class="warning"><p><strong>Warning:</strong> This should be used with great care. Generally, instead of this method, you should use <a href="#//api/name/executeUpdate:"><code>executeUpdate:</code></a> (with <code>?</code> placeholders in the SQL), which properly escapes quotation marks encountered inside the values (minimizing errors and protecting against SQL injection attack) and handles a wider variety of data types. See <a href="#//api/name/executeUpdate:"><code>executeUpdate:</code></a> for more information.</p></div>
  1282. </div>
  1283. <div class="method-subsection see-also-section">
  1284. <h4 class="method-subtitle">See Also</h4>
  1285. <ul>
  1286. <li><code><p><a href="#//api/name/executeUpdate:">- executeUpdate:</a></p></code></li>
  1287. <li><code><p><a href="#//api/name/lastError">- lastError</a></p></code></li>
  1288. <li><code><p><a href="#//api/name/lastErrorCode">- lastErrorCode</a></p></code></li>
  1289. <li><code><p><a href="#//api/name/lastErrorMessage">- lastErrorMessage</a></p></code></li>
  1290. </ul>
  1291. </div>
  1292. <div class="method-subsection declared-in-section">
  1293. <h4 class="method-subtitle">Declared In</h4>
  1294. <code class="declared-in-ref">FMDatabase.h</code><br />
  1295. </div>
  1296. </div>
  1297. <div class="section-method">
  1298. <a name="//api/name/goodConnection" title="goodConnection"></a>
  1299. <h3 class="subsubtitle method-title">goodConnection</h3>
  1300. <div class="method-subsection brief-description">
  1301. <p>Test to see if we have a good connection to the database.</p>
  1302. </div>
  1303. <div class="method-subsection method-declaration"><code>- (BOOL)goodConnection</code></div>
  1304. <div class="method-subsection return">
  1305. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1306. <p><code>YES</code> if everything succeeds, <code>NO</code> on failure.</p>
  1307. </div>
  1308. <div class="method-subsection discussion-section">
  1309. <h4 class="method-subtitle">Discussion</h4>
  1310. <p>This will confirm whether:</p>
  1311. <ul>
  1312. <li>is database open</li>
  1313. <li>if open, it will try a simple SELECT statement and confirm that it succeeds.</li>
  1314. </ul>
  1315. </div>
  1316. <div class="method-subsection declared-in-section">
  1317. <h4 class="method-subtitle">Declared In</h4>
  1318. <code class="declared-in-ref">FMDatabase.h</code><br />
  1319. </div>
  1320. </div>
  1321. <div class="section-method">
  1322. <a name="//api/name/hadError" title="hadError"></a>
  1323. <h3 class="subsubtitle method-title">hadError</h3>
  1324. <div class="method-subsection brief-description">
  1325. <p>Had error</p>
  1326. </div>
  1327. <div class="method-subsection method-declaration"><code>- (BOOL)hadError</code></div>
  1328. <div class="method-subsection return">
  1329. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1330. <p><code>YES</code> if there was an error, <code>NO</code> if no error.</p>
  1331. </div>
  1332. <div class="method-subsection see-also-section">
  1333. <h4 class="method-subtitle">See Also</h4>
  1334. <ul>
  1335. <li><code><p><a href="#//api/name/lastError">- lastError</a></p></code></li>
  1336. <li><code><p><a href="#//api/name/lastErrorCode">- lastErrorCode</a></p></code></li>
  1337. <li><code><p><a href="#//api/name/lastErrorMessage">- lastErrorMessage</a></p></code></li>
  1338. </ul>
  1339. </div>
  1340. <div class="method-subsection declared-in-section">
  1341. <h4 class="method-subtitle">Declared In</h4>
  1342. <code class="declared-in-ref">FMDatabase.h</code><br />
  1343. </div>
  1344. </div>
  1345. <div class="section-method">
  1346. <a name="//api/name/hasDateFormatter" title="hasDateFormatter"></a>
  1347. <h3 class="subsubtitle method-title">hasDateFormatter</h3>
  1348. <div class="method-subsection brief-description">
  1349. <p>Test whether the database has a date formatter assigned.</p>
  1350. </div>
  1351. <div class="method-subsection method-declaration"><code>- (BOOL)hasDateFormatter</code></div>
  1352. <div class="method-subsection return">
  1353. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1354. <p><code>YES</code> if there is a date formatter; <code>NO</code> if not.</p>
  1355. </div>
  1356. <div class="method-subsection see-also-section">
  1357. <h4 class="method-subtitle">See Also</h4>
  1358. <ul>
  1359. <li><code><p><a href="#//api/name/hasDateFormatter">- hasDateFormatter</a></p></code></li>
  1360. <li><code><p><a href="#//api/name/setDateFormat:">- setDateFormat:</a></p></code></li>
  1361. <li><code><p><a href="#//api/name/dateFromString:">- dateFromString:</a></p></code></li>
  1362. <li><code><p><a href="#//api/name/stringFromDate:">- stringFromDate:</a></p></code></li>
  1363. <li><code><p><a href="#//api/name/storeableDateFormat:">+ storeableDateFormat:</a></p></code></li>
  1364. </ul>
  1365. </div>
  1366. <div class="method-subsection declared-in-section">
  1367. <h4 class="method-subtitle">Declared In</h4>
  1368. <code class="declared-in-ref">FMDatabase.h</code><br />
  1369. </div>
  1370. </div>
  1371. <div class="section-method">
  1372. <a name="//api/name/hasOpenResultSets" title="hasOpenResultSets"></a>
  1373. <h3 class="subsubtitle method-title">hasOpenResultSets</h3>
  1374. <div class="method-subsection brief-description">
  1375. <p>Whether database has any open result sets</p>
  1376. </div>
  1377. <div class="method-subsection method-declaration"><code>- (BOOL)hasOpenResultSets</code></div>
  1378. <div class="method-subsection return">
  1379. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1380. <p><code>YES</code> if there are open result sets; <code>NO</code> if not.</p>
  1381. </div>
  1382. <div class="method-subsection declared-in-section">
  1383. <h4 class="method-subtitle">Declared In</h4>
  1384. <code class="declared-in-ref">FMDatabase.h</code><br />
  1385. </div>
  1386. </div>
  1387. <div class="section-method">
  1388. <a name="//api/name/inSavePoint:" title="inSavePoint:"></a>
  1389. <h3 class="subsubtitle method-title">inSavePoint:</h3>
  1390. <div class="method-subsection brief-description">
  1391. <p>Start save point</p>
  1392. </div>
  1393. <div class="method-subsection method-declaration"><code>- (NSError *)inSavePoint:(void ( ^ ) ( BOOL *rollback ))<em>block</em></code></div>
  1394. <div class="method-subsection arguments-section parameters">
  1395. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1396. <dl class="argument-def parameter-def">
  1397. <dt><em>block</em></dt>
  1398. <dd><p>Block of code to perform from within save point.</p></dd>
  1399. </dl>
  1400. </div>
  1401. <div class="method-subsection return">
  1402. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1403. <p><code>YES</code> on success; <code>NO</code> on failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  1404. </div>
  1405. <div class="method-subsection see-also-section">
  1406. <h4 class="method-subtitle">See Also</h4>
  1407. <ul>
  1408. <li><code><p><a href="#//api/name/startSavePointWithName:error:">- startSavePointWithName:error:</a></p></code></li>
  1409. <li><code><p><a href="#//api/name/releaseSavePointWithName:error:">- releaseSavePointWithName:error:</a></p></code></li>
  1410. <li><code><p><a href="#//api/name/rollbackToSavePointWithName:error:">- rollbackToSavePointWithName:error:</a></p></code></li>
  1411. </ul>
  1412. </div>
  1413. <div class="method-subsection declared-in-section">
  1414. <h4 class="method-subtitle">Declared In</h4>
  1415. <code class="declared-in-ref">FMDatabase.h</code><br />
  1416. </div>
  1417. </div>
  1418. <div class="section-method">
  1419. <a name="//api/name/inTransaction" title="inTransaction"></a>
  1420. <h3 class="subsubtitle method-title">inTransaction</h3>
  1421. <div class="method-subsection brief-description">
  1422. <p>Identify whether currently in a transaction or not</p>
  1423. </div>
  1424. <div class="method-subsection method-declaration"><code>- (BOOL)inTransaction</code></div>
  1425. <div class="method-subsection return">
  1426. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1427. <p><code>YES</code> if currently within transaction; <code>NO</code> if not.</p>
  1428. </div>
  1429. <div class="method-subsection see-also-section">
  1430. <h4 class="method-subtitle">See Also</h4>
  1431. <ul>
  1432. <li><code><p><a href="#//api/name/beginTransaction">- beginTransaction</a></p></code></li>
  1433. <li><code><p><a href="#//api/name/beginDeferredTransaction">- beginDeferredTransaction</a></p></code></li>
  1434. <li><code><p><a href="#//api/name/commit">- commit</a></p></code></li>
  1435. <li><code><p><a href="#//api/name/rollback">- rollback</a></p></code></li>
  1436. </ul>
  1437. </div>
  1438. <div class="method-subsection declared-in-section">
  1439. <h4 class="method-subtitle">Declared In</h4>
  1440. <code class="declared-in-ref">FMDatabase.h</code><br />
  1441. </div>
  1442. </div>
  1443. <div class="section-method">
  1444. <a name="//api/name/initWithPath:" title="initWithPath:"></a>
  1445. <h3 class="subsubtitle method-title">initWithPath:</h3>
  1446. <div class="method-subsection brief-description">
  1447. <p>Initialize a <code>FMDatabase</code> object.</p>
  1448. </div>
  1449. <div class="method-subsection method-declaration"><code>- (instancetype)initWithPath:(NSString *)<em>inPath</em></code></div>
  1450. <div class="method-subsection arguments-section parameters">
  1451. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1452. <dl class="argument-def parameter-def">
  1453. <dt><em>inPath</em></dt>
  1454. <dd><p>Path of database file</p></dd>
  1455. </dl>
  1456. </div>
  1457. <div class="method-subsection return">
  1458. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1459. <p><code>FMDatabase</code> object if successful; <code>nil</code> if failure.</p>
  1460. </div>
  1461. <div class="method-subsection discussion-section">
  1462. <h4 class="method-subtitle">Discussion</h4>
  1463. <p>An <code>FMDatabase</code> is created with a path to a SQLite database file. This path can be one of these three:</p>
  1464. <ol>
  1465. <li>A file system path. The file does not have to exist on disk. If it does not exist, it is created for you.</li>
  1466. <li>An empty string (<code>@""</code>). An empty database is created at a temporary location. This database is deleted with the <code>FMDatabase</code> connection is closed.</li>
  1467. <li><code>nil</code>. An in-memory database is created. This database will be destroyed with the <code>FMDatabase</code> connection is closed.</li>
  1468. </ol>
  1469. <p>For example, to create/open a database in your Mac OS X <code>tmp</code> folder:</p>
  1470. <pre><code>FMDatabase *db = [FMDatabase databaseWithPath:@"/tmp/tmp.db"];
  1471. </code></pre>
  1472. <p>Or, in iOS, you might open a database in the app&rsquo;s <code>Documents</code> directory:</p>
  1473. <pre><code>NSString *docsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
  1474. NSString *dbPath = [docsPath stringByAppendingPathComponent:@"test.db"];
  1475. FMDatabase *db = [FMDatabase databaseWithPath:dbPath];
  1476. </code></pre>
  1477. <p>(For more information on temporary and in-memory databases, read the sqlite documentation on the subject: <a href="http://www.sqlite.org/inmemorydb.html">http://www.sqlite.org/inmemorydb.html</a>)</p>
  1478. </div>
  1479. <div class="method-subsection declared-in-section">
  1480. <h4 class="method-subtitle">Declared In</h4>
  1481. <code class="declared-in-ref">FMDatabase.h</code><br />
  1482. </div>
  1483. </div>
  1484. <div class="section-method">
  1485. <a name="//api/name/lastError" title="lastError"></a>
  1486. <h3 class="subsubtitle method-title">lastError</h3>
  1487. <div class="method-subsection brief-description">
  1488. <p>Last error</p>
  1489. </div>
  1490. <div class="method-subsection method-declaration"><code>- (NSError *)lastError</code></div>
  1491. <div class="method-subsection return">
  1492. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1493. <p><code>NSError</code> representing the last error.</p>
  1494. </div>
  1495. <div class="method-subsection see-also-section">
  1496. <h4 class="method-subtitle">See Also</h4>
  1497. <ul>
  1498. <li><code><p><a href="#//api/name/lastErrorCode">- lastErrorCode</a></p></code></li>
  1499. <li><code><p><a href="#//api/name/lastErrorMessage">- lastErrorMessage</a></p></code></li>
  1500. </ul>
  1501. </div>
  1502. <div class="method-subsection declared-in-section">
  1503. <h4 class="method-subtitle">Declared In</h4>
  1504. <code class="declared-in-ref">FMDatabase.h</code><br />
  1505. </div>
  1506. </div>
  1507. <div class="section-method">
  1508. <a name="//api/name/lastErrorCode" title="lastErrorCode"></a>
  1509. <h3 class="subsubtitle method-title">lastErrorCode</h3>
  1510. <div class="method-subsection brief-description">
  1511. <p>Last error code</p>
  1512. </div>
  1513. <div class="method-subsection method-declaration"><code>- (int)lastErrorCode</code></div>
  1514. <div class="method-subsection return">
  1515. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1516. <p>Integer value of the last error code.</p>
  1517. </div>
  1518. <div class="method-subsection discussion-section">
  1519. <h4 class="method-subtitle">Discussion</h4>
  1520. <p>Returns the numeric result code or extended result code for the most recent failed SQLite API call associated with a database connection. If a prior API call failed but the most recent API call succeeded, this return value is undefined.</p>
  1521. </div>
  1522. <div class="method-subsection see-also-section">
  1523. <h4 class="method-subtitle">See Also</h4>
  1524. <ul>
  1525. <li><code><p><a href="http://sqlite.org/c3ref/errcode.html">sqlite3_errcode()</a></p></code></li>
  1526. <li><code><p><a href="#//api/name/lastErrorMessage">- lastErrorMessage</a></p></code></li>
  1527. <li><code><p><a href="#//api/name/lastError">- lastError</a></p></code></li>
  1528. </ul>
  1529. </div>
  1530. <div class="method-subsection declared-in-section">
  1531. <h4 class="method-subtitle">Declared In</h4>
  1532. <code class="declared-in-ref">FMDatabase.h</code><br />
  1533. </div>
  1534. </div>
  1535. <div class="section-method">
  1536. <a name="//api/name/lastErrorMessage" title="lastErrorMessage"></a>
  1537. <h3 class="subsubtitle method-title">lastErrorMessage</h3>
  1538. <div class="method-subsection brief-description">
  1539. <p>Last error message</p>
  1540. </div>
  1541. <div class="method-subsection method-declaration"><code>- (NSString *)lastErrorMessage</code></div>
  1542. <div class="method-subsection return">
  1543. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1544. <p><code>NSString</code> of the last error message.</p>
  1545. </div>
  1546. <div class="method-subsection discussion-section">
  1547. <h4 class="method-subtitle">Discussion</h4>
  1548. <p>Returns the English-language text that describes the most recent failed SQLite API call associated with a database connection. If a prior API call failed but the most recent API call succeeded, this return value is undefined.</p>
  1549. </div>
  1550. <div class="method-subsection see-also-section">
  1551. <h4 class="method-subtitle">See Also</h4>
  1552. <ul>
  1553. <li><code><p><a href="http://sqlite.org/c3ref/errcode.html">sqlite3_errmsg()</a></p></code></li>
  1554. <li><code><p><a href="#//api/name/lastErrorCode">- lastErrorCode</a></p></code></li>
  1555. <li><code><p><a href="#//api/name/lastError">- lastError</a></p></code></li>
  1556. </ul>
  1557. </div>
  1558. <div class="method-subsection declared-in-section">
  1559. <h4 class="method-subtitle">Declared In</h4>
  1560. <code class="declared-in-ref">FMDatabase.h</code><br />
  1561. </div>
  1562. </div>
  1563. <div class="section-method">
  1564. <a name="//api/name/lastInsertRowId" title="lastInsertRowId"></a>
  1565. <h3 class="subsubtitle method-title">lastInsertRowId</h3>
  1566. <div class="method-subsection brief-description">
  1567. <p>Last insert rowid</p>
  1568. </div>
  1569. <div class="method-subsection method-declaration"><code>- (sqlite_int64)lastInsertRowId</code></div>
  1570. <div class="method-subsection discussion-section">
  1571. <h4 class="method-subtitle">Discussion</h4>
  1572. <p>Each entry in an SQLite table has a unique 64-bit signed integer key called the &ldquo;rowid&rdquo;. The rowid is always available as an undeclared column named <code>ROWID</code>, <code>OID</code>, or <code>_ROWID_</code> as long as those names are not also used by explicitly declared columns. If the table has a column of type <code>INTEGER PRIMARY KEY</code> then that column is another alias for the rowid.</p>
  1573. <p>This routine returns the rowid of the most recent successful <code>INSERT</code> into the database from the database connection in the first argument. As of SQLite version 3.7.7, this routines records the last insert rowid of both ordinary tables and virtual tables. If no successful <code>INSERT</code>s have ever occurred on that database connection, zero is returned.</p>
  1574. </div>
  1575. <div class="method-subsection see-also-section">
  1576. <h4 class="method-subtitle">See Also</h4>
  1577. <ul>
  1578. <li><code><p><a href="http://sqlite.org/c3ref/last_insert_rowid.html">sqlite3_last_insert_rowid()</a></p></code></li>
  1579. </ul>
  1580. </div>
  1581. <div class="method-subsection declared-in-section">
  1582. <h4 class="method-subtitle">Declared In</h4>
  1583. <code class="declared-in-ref">FMDatabase.h</code><br />
  1584. </div>
  1585. </div>
  1586. <div class="section-method">
  1587. <a name="//api/name/makeFunctionNamed:maximumArguments:withBlock:" title="makeFunctionNamed:maximumArguments:withBlock:"></a>
  1588. <h3 class="subsubtitle method-title">makeFunctionNamed:maximumArguments:withBlock:</h3>
  1589. <div class="method-subsection brief-description">
  1590. <p>Adds SQL functions or aggregates or to redefine the behavior of existing SQL functions or aggregates.</p>
  1591. </div>
  1592. <div class="method-subsection method-declaration"><code>- (void)makeFunctionNamed:(NSString *)<em>name</em> maximumArguments:(int)<em>count</em> withBlock:(void ( ^ ) ( sqlite3_context *context , int argc , sqlite3_value **argv ))<em>block</em></code></div>
  1593. <div class="method-subsection arguments-section parameters">
  1594. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1595. <dl class="argument-def parameter-def">
  1596. <dt><em>name</em></dt>
  1597. <dd><p>Name of function</p></dd>
  1598. </dl>
  1599. <dl class="argument-def parameter-def">
  1600. <dt><em>count</em></dt>
  1601. <dd><p>Maximum number of parameters</p></dd>
  1602. </dl>
  1603. <dl class="argument-def parameter-def">
  1604. <dt><em>block</em></dt>
  1605. <dd><p>The block of code for the function</p></dd>
  1606. </dl>
  1607. </div>
  1608. <div class="method-subsection discussion-section">
  1609. <h4 class="method-subtitle">Discussion</h4>
  1610. <p>For example:</p>
  1611. <pre><code>[queue inDatabase:^(FMDatabase *adb) {
  1612. [adb executeUpdate:@"create table ftest (foo text)"];
  1613. [adb executeUpdate:@"insert into ftest values ('hello')"];
  1614. [adb executeUpdate:@"insert into ftest values ('hi')"];
  1615. [adb executeUpdate:@"insert into ftest values ('not h!')"];
  1616. [adb executeUpdate:@"insert into ftest values ('definitely not h!')"];
  1617. [adb makeFunctionNamed:@"StringStartsWithH" maximumArguments:1 withBlock:^(sqlite3_context *context, int aargc, sqlite3_value **aargv) {
  1618. if (sqlite3_value_type(aargv[0]) == SQLITE_TEXT) {
  1619. @autoreleasepool {
  1620. const char *c = (const char *)sqlite3_value_text(aargv[0]);
  1621. NSString *s = [NSString stringWithUTF8String:c];
  1622. sqlite3_result_int(context, [s hasPrefix:@"h"]);
  1623. }
  1624. }
  1625. else {
  1626. NSLog(@"Unknown formart for StringStartsWithH (%d) %s:%d", sqlite3_value_type(aargv[0]), __FUNCTION__, __LINE__);
  1627. sqlite3_result_null(context);
  1628. }
  1629. }];
  1630. int rowCount = 0;
  1631. FMResultSet *ars = [adb executeQuery:@"select * from ftest where StringStartsWithH(foo)"];
  1632. while ([ars next]) {
  1633. rowCount++;
  1634. NSLog(@"Does %@ start with 'h'?", [rs stringForColumnIndex:0]);
  1635. }
  1636. FMDBQuickCheck(rowCount == 2);
  1637. }];
  1638. </code></pre>
  1639. </div>
  1640. <div class="method-subsection see-also-section">
  1641. <h4 class="method-subtitle">See Also</h4>
  1642. <ul>
  1643. <li><code><p><a href="http://sqlite.org/c3ref/create_function.html">sqlite3_create_function()</a></p></code></li>
  1644. </ul>
  1645. </div>
  1646. <div class="method-subsection declared-in-section">
  1647. <h4 class="method-subtitle">Declared In</h4>
  1648. <code class="declared-in-ref">FMDatabase.h</code><br />
  1649. </div>
  1650. </div>
  1651. <div class="section-method">
  1652. <a name="//api/name/open" title="open"></a>
  1653. <h3 class="subsubtitle method-title">open</h3>
  1654. <div class="method-subsection brief-description">
  1655. <p>Opening a new database connection</p>
  1656. </div>
  1657. <div class="method-subsection method-declaration"><code>- (BOOL)open</code></div>
  1658. <div class="method-subsection return">
  1659. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1660. <p><code>YES</code> if successful, <code>NO</code> on error.</p>
  1661. </div>
  1662. <div class="method-subsection discussion-section">
  1663. <h4 class="method-subtitle">Discussion</h4>
  1664. <p>The database is opened for reading and writing, and is created if it does not already exist.</p>
  1665. </div>
  1666. <div class="method-subsection see-also-section">
  1667. <h4 class="method-subtitle">See Also</h4>
  1668. <ul>
  1669. <li><code><p><a href="http://sqlite.org/c3ref/open.html">sqlite3_open()</a></p></code></li>
  1670. <li><code><p><a href="#//api/name/openWithFlags:">- openWithFlags:</a></p></code></li>
  1671. <li><code><p><a href="#//api/name/close">- close</a></p></code></li>
  1672. </ul>
  1673. </div>
  1674. <div class="method-subsection declared-in-section">
  1675. <h4 class="method-subtitle">Declared In</h4>
  1676. <code class="declared-in-ref">FMDatabase.h</code><br />
  1677. </div>
  1678. </div>
  1679. <div class="section-method">
  1680. <a name="//api/name/openWithFlags:" title="openWithFlags:"></a>
  1681. <h3 class="subsubtitle method-title">openWithFlags:</h3>
  1682. <div class="method-subsection brief-description">
  1683. <p>Opening a new database connection with flags</p>
  1684. </div>
  1685. <div class="method-subsection method-declaration"><code>- (BOOL)openWithFlags:(int)<em>flags</em></code></div>
  1686. <div class="method-subsection arguments-section parameters">
  1687. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1688. <dl class="argument-def parameter-def">
  1689. <dt><em>flags</em></dt>
  1690. <dd><p>one of the following three values, optionally combined with the <code>SQLITE_OPEN_NOMUTEX</code>, <code>SQLITE_OPEN_FULLMUTEX</code>, <code>SQLITE_OPEN_SHAREDCACHE</code>, <code>SQLITE_OPEN_PRIVATECACHE</code>, and/or <code>SQLITE_OPEN_URI</code> flags:</p>
  1691. <p><code>SQLITE_OPEN_READONLY</code></p>
  1692. <p>The database is opened in read-only mode. If the database does not already exist, an error is returned.</p>
  1693. <p><code>SQLITE_OPEN_READWRITE</code></p>
  1694. <p>The database is opened for reading and writing if possible, or reading only if the file is write protected by the operating system. In either case the database must already exist, otherwise an error is returned.</p>
  1695. <p><code>SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE</code></p>
  1696. <p>The database is opened for reading and writing, and is created if it does not already exist. This is the behavior that is always used for <code>open</code> method.</p></dd>
  1697. </dl>
  1698. </div>
  1699. <div class="method-subsection return">
  1700. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1701. <p><code>YES</code> if successful, <code>NO</code> on error.</p>
  1702. </div>
  1703. <div class="method-subsection see-also-section">
  1704. <h4 class="method-subtitle">See Also</h4>
  1705. <ul>
  1706. <li><code><p><a href="http://sqlite.org/c3ref/open.html">sqlite3_open_v2()</a></p></code></li>
  1707. <li><code><p><a href="#//api/name/open">- open</a></p></code></li>
  1708. <li><code><p><a href="#//api/name/close">- close</a></p></code></li>
  1709. </ul>
  1710. </div>
  1711. <div class="method-subsection declared-in-section">
  1712. <h4 class="method-subtitle">Declared In</h4>
  1713. <code class="declared-in-ref">FMDatabase.h</code><br />
  1714. </div>
  1715. </div>
  1716. <div class="section-method">
  1717. <a name="//api/name/rekey:" title="rekey:"></a>
  1718. <h3 class="subsubtitle method-title">rekey:</h3>
  1719. <div class="method-subsection brief-description">
  1720. <p>Reset encryption key</p>
  1721. </div>
  1722. <div class="method-subsection method-declaration"><code>- (BOOL)rekey:(NSString *)<em>key</em></code></div>
  1723. <div class="method-subsection arguments-section parameters">
  1724. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1725. <dl class="argument-def parameter-def">
  1726. <dt><em>key</em></dt>
  1727. <dd><p>The key to be used.</p></dd>
  1728. </dl>
  1729. </div>
  1730. <div class="method-subsection return">
  1731. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1732. <p><code>YES</code> if success, <code>NO</code> on error.</p>
  1733. </div>
  1734. <div class="method-subsection discussion-section">
  1735. <h4 class="method-subtitle">Discussion</h4>
  1736. <div class="warning"><p><strong>Warning:</strong> You need to have purchased the sqlite encryption extensions for this method to work.</p></div>
  1737. </div>
  1738. <div class="method-subsection see-also-section">
  1739. <h4 class="method-subtitle">See Also</h4>
  1740. <ul>
  1741. <li><code><p><a href="http://www.sqlite-encrypt.com/develop-guide.htm">http://www.sqlite-encrypt.com/develop-guide.htm</a></p></code></li>
  1742. </ul>
  1743. </div>
  1744. <div class="method-subsection declared-in-section">
  1745. <h4 class="method-subtitle">Declared In</h4>
  1746. <code class="declared-in-ref">FMDatabase.h</code><br />
  1747. </div>
  1748. </div>
  1749. <div class="section-method">
  1750. <a name="//api/name/rekeyWithData:" title="rekeyWithData:"></a>
  1751. <h3 class="subsubtitle method-title">rekeyWithData:</h3>
  1752. <div class="method-subsection brief-description">
  1753. <p>Reset encryption key using <code>keyData</code>.</p>
  1754. </div>
  1755. <div class="method-subsection method-declaration"><code>- (BOOL)rekeyWithData:(NSData *)<em>keyData</em></code></div>
  1756. <div class="method-subsection arguments-section parameters">
  1757. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1758. <dl class="argument-def parameter-def">
  1759. <dt><em>keyData</em></dt>
  1760. <dd><p>The <code>NSData</code> to be used.</p></dd>
  1761. </dl>
  1762. </div>
  1763. <div class="method-subsection return">
  1764. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1765. <p><code>YES</code> if success, <code>NO</code> on error.</p>
  1766. </div>
  1767. <div class="method-subsection discussion-section">
  1768. <h4 class="method-subtitle">Discussion</h4>
  1769. <div class="warning"><p><strong>Warning:</strong> You need to have purchased the sqlite encryption extensions for this method to work.</p></div>
  1770. </div>
  1771. <div class="method-subsection see-also-section">
  1772. <h4 class="method-subtitle">See Also</h4>
  1773. <ul>
  1774. <li><code><p><a href="http://www.sqlite-encrypt.com/develop-guide.htm">http://www.sqlite-encrypt.com/develop-guide.htm</a></p></code></li>
  1775. </ul>
  1776. </div>
  1777. <div class="method-subsection declared-in-section">
  1778. <h4 class="method-subtitle">Declared In</h4>
  1779. <code class="declared-in-ref">FMDatabase.h</code><br />
  1780. </div>
  1781. </div>
  1782. <div class="section-method">
  1783. <a name="//api/name/releaseSavePointWithName:error:" title="releaseSavePointWithName:error:"></a>
  1784. <h3 class="subsubtitle method-title">releaseSavePointWithName:error:</h3>
  1785. <div class="method-subsection brief-description">
  1786. <p>Release save point</p>
  1787. </div>
  1788. <div class="method-subsection method-declaration"><code>- (BOOL)releaseSavePointWithName:(NSString *)<em>name</em> error:(NSError **)<em>outErr</em></code></div>
  1789. <div class="method-subsection arguments-section parameters">
  1790. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1791. <dl class="argument-def parameter-def">
  1792. <dt><em>name</em></dt>
  1793. <dd><p>Name of save point.</p></dd>
  1794. </dl>
  1795. <dl class="argument-def parameter-def">
  1796. <dt><em>outErr</em></dt>
  1797. <dd><p>A <code>NSError</code> object to receive any error object (if any).</p></dd>
  1798. </dl>
  1799. </div>
  1800. <div class="method-subsection return">
  1801. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1802. <p><code>YES</code> on success; <code>NO</code> on failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  1803. </div>
  1804. <div class="method-subsection see-also-section">
  1805. <h4 class="method-subtitle">See Also</h4>
  1806. <ul>
  1807. <li><code><p><a href="#//api/name/startSavePointWithName:error:">- startSavePointWithName:error:</a></p></code></li>
  1808. <li><code><p><a href="#//api/name/rollbackToSavePointWithName:error:">- rollbackToSavePointWithName:error:</a></p></code></li>
  1809. </ul>
  1810. </div>
  1811. <div class="method-subsection declared-in-section">
  1812. <h4 class="method-subtitle">Declared In</h4>
  1813. <code class="declared-in-ref">FMDatabase.h</code><br />
  1814. </div>
  1815. </div>
  1816. <div class="section-method">
  1817. <a name="//api/name/rollback" title="rollback"></a>
  1818. <h3 class="subsubtitle method-title">rollback</h3>
  1819. <div class="method-subsection brief-description">
  1820. <p>Rollback a transaction</p>
  1821. </div>
  1822. <div class="method-subsection method-declaration"><code>- (BOOL)rollback</code></div>
  1823. <div class="method-subsection return">
  1824. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1825. <p><code>YES</code> on success; <code>NO</code> on failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  1826. </div>
  1827. <div class="method-subsection discussion-section">
  1828. <h4 class="method-subtitle">Discussion</h4>
  1829. <p>Rollback a transaction that was initiated with either <a href="#//api/name/beginTransaction"><code>beginTransaction</code></a> or with <a href="#//api/name/beginDeferredTransaction"><code>beginDeferredTransaction</code></a>.</p>
  1830. </div>
  1831. <div class="method-subsection see-also-section">
  1832. <h4 class="method-subtitle">See Also</h4>
  1833. <ul>
  1834. <li><code><p><a href="#//api/name/beginTransaction">- beginTransaction</a></p></code></li>
  1835. <li><code><p><a href="#//api/name/beginDeferredTransaction">- beginDeferredTransaction</a></p></code></li>
  1836. <li><code><p><a href="#//api/name/commit">- commit</a></p></code></li>
  1837. <li><code><p><a href="#//api/name/inTransaction">- inTransaction</a></p></code></li>
  1838. </ul>
  1839. </div>
  1840. <div class="method-subsection declared-in-section">
  1841. <h4 class="method-subtitle">Declared In</h4>
  1842. <code class="declared-in-ref">FMDatabase.h</code><br />
  1843. </div>
  1844. </div>
  1845. <div class="section-method">
  1846. <a name="//api/name/rollbackToSavePointWithName:error:" title="rollbackToSavePointWithName:error:"></a>
  1847. <h3 class="subsubtitle method-title">rollbackToSavePointWithName:error:</h3>
  1848. <div class="method-subsection brief-description">
  1849. <p>Roll back to save point</p>
  1850. </div>
  1851. <div class="method-subsection method-declaration"><code>- (BOOL)rollbackToSavePointWithName:(NSString *)<em>name</em> error:(NSError **)<em>outErr</em></code></div>
  1852. <div class="method-subsection arguments-section parameters">
  1853. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1854. <dl class="argument-def parameter-def">
  1855. <dt><em>name</em></dt>
  1856. <dd><p>Name of save point.</p></dd>
  1857. </dl>
  1858. <dl class="argument-def parameter-def">
  1859. <dt><em>outErr</em></dt>
  1860. <dd><p>A <code>NSError</code> object to receive any error object (if any).</p></dd>
  1861. </dl>
  1862. </div>
  1863. <div class="method-subsection return">
  1864. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1865. <p><code>YES</code> on success; <code>NO</code> on failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  1866. </div>
  1867. <div class="method-subsection see-also-section">
  1868. <h4 class="method-subtitle">See Also</h4>
  1869. <ul>
  1870. <li><code><p><a href="#//api/name/startSavePointWithName:error:">- startSavePointWithName:error:</a></p></code></li>
  1871. <li><code><p><a href="#//api/name/releaseSavePointWithName:error:">- releaseSavePointWithName:error:</a></p></code></li>
  1872. </ul>
  1873. </div>
  1874. <div class="method-subsection declared-in-section">
  1875. <h4 class="method-subtitle">Declared In</h4>
  1876. <code class="declared-in-ref">FMDatabase.h</code><br />
  1877. </div>
  1878. </div>
  1879. <div class="section-method">
  1880. <a name="//api/name/setDateFormat:" title="setDateFormat:"></a>
  1881. <h3 class="subsubtitle method-title">setDateFormat:</h3>
  1882. <div class="method-subsection brief-description">
  1883. <p>Set to a date formatter to use string dates with sqlite instead of the default UNIX timestamps.</p>
  1884. </div>
  1885. <div class="method-subsection method-declaration"><code>- (void)setDateFormat:(NSDateFormatter *)<em>format</em></code></div>
  1886. <div class="method-subsection arguments-section parameters">
  1887. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1888. <dl class="argument-def parameter-def">
  1889. <dt><em>format</em></dt>
  1890. <dd><p>Set to nil to use UNIX timestamps. Defaults to nil. Should be set using a formatter generated using FMDatabase::storeableDateFormat.</p></dd>
  1891. </dl>
  1892. </div>
  1893. <div class="method-subsection discussion-section">
  1894. <h4 class="method-subtitle">Discussion</h4>
  1895. <div class="warning"><p><strong>Warning:</strong> Note there is no direct getter for the <code>NSDateFormatter</code>, and you should not use the formatter you pass to FMDB for other purposes, as <code>NSDateFormatter</code> is not thread-safe.</p></div>
  1896. </div>
  1897. <div class="method-subsection see-also-section">
  1898. <h4 class="method-subtitle">See Also</h4>
  1899. <ul>
  1900. <li><code><p><a href="#//api/name/hasDateFormatter">- hasDateFormatter</a></p></code></li>
  1901. <li><code><p><a href="#//api/name/setDateFormat:">- setDateFormat:</a></p></code></li>
  1902. <li><code><p><a href="#//api/name/dateFromString:">- dateFromString:</a></p></code></li>
  1903. <li><code><p><a href="#//api/name/stringFromDate:">- stringFromDate:</a></p></code></li>
  1904. <li><code><p><a href="#//api/name/storeableDateFormat:">+ storeableDateFormat:</a></p></code></li>
  1905. </ul>
  1906. </div>
  1907. <div class="method-subsection declared-in-section">
  1908. <h4 class="method-subtitle">Declared In</h4>
  1909. <code class="declared-in-ref">FMDatabase.h</code><br />
  1910. </div>
  1911. </div>
  1912. <div class="section-method">
  1913. <a name="//api/name/setKey:" title="setKey:"></a>
  1914. <h3 class="subsubtitle method-title">setKey:</h3>
  1915. <div class="method-subsection brief-description">
  1916. <p>Set encryption key.</p>
  1917. </div>
  1918. <div class="method-subsection method-declaration"><code>- (BOOL)setKey:(NSString *)<em>key</em></code></div>
  1919. <div class="method-subsection arguments-section parameters">
  1920. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1921. <dl class="argument-def parameter-def">
  1922. <dt><em>key</em></dt>
  1923. <dd><p>The key to be used.</p></dd>
  1924. </dl>
  1925. </div>
  1926. <div class="method-subsection return">
  1927. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1928. <p><code>YES</code> if success, <code>NO</code> on error.</p>
  1929. </div>
  1930. <div class="method-subsection discussion-section">
  1931. <h4 class="method-subtitle">Discussion</h4>
  1932. <div class="warning"><p><strong>Warning:</strong> You need to have purchased the sqlite encryption extensions for this method to work.</p></div>
  1933. </div>
  1934. <div class="method-subsection see-also-section">
  1935. <h4 class="method-subtitle">See Also</h4>
  1936. <ul>
  1937. <li><code><p><a href="http://www.sqlite-encrypt.com/develop-guide.htm">http://www.sqlite-encrypt.com/develop-guide.htm</a></p></code></li>
  1938. </ul>
  1939. </div>
  1940. <div class="method-subsection declared-in-section">
  1941. <h4 class="method-subtitle">Declared In</h4>
  1942. <code class="declared-in-ref">FMDatabase.h</code><br />
  1943. </div>
  1944. </div>
  1945. <div class="section-method">
  1946. <a name="//api/name/setKeyWithData:" title="setKeyWithData:"></a>
  1947. <h3 class="subsubtitle method-title">setKeyWithData:</h3>
  1948. <div class="method-subsection brief-description">
  1949. <p>Set encryption key using <code>keyData</code>.</p>
  1950. </div>
  1951. <div class="method-subsection method-declaration"><code>- (BOOL)setKeyWithData:(NSData *)<em>keyData</em></code></div>
  1952. <div class="method-subsection arguments-section parameters">
  1953. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1954. <dl class="argument-def parameter-def">
  1955. <dt><em>keyData</em></dt>
  1956. <dd><p>The <code>NSData</code> to be used.</p></dd>
  1957. </dl>
  1958. </div>
  1959. <div class="method-subsection return">
  1960. <h4 class="method-subtitle parameter-title">Return Value</h4>
  1961. <p><code>YES</code> if success, <code>NO</code> on error.</p>
  1962. </div>
  1963. <div class="method-subsection discussion-section">
  1964. <h4 class="method-subtitle">Discussion</h4>
  1965. <div class="warning"><p><strong>Warning:</strong> You need to have purchased the sqlite encryption extensions for this method to work.</p></div>
  1966. </div>
  1967. <div class="method-subsection see-also-section">
  1968. <h4 class="method-subtitle">See Also</h4>
  1969. <ul>
  1970. <li><code><p><a href="http://www.sqlite-encrypt.com/develop-guide.htm">http://www.sqlite-encrypt.com/develop-guide.htm</a></p></code></li>
  1971. </ul>
  1972. </div>
  1973. <div class="method-subsection declared-in-section">
  1974. <h4 class="method-subtitle">Declared In</h4>
  1975. <code class="declared-in-ref">FMDatabase.h</code><br />
  1976. </div>
  1977. </div>
  1978. <div class="section-method">
  1979. <a name="//api/name/setShouldCacheStatements:" title="setShouldCacheStatements:"></a>
  1980. <h3 class="subsubtitle method-title">setShouldCacheStatements:</h3>
  1981. <div class="method-subsection brief-description">
  1982. <p>Set whether should cache statements or not</p>
  1983. </div>
  1984. <div class="method-subsection method-declaration"><code>- (void)setShouldCacheStatements:(BOOL)<em>value</em></code></div>
  1985. <div class="method-subsection arguments-section parameters">
  1986. <h4 class="method-subtitle parameter-title">Parameters</h4>
  1987. <dl class="argument-def parameter-def">
  1988. <dt><em>value</em></dt>
  1989. <dd><p><code>YES</code> if should cache statements; <code>NO</code> if not.</p></dd>
  1990. </dl>
  1991. </div>
  1992. <div class="method-subsection declared-in-section">
  1993. <h4 class="method-subtitle">Declared In</h4>
  1994. <code class="declared-in-ref">FMDatabase.h</code><br />
  1995. </div>
  1996. </div>
  1997. <div class="section-method">
  1998. <a name="//api/name/shouldCacheStatements" title="shouldCacheStatements"></a>
  1999. <h3 class="subsubtitle method-title">shouldCacheStatements</h3>
  2000. <div class="method-subsection brief-description">
  2001. <p>Return whether should cache statements or not</p>
  2002. </div>
  2003. <div class="method-subsection method-declaration"><code>- (BOOL)shouldCacheStatements</code></div>
  2004. <div class="method-subsection return">
  2005. <h4 class="method-subtitle parameter-title">Return Value</h4>
  2006. <p><code>YES</code> if should cache statements; <code>NO</code> if not.</p>
  2007. </div>
  2008. <div class="method-subsection declared-in-section">
  2009. <h4 class="method-subtitle">Declared In</h4>
  2010. <code class="declared-in-ref">FMDatabase.h</code><br />
  2011. </div>
  2012. </div>
  2013. <div class="section-method">
  2014. <a name="//api/name/sqliteHandle" title="sqliteHandle"></a>
  2015. <h3 class="subsubtitle method-title">sqliteHandle</h3>
  2016. <div class="method-subsection brief-description">
  2017. <p>The underlying SQLite handle</p>
  2018. </div>
  2019. <div class="method-subsection method-declaration"><code>- (sqlite3 *)sqliteHandle</code></div>
  2020. <div class="method-subsection return">
  2021. <h4 class="method-subtitle parameter-title">Return Value</h4>
  2022. <p>The <code>sqlite3</code> pointer.</p>
  2023. </div>
  2024. <div class="method-subsection declared-in-section">
  2025. <h4 class="method-subtitle">Declared In</h4>
  2026. <code class="declared-in-ref">FMDatabase.h</code><br />
  2027. </div>
  2028. </div>
  2029. <div class="section-method">
  2030. <a name="//api/name/startSavePointWithName:error:" title="startSavePointWithName:error:"></a>
  2031. <h3 class="subsubtitle method-title">startSavePointWithName:error:</h3>
  2032. <div class="method-subsection brief-description">
  2033. <p>Start save point</p>
  2034. </div>
  2035. <div class="method-subsection method-declaration"><code>- (BOOL)startSavePointWithName:(NSString *)<em>name</em> error:(NSError **)<em>outErr</em></code></div>
  2036. <div class="method-subsection arguments-section parameters">
  2037. <h4 class="method-subtitle parameter-title">Parameters</h4>
  2038. <dl class="argument-def parameter-def">
  2039. <dt><em>name</em></dt>
  2040. <dd><p>Name of save point.</p></dd>
  2041. </dl>
  2042. <dl class="argument-def parameter-def">
  2043. <dt><em>outErr</em></dt>
  2044. <dd><p>A <code>NSError</code> object to receive any error object (if any).</p></dd>
  2045. </dl>
  2046. </div>
  2047. <div class="method-subsection return">
  2048. <h4 class="method-subtitle parameter-title">Return Value</h4>
  2049. <p><code>YES</code> on success; <code>NO</code> on failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  2050. </div>
  2051. <div class="method-subsection see-also-section">
  2052. <h4 class="method-subtitle">See Also</h4>
  2053. <ul>
  2054. <li><code><p><a href="#//api/name/releaseSavePointWithName:error:">- releaseSavePointWithName:error:</a></p></code></li>
  2055. <li><code><p><a href="#//api/name/rollbackToSavePointWithName:error:">- rollbackToSavePointWithName:error:</a></p></code></li>
  2056. </ul>
  2057. </div>
  2058. <div class="method-subsection declared-in-section">
  2059. <h4 class="method-subtitle">Declared In</h4>
  2060. <code class="declared-in-ref">FMDatabase.h</code><br />
  2061. </div>
  2062. </div>
  2063. <div class="section-method">
  2064. <a name="//api/name/stringFromDate:" title="stringFromDate:"></a>
  2065. <h3 class="subsubtitle method-title">stringFromDate:</h3>
  2066. <div class="method-subsection brief-description">
  2067. <p>Convert the supplied NSDate to NSString, using the current database formatter.</p>
  2068. </div>
  2069. <div class="method-subsection method-declaration"><code>- (NSString *)stringFromDate:(NSDate *)<em>date</em></code></div>
  2070. <div class="method-subsection arguments-section parameters">
  2071. <h4 class="method-subtitle parameter-title">Parameters</h4>
  2072. <dl class="argument-def parameter-def">
  2073. <dt><em>date</em></dt>
  2074. <dd><p><code>NSDate</code> of date to convert to <code>NSString</code>.</p></dd>
  2075. </dl>
  2076. </div>
  2077. <div class="method-subsection return">
  2078. <h4 class="method-subtitle parameter-title">Return Value</h4>
  2079. <p><code>nil</code> if no formatter is set.</p>
  2080. </div>
  2081. <div class="method-subsection see-also-section">
  2082. <h4 class="method-subtitle">See Also</h4>
  2083. <ul>
  2084. <li><code><p><a href="#//api/name/hasDateFormatter">- hasDateFormatter</a></p></code></li>
  2085. <li><code><p><a href="#//api/name/setDateFormat:">- setDateFormat:</a></p></code></li>
  2086. <li><code><p><a href="#//api/name/dateFromString:">- dateFromString:</a></p></code></li>
  2087. <li><code><p><a href="#//api/name/stringFromDate:">- stringFromDate:</a></p></code></li>
  2088. <li><code><p><a href="#//api/name/storeableDateFormat:">+ storeableDateFormat:</a></p></code></li>
  2089. </ul>
  2090. </div>
  2091. <div class="method-subsection declared-in-section">
  2092. <h4 class="method-subtitle">Declared In</h4>
  2093. <code class="declared-in-ref">FMDatabase.h</code><br />
  2094. </div>
  2095. </div>
  2096. <div class="section-method">
  2097. <a name="//api/name/update:withErrorAndBindings:" title="update:withErrorAndBindings:"></a>
  2098. <h3 class="subsubtitle method-title">update:withErrorAndBindings:</h3>
  2099. <div class="method-subsection brief-description">
  2100. <p>Execute update statement</p>
  2101. </div>
  2102. <div class="method-subsection method-declaration"><code>- (BOOL)update:(NSString *)<em>sql</em> withErrorAndBindings:(NSError **)<em>outErr</em>, <em>...</em></code></div>
  2103. <div class="method-subsection arguments-section parameters">
  2104. <h4 class="method-subtitle parameter-title">Parameters</h4>
  2105. <dl class="argument-def parameter-def">
  2106. <dt><em>sql</em></dt>
  2107. <dd><p>The SQL to be performed, with optional <code>?</code> placeholders.</p></dd>
  2108. </dl>
  2109. <dl class="argument-def parameter-def">
  2110. <dt><em>outErr</em></dt>
  2111. <dd><p>A reference to the <code>NSError</code> pointer to be updated with an auto released <code>NSError</code> object if an error if an error occurs. If <code>nil</code>, no <code>NSError</code> object will be returned.</p></dd>
  2112. </dl>
  2113. <dl class="argument-def parameter-def">
  2114. <dt><em>...</em></dt>
  2115. <dd><p>Optional parameters to bind to <code>?</code> placeholders in the SQL statement. These should be Objective-C objects (e.g. <code>NSString</code>, <code>NSNumber</code>, etc.), not fundamental C data types (e.g. <code>int</code>, <code>char *</code>, etc.).</p></dd>
  2116. </dl>
  2117. </div>
  2118. <div class="method-subsection return">
  2119. <h4 class="method-subtitle parameter-title">Return Value</h4>
  2120. <p><code>YES</code> upon success; <code>NO</code> upon failure. If failed, you can call <a href="#//api/name/lastError"><code>lastError</code></a>, <a href="#//api/name/lastErrorCode"><code>lastErrorCode</code></a>, or <a href="#//api/name/lastErrorMessage"><code>lastErrorMessage</code></a> for diagnostic information regarding the failure.</p>
  2121. </div>
  2122. <div class="method-subsection discussion-section">
  2123. <h4 class="method-subtitle">Discussion</h4>
  2124. <p>This method employs <a href="http://sqlite.org/c3ref/bind_blob.html"><code>sqlite3_bind</code></a> for any optional value parameters. This properly escapes any characters that need escape sequences (e.g. quotation marks), which eliminates simple SQL errors as well as protects against SQL injection attacks. This method natively handles <code>NSString</code>, <code>NSNumber</code>, <code>NSNull</code>, <code>NSDate</code>, and <code>NSData</code> objects. All other object types will be interpreted as text values using the object&rsquo;s <code>description</code> method.</p>
  2125. </div>
  2126. <div class="method-subsection see-also-section">
  2127. <h4 class="method-subtitle">See Also</h4>
  2128. <ul>
  2129. <li><code><p><a href="#//api/name/lastError">- lastError</a></p></code></li>
  2130. <li><code><p><a href="#//api/name/lastErrorCode">- lastErrorCode</a></p></code></li>
  2131. <li><code><p><a href="#//api/name/lastErrorMessage">- lastErrorMessage</a></p></code></li>
  2132. <li><code><p><a href="http://sqlite.org/c3ref/bind_blob.html"><code>sqlite3_bind</code></a></p></code></li>
  2133. </ul>
  2134. </div>
  2135. <div class="method-subsection declared-in-section">
  2136. <h4 class="method-subtitle">Declared In</h4>
  2137. <code class="declared-in-ref">FMDatabase.h</code><br />
  2138. </div>
  2139. </div>
  2140. </div>
  2141. </div>
  2142. <div class="main-navigation navigation-bottom">
  2143. <ul>
  2144. <li><a href="../index.html">Index</a></li>
  2145. <li><a href="../hierarchy.html">Hierarchy</a></li>
  2146. </ul>
  2147. </div>
  2148. <div id="footer">
  2149. <hr />
  2150. <div class="footer-copyright">
  2151. <p><span class="copyright">&copy; 2013 ccgus. All rights reserved. (Last updated: 2013-08-06)</span><br />
  2152. <span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.1 (build 858)</a>.</span></p>
  2153. </div>
  2154. </div>
  2155. </div>
  2156. </article>
  2157. <script type="text/javascript">
  2158. function jumpToChange()
  2159. {
  2160. window.location.hash = this.options[this.selectedIndex].value;
  2161. }
  2162. function toggleTOC()
  2163. {
  2164. var contents = document.getElementById('contents');
  2165. var tocContainer = document.getElementById('tocContainer');
  2166. if (this.getAttribute('class') == 'open')
  2167. {
  2168. this.setAttribute('class', '');
  2169. contents.setAttribute('class', '');
  2170. tocContainer.setAttribute('class', '');
  2171. window.name = "hideTOC";
  2172. }
  2173. else
  2174. {
  2175. this.setAttribute('class', 'open');
  2176. contents.setAttribute('class', 'isShowingTOC');
  2177. tocContainer.setAttribute('class', 'isShowingTOC');
  2178. window.name = "";
  2179. }
  2180. return false;
  2181. }
  2182. function toggleTOCEntryChildren(e)
  2183. {
  2184. e.stopPropagation();
  2185. var currentClass = this.getAttribute('class');
  2186. if (currentClass == 'children') {
  2187. this.setAttribute('class', 'children open');
  2188. }
  2189. else if (currentClass == 'children open') {
  2190. this.setAttribute('class', 'children');
  2191. }
  2192. return false;
  2193. }
  2194. function tocEntryClick(e)
  2195. {
  2196. e.stopPropagation();
  2197. return true;
  2198. }
  2199. function init()
  2200. {
  2201. var selectElement = document.getElementById('jumpTo');
  2202. selectElement.addEventListener('change', jumpToChange, false);
  2203. var tocButton = document.getElementById('table_of_contents');
  2204. tocButton.addEventListener('click', toggleTOC, false);
  2205. var taskTreeItem = document.getElementById('task_treeitem');
  2206. if (taskTreeItem.getElementsByTagName('li').length > 0)
  2207. {
  2208. taskTreeItem.setAttribute('class', 'children');
  2209. taskTreeItem.firstChild.setAttribute('class', 'disclosure');
  2210. }
  2211. var tocList = document.getElementById('toc');
  2212. var tocEntries = tocList.getElementsByTagName('li');
  2213. for (var i = 0; i < tocEntries.length; i++) {
  2214. tocEntries[i].addEventListener('click', toggleTOCEntryChildren, false);
  2215. }
  2216. var tocLinks = tocList.getElementsByTagName('a');
  2217. for (var i = 0; i < tocLinks.length; i++) {
  2218. tocLinks[i].addEventListener('click', tocEntryClick, false);
  2219. }
  2220. if (window.name == "hideTOC") {
  2221. toggleTOC.call(tocButton);
  2222. }
  2223. }
  2224. window.onload = init;
  2225. // If showing in Xcode, hide the TOC and Header
  2226. if (navigator.userAgent.match(/xcode/i)) {
  2227. document.getElementById("contents").className = "hideInXcode"
  2228. document.getElementById("tocContainer").className = "hideInXcode"
  2229. document.getElementById("top_header").className = "hideInXcode"
  2230. }
  2231. </script>
  2232. </body>
  2233. </html>