cpdo  Hex Artifact Content

Artifact c7ed5554f8d1e47df5a06e425a5f6d365f2efb77:

Wiki page [TODOs] by stephan 2011-05-17 18:39:28.
0000: 44 20 32 30 31 31 2d 30 35 2d 31 37 54 31 38 3a  D 2011-05-17T18:
0010: 33 39 3a 32 38 2e 35 33 31 0a 4c 20 54 4f 44 4f  39:28.531.L TODO
0020: 73 0a 50 20 37 62 32 64 32 31 37 63 35 66 30 36  s.P 7b2d217c5f06
0030: 35 37 37 39 66 63 36 36 61 31 30 33 66 31 63 38  5779fc66a103f1c8
0040: 38 62 32 65 39 37 37 65 64 62 35 31 0a 55 20 73  8b2e977edb51.U s
0050: 74 65 70 68 61 6e 0a 57 20 33 30 35 38 0a 3c 73  tephan.W 3058.<s
0060: 74 72 6f 6e 67 3e 41 43 48 54 55 4e 47 3a 20 54  trong>ACHTUNG: T
0070: 48 45 20 43 50 44 4f 20 57 49 4b 49 20 49 53 20  HE CPDO WIKI IS 
0080: 4e 4f 57 20 28 41 53 20 4f 46 20 32 30 31 31 2d  NOW (AS OF 2011-
0090: 4d 61 79 2d 31 37 29 20 4d 41 49 4e 54 41 49 4e  May-17) MAINTAIN
00a0: 45 44 20 4f 4e 20 41 20 44 45 44 49 43 41 54 45  ED ON A DEDICATE
00b0: 44 20 57 49 4b 49 20 53 49 54 45 3a 3c 2f 73 74  D WIKI SITE:</st
00c0: 72 6f 6e 67 3e 20 5b 68 74 74 70 3a 2f 2f 77 68  rong> [http://wh
00d0: 69 6b 69 2e 77 61 6e 64 65 72 69 6e 67 68 6f 72  iki.wanderinghor
00e0: 73 65 2e 6e 65 74 2f 77 69 6b 69 73 2f 63 70 64  se.net/wikis/cpd
00f0: 6f 2f 3f 70 61 67 65 3d 54 4f 44 4f 73 5d 0a 0a  o/?page=TODOs]..
0100: 50 6f 74 65 6e 74 69 61 6c 20 54 4f 44 4f 73 20  Potential TODOs 
0110: 61 6e 64 20 6f 74 68 65 72 20 72 61 6e 64 6f 6d  and other random
0120: 20 74 68 6f 75 67 68 74 73 3a 0d 0a 0d 0a 20 20   thoughts:....  
0130: 20 2a 20 20 53 65 76 65 72 61 6c 20 6f 66 20 74   *  Several of t
0140: 68 65 20 64 65 73 69 72 65 64 20 66 75 6e 63 74  he desired funct
0150: 69 6f 6e 73 20 61 72 65 20 6e 6f 74 20 79 65 74  ions are not yet
0160: 20 69 6e 20 74 68 65 20 41 50 49 2c 20 6c 69 6b   in the API, lik
0170: 65 20 67 65 74 2d 61 66 66 65 63 74 65 64 2d 72  e get-affected-r
0180: 6f 77 73 2c 20 61 6e 64 20 64 72 69 76 65 72 2d  ows, and driver-
0190: 6c 65 76 65 6c 20 70 72 6f 70 65 72 74 69 65 73  level properties
01a0: 2e 0d 0a 20 20 20 2a 20 20 53 65 74 20 75 70 20  ...   *  Set up 
01b0: 61 20 6d 6f 72 65 20 64 65 74 61 69 6c 65 64 2f  a more detailed/
01c0: 63 6f 6d 70 72 65 68 65 6e 73 69 76 65 20 74 65  comprehensive te
01d0: 73 74 20 73 75 69 74 65 2c 20 73 74 72 65 73 73  st suite, stress
01e0: 20 74 65 73 74 2c 20 61 6e 64 20 6f 72 20 22 63   test, and or "c
01f0: 65 72 74 69 66 69 63 61 74 69 6f 6e 20 73 75 69  ertification sui
0200: 74 65 22 20 77 68 69 63 68 20 63 61 6e 20 62 65  te" which can be
0210: 20 75 73 65 64 20 74 6f 20 63 65 72 74 69 66 79   used to certify
0220: 20 61 20 67 69 76 65 6e 20 64 72 69 76 65 72 20   a given driver 
0230: 61 67 61 69 6e 73 74 20 74 68 65 20 41 50 49 27  against the API'
0240: 73 20 72 65 71 75 69 72 65 6d 65 6e 74 73 2e 0d  s requirements..
0250: 0a 20 20 20 2a 20 20 43 6c 65 61 6e 20 75 70 20  .   *  Clean up 
0260: 74 68 65 20 62 75 69 6c 64 20 74 72 65 65 2e 0d  the build tree..
0270: 0a 20 20 20 2a 20 20 4f 6e 67 6f 69 6e 67 3a 20  .   *  Ongoing: 
0280: 77 72 61 70 20 6d 6f 73 74 20 74 68 65 20 63 70  wrap most the cp
0290: 64 6f 5f 73 74 6d 74 20 61 6e 64 20 63 70 64 6f  do_stmt and cpdo
02a0: 5f 64 72 69 76 65 72 20 41 50 49 73 20 69 6e 74  _driver APIs int
02b0: 6f 20 63 6f 6e 76 65 6e 69 65 6e 63 65 20 66 75  o convenience fu
02c0: 6e 63 74 69 6f 6e 73 2c 20 66 6f 72 20 63 6f 64  nctions, for cod
02d0: 65 20 72 65 61 64 61 62 69 6c 69 74 79 20 72 65  e readability re
02e0: 61 73 6f 6e 73 2e 0d 0a 20 20 20 2a 20 20 41 64  asons...   *  Ad
02f0: 64 20 61 20 27 67 65 74 20 6e 75 6d 62 65 72 20  d a 'get number 
0300: 6f 66 20 61 66 66 65 63 74 65 64 20 72 6f 77 73  of affected rows
0310: 27 20 66 65 61 74 75 72 65 20 74 6f 20 74 68 65  ' feature to the
0320: 20 41 50 49 20 28 65 2e 67 2e 20 66 6f 72 20 49   API (e.g. for I
0330: 4e 53 45 52 54 20 61 6e 64 20 44 45 4c 45 54 45  NSERT and DELETE
0340: 20 73 74 61 74 65 6d 65 6e 74 73 29 2e 20 54 68   statements). Th
0350: 65 20 70 72 6f 62 6c 65 6d 20 77 69 74 68 20 74  e problem with t
0360: 68 69 73 20 69 73 20 74 68 61 74 20 73 6f 6d 65  his is that some
0370: 20 64 72 69 76 65 72 73 20 69 6d 70 6c 65 6d 65   drivers impleme
0380: 6e 74 20 69 74 20 61 73 20 61 20 73 74 61 74 65  nt it as a state
0390: 6d 65 6e 74 2d 6c 65 76 65 6c 20 6f 70 65 72 61  ment-level opera
03a0: 74 69 6f 6e 20 61 6e 64 20 73 6f 6d 65 20 61 73  tion and some as
03b0: 20 61 20 64 62 2d 6c 65 76 65 6c 20 6f 70 65 72   a db-level oper
03c0: 61 74 69 6f 6e 2e 20 53 74 61 74 65 6d 65 6e 74  ation. Statement
03d0: 73 20 63 61 6e 20 28 77 69 74 68 20 6a 75 73 74  s can (with just
03e0: 20 61 20 6c 69 74 74 6c 65 20 65 66 66 6f 72 74   a little effort
03f0: 20 6f 6e 20 74 68 65 20 64 72 69 76 65 72 20 69   on the driver i
0400: 6d 70 6c 65 6d 65 6e 74 6f 72 27 73 20 70 61 72  mplementor's par
0410: 74 29 20 6b 65 65 70 20 61 20 68 61 6e 64 6c 65  t) keep a handle
0420: 20 74 6f 20 74 68 65 69 72 20 64 72 69 76 65 72   to their driver
0430: 2c 20 73 6f 20 74 68 65 20 69 6e 73 74 69 6e 63  , so the instinc
0440: 74 20 69 73 20 74 6f 20 61 64 64 20 74 68 69 73  t is to add this
0450: 20 74 6f 20 74 68 65 20 73 74 61 74 65 6d 65 6e   to the statemen
0460: 74 20 41 50 49 2e 20 48 6f 77 65 76 65 72 2c 20  t API. However, 
0470: 77 65 20 74 68 65 6e 20 63 6f 75 6c 64 20 6e 6f  we then could no
0480: 74 20 75 73 65 20 74 68 69 73 20 66 75 6e 63 74  t use this funct
0490: 69 6f 6e 61 6c 69 74 79 20 66 72 6f 6d 20 63 6c  ionality from cl
04a0: 69 65 6e 74 20 63 6f 64 65 20 75 6e 6c 65 73 73  ient code unless
04b0: 20 74 68 65 20 63 6c 69 65 6e 74 20 6d 61 6e 75   the client manu
04c0: 61 6c 6c 79 20 70 72 65 70 61 72 65 73 20 74 68  ally prepares th
04d0: 65 20 73 74 61 74 65 6d 65 6e 74 20 28 61 73 20  e statement (as 
04e0: 6f 70 70 6f 73 65 64 20 74 6f 20 72 75 6e 6e 69  opposed to runni
04f0: 6e 67 20 69 74 20 74 68 72 6f 75 67 68 20 3c 74  ng it through <t
0500: 74 3e 63 70 64 6f 5f 65 78 65 63 28 29 3c 2f 74  t>cpdo_exec()</t
0510: 74 3e 20 6f 72 20 74 68 65 20 6c 69 6b 65 29 2e  t> or the like).
0520: 20 48 6d 6d 6d 2e 20 57 65 20 63 6f 75 6c 64 20   Hmmm. We could 
0530: 61 6c 73 6f 20 73 74 6f 72 65 20 69 74 20 69 6e  also store it in
0540: 20 74 68 65 20 64 72 69 76 65 72 20 66 72 6f 6d   the driver from
0550: 20 74 68 65 20 73 74 61 74 65 6d 65 6e 74 20 69   the statement i
0560: 6e 74 65 72 6e 61 6c 73 2c 20 62 75 74 20 74 68  nternals, but th
0570: 61 74 20 68 61 73 20 69 6e 68 65 72 65 6e 74 20  at has inherent 
0580: 74 68 72 65 61 64 69 6e 67 2d 72 65 6c 61 74 65  threading-relate
0590: 64 20 70 72 6f 62 6c 65 6d 73 2e 0d 0a 20 20 20  d problems...   
05a0: 2a 20 20 4d 6f 73 74 20 6f 66 20 74 68 65 20 64  *  Most of the d
05b0: 72 69 76 65 72 2d 6c 65 76 65 6c 20 70 72 69 76  river-level priv
05c0: 61 74 65 20 73 74 61 74 65 2c 20 6f 74 68 65 72  ate state, other
05d0: 20 74 68 61 6e 20 74 68 65 20 75 6e 64 65 72 6c   than the underl
05e0: 79 69 6e 67 20 64 62 20 68 61 6e 64 6c 65 2c 20  ying db handle, 
05f0: 77 68 69 63 68 20 74 68 65 20 64 72 69 76 65 72  which the driver
0600: 20 69 6d 70 6c 73 20 63 75 72 72 65 6e 74 6c 79   impls currently
0610: 20 68 6f 6c 64 20 68 61 73 20 74 6f 20 64 6f 20   hold has to do 
0620: 77 69 74 68 20 74 68 65 20 74 72 61 6e 73 61 63  with the transac
0630: 74 69 6f 6e 2d 72 65 6c 61 74 65 64 20 41 50 49  tion-related API
0640: 73 20 28 74 68 65 79 20 6e 65 65 64 20 74 6f 20  s (they need to 
0650: 72 65 6d 65 6d 62 65 72 20 69 66 20 74 68 65 79  remember if they
0660: 27 72 65 20 69 6e 20 61 20 74 72 61 6e 73 61 63  're in a transac
0670: 74 69 6f 6e 20 6f 72 20 6e 6f 74 29 2e 20 43 6f  tion or not). Co
0680: 6e 73 69 64 65 72 20 72 65 6d 6f 76 69 6e 67 20  nsider removing 
0690: 74 68 65 20 74 72 61 6e 73 61 63 74 69 6f 6e 20  the transaction 
06a0: 41 50 49 20 73 6f 20 74 68 61 74 20 77 65 20 63  API so that we c
06b0: 61 6e 20 61 6c 6c 6f 77 20 74 68 6f 73 65 20 64  an allow those d
06c0: 72 69 76 65 72 73 20 74 6f 20 62 65 20 6d 75 6c  rivers to be mul
06d0: 74 69 2d 74 68 72 65 61 64 2d 63 61 70 61 62 6c  ti-thread-capabl
06e0: 65 20 61 73 20 6c 6f 6e 67 20 61 73 20 74 68 65  e as long as the
06f0: 20 75 6e 64 65 72 6c 79 69 6e 67 20 64 72 69 76   underlying driv
0700: 65 72 20 73 75 70 70 6f 72 74 73 20 69 74 2e 0d  er supports it..
0710: 0a 20 20 20 2a 20 20 41 64 64 20 61 6e 20 6f 70  .   *  Add an op
0720: 74 69 6f 6e 61 6c 20 63 6c 69 65 6e 74 2d 64 65  tional client-de
0730: 66 69 6e 65 64 20 6d 75 74 65 78 2c 20 73 69 6d  fined mutex, sim
0740: 69 6c 61 72 6c 79 20 74 6f 20 77 68 61 74 20 77  ilarly to what w
0750: 65 20 64 6f 20 69 6e 20 74 68 65 20 77 68 61 6c  e do in the whal
0760: 6c 6f 63 20 63 6f 64 65 2e 20 69 27 6d 20 6e 6f  loc code. i'm no
0770: 74 20 73 75 72 65 20 77 65 20 63 61 6e 20 70 72  t sure we can pr
0780: 6f 76 69 64 65 20 72 65 61 6c 20 6c 6f 63 6b 69  ovide real locki
0790: 6e 67 20 73 61 66 65 74 79 20 77 69 74 68 6f 75  ng safety withou
07a0: 74 20 74 68 65 20 63 6c 69 65 6e 74 20 6d 61 6e  t the client man
07b0: 75 61 6c 6c 79 20 64 6f 69 6e 67 20 74 68 65 20  ually doing the 
07c0: 6c 6f 63 6b 69 6e 67 2f 75 6e 6c 6f 63 6b 69 6e  locking/unlockin
07d0: 67 2c 20 74 68 6f 75 67 68 2c 20 64 75 65 20 74  g, though, due t
07e0: 6f 20 74 68 65 20 6e 6f 6e 2d 61 74 6f 6d 69 63  o the non-atomic
07f0: 20 6e 61 74 75 72 65 20 6f 66 20 6d 61 6e 79 20   nature of many 
0800: 64 62 20 6f 70 65 72 61 74 69 6f 6e 2e 0d 0a 20  db operation... 
0810: 20 20 2a 20 20 50 6f 72 74 20 74 68 65 20 22 73    *  Port the "s
0820: 71 6c 69 74 65 33 2d 74 6f 2d 4a 53 4f 4e 22 20  qlite3-to-JSON" 
0830: 63 6f 6e 76 65 72 74 65 72 20 74 6f 20 63 70 64  converter to cpd
0840: 6f 2e 0d 0a 0d 0a 4f 74 68 65 72 20 72 61 6e 64  o.....Other rand
0850: 6f 6d 20 74 68 6f 75 67 68 74 73 3a 0d 0a 0d 0a  om thoughts:....
0860: 20 20 20 2a 20 20 69 20 73 74 69 6c 6c 20 6e 65     *  i still ne
0870: 65 64 20 74 6f 20 77 72 69 74 65 20 22 4a 53 50  ed to write "JSP
0880: 44 4f 22 2c 20 61 20 4a 61 76 61 53 63 72 69 70  DO", a JavaScrip
0890: 74 20 76 61 72 69 61 6e 74 20 6f 66 20 50 44 4f  t variant of PDO
08a0: 20 66 6f 72 20 74 68 65 20 47 6f 6f 67 6c 65 20   for the Google 
08b0: 76 38 20 4a 53 20 65 6e 67 69 6e 65 2e 20 54 68  v8 JS engine. Th
08c0: 61 74 20 69 64 65 61 20 77 61 73 20 74 68 65 20  at idea was the 
08d0: 69 6e 69 74 69 61 6c 20 69 6e 73 70 69 72 61 74  initial inspirat
08e0: 69 6f 6e 20 62 65 68 69 6e 64 20 74 68 69 73 20  ion behind this 
08f0: 70 72 6f 6a 65 63 74 20 28 74 68 6f 75 67 68 20  project (though 
0900: 61 20 70 72 6f 6a 65 63 74 20 61 74 20 77 6f 72  a project at wor
0910: 6b 20 66 69 6e 61 6c 6c 79 20 67 6f 74 20 6d 65  k finally got me
0920: 20 69 6e 20 74 68 65 20 6d 6f 6f 64 20 74 6f 20   in the mood to 
0930: 69 6d 70 6c 65 6d 65 6e 74 20 69 74 29 2e 0d 0a  implement it)...
0940: 20 20 20 2a 20 20 69 20 74 68 69 6e 6b 20 74 68     *  i think th
0950: 65 72 65 20 61 72 65 20 73 6f 6d 65 20 72 65 61  ere are some rea
0960: 6c 6c 79 20 69 6e 74 65 72 65 73 74 69 6e 67 20  lly interesting 
0970: 70 6f 73 73 69 62 69 6c 69 74 69 65 73 20 66 6f  possibilities fo
0980: 72 20 69 6e 74 72 6f 64 75 63 69 6e 67 20 61 20  r introducing a 
0990: 22 4a 53 4f 4e 20 44 62 20 41 50 49 22 2c 20 77  "JSON Db API", w
09a0: 68 65 72 65 20 74 68 65 20 44 42 73 20 6f 6e 6c  here the DBs onl
09b0: 79 20 68 61 76 65 20 74 6f 20 73 75 70 70 6f 72  y have to suppor
09c0: 74 20 74 68 65 20 76 61 6c 75 65 20 74 79 70 65  t the value type
09d0: 73 20 73 75 70 70 6f 72 74 65 64 20 69 6e 20 4a  s supported in J
09e0: 53 4f 4e 20 28 74 68 65 79 20 63 6f 75 6c 64 20  SON (they could 
09f0: 73 69 6d 75 6c 61 74 65 20 4a 53 4f 4e 20 62 6f  simulate JSON bo
0a00: 6f 6c 65 61 6e 73 20 77 69 74 68 20 69 6e 74 65  oleans with inte
0a10: 67 65 72 73 29 2e 20 57 65 20 63 6f 75 6c 64 20  gers). We could 
0a20: 75 73 65 20 61 6e 20 61 76 61 69 6c 61 62 6c 65  use an available
0a30: 20 4a 53 4f 4e 20 6c 69 62 72 61 72 79 20 28 5b   JSON library ([
0a40: 68 74 74 70 3a 2f 2f 66 6f 73 73 69 6c 2e 77 61  http://fossil.wa
0a50: 6e 64 65 72 69 6e 67 68 6f 72 73 65 2e 6e 65 74  nderinghorse.net
0a60: 2f 72 65 70 6f 73 2f 6e 6f 73 6a 6f 62 2f 7c 6e  /repos/nosjob/|n
0a70: 6f 73 6a 6f 62 5d 20 61 6e 64 20 5b 68 74 74 70  osjob] and [http
0a80: 3a 2f 2f 66 6f 73 73 69 6c 2e 77 61 6e 64 65 72  ://fossil.wander
0a90: 69 6e 67 68 6f 72 73 65 2e 6e 65 74 2f 72 65 70  inghorse.net/rep
0aa0: 6f 73 2f 63 73 6f 6e 2f 7c 63 73 6f 6e 5d 20 62  os/cson/|cson] b
0ab0: 6f 74 68 20 69 6d 6d 65 64 69 61 74 65 6c 79 20  oth immediately 
0ac0: 63 6f 6d 65 20 74 6f 20 6d 69 6e 64 29 20 61 6e  come to mind) an
0ad0: 64 20 77 72 61 70 20 44 42 20 69 6e 70 75 74 2f  d wrap DB input/
0ae0: 6f 75 74 70 75 74 20 76 61 6c 75 65 73 20 76 69  output values vi
0af0: 61 20 74 68 6f 73 65 20 4a 53 4f 4e 2d 6d 6f 64  a those JSON-mod
0b00: 65 6c 69 6e 67 20 41 50 49 73 2e 20 53 75 63 68  eling APIs. Such
0b10: 20 61 20 22 6c 6f 77 65 73 74 20 63 6f 6d 6d 6f   a "lowest commo
0b20: 6e 20 64 65 6d 6f 6e 69 6e 61 74 6f 72 22 20 44  n demoninator" D
0b30: 42 20 41 50 49 2c 20 69 6e 20 63 6f 6e 6a 75 6e  B API, in conjun
0b40: 63 74 69 6f 6e 20 77 69 74 68 20 65 78 70 6c 69  ction with expli
0b50: 63 69 74 20 4a 53 4f 4e 20 73 65 6d 61 6e 74 69  cit JSON semanti
0b60: 63 73 2c 20 63 6f 75 6c 64 20 68 61 76 65 20 73  cs, could have s
0b70: 6f 6d 65 20 69 6e 74 65 72 65 73 74 69 6e 67 20  ome interesting 
0b80: 61 70 70 6c 69 63 61 74 69 6f 6e 73 2e 20 41 6e  applications. An
0b90: 64 20 77 72 69 74 69 6e 67 20 61 6e 20 4f 52 4d  d writing an ORM
0ba0: 20 6f 6e 20 74 6f 70 20 6f 66 20 74 68 61 74 20   on top of that 
0bb0: 73 68 6f 75 6c 64 20 62 65 20 72 65 6c 61 74 69  should be relati
0bc0: 76 65 6c 79 20 73 69 6d 70 6c 65 2e 20 53 75 63  vely simple. Suc
0bd0: 68 20 61 20 66 72 61 6d 65 77 6f 72 6b 69 20 77  h a frameworki w
0be0: 6f 75 6c 64 20 62 65 20 65 61 73 79 20 74 6f 20  ould be easy to 
0bf0: 63 72 65 61 74 65 20 6f 6e 20 74 6f 70 20 6f 66  create on top of
0c00: 20 61 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f   a combination o
0c10: 66 20 63 70 64 6f 20 61 6e 64 20 5b 68 74 74 70  f cpdo and [http
0c20: 3a 2f 2f 66 6f 73 73 69 6c 2e 77 61 6e 64 65 72  ://fossil.wander
0c30: 69 6e 67 68 6f 72 73 65 2e 6e 65 74 2f 72 65 70  inghorse.net/rep
0c40: 6f 73 2f 63 73 6f 6e 2f 7c 63 73 6f 6e 5d 2e 0a  os/cson/|cson]..
0c50: 0a 5a 20 34 65 64 61 39 63 37 61 64 37 32 30 63  .Z 4eda9c7ad720c
0c60: 33 38 36 62 31 65 37 31 33 30 35 35 31 33 33 34  386b1e7130551334
0c70: 30 35 35 0a                                      055.