# # add_file "contrib/usher.cc" # # add_file "po/ja.po" # # add_file "sqlite/analyze.c" # # add_file "sqlite/complete.c" # # add_file "sqlite/vdbefifo.c" # # add_file "tests/t_restriction_with_exclude_iprint.at" # # patch "AUTHORS" # from [87106004cb5e54910ebdd29989f7c83baf707bd1] # to [f735fbbf50cbfa0258a4fc76d70b4781fd06c60a] # # patch "ChangeLog" # from [a8f0f6c5ccc10b4f16e1776741a2ed08326fdd34] # to [0f79b1bab4944e0d171410d02195b6e0aa344b39] # # patch "Makefile.am" # from [7a233d22f09d1b0d6eb2f010fdbb0cf97461af6c] # to [f64733542ba308ba4047d2e7cfc8a18f95d0eb4c] # # patch "contrib/usher.cc" # from [] # to [8cb23c92752ea67f7858372494985d2d6204afaf] # # patch "database.cc" # from [83c0e4fe4b672da030bc50966c118ac0c2c98017] # to [4a6486b38a02fec9b281ae4a665f209bb9f3440e] # # patch "netcmd.cc" # from [75a0d51313f112ec54f83d29eca1d1077d2547bb] # to [38e6b3a85549ed7c7e5f109623d9ea1b802fc340] # # patch "netcmd.hh" # from [8bea78d5e3429c65cc158c90450a7473528ceb07] # to [87007edfa58287e177df2f3246b28eaa5c5f6146] # # patch "netsync.cc" # from [6e37489151e0809548e293eb4d0495b8921cebfe] # to [5d53bf85b20e88af400ccea87f1233eefdfd5daa] # # patch "po/LINGUAS" # from [02e7af15c4d5ffa79b9f5cb01a42e5c264c050ab] # to [a82820f5b13863f931834a13a478efa99a9fb19d] # # patch "po/ja.po" # from [] # to [a3ec19a708293db5a8a1247f2c1dafaf367e6827] # # patch "sanity.hh" # from [4b60e04581e65bb1426c17f8807b37ec0e7775d8] # to [2c8cee0f678668a356de29a5c61fb3eed8c87b74] # # patch "schema_migration.cc" # from [38c6a6d8a82751cc80ff017b0a7f863d0b50eac6] # to [282f8216d2face69303858b84939b3f01ffdd6c6] # # patch "sqlite/alter.c" # from [03041f2464e22532601254f87cb49997fa21dcdf] # to [26d755f2143719dd3f5b8aaf6cbe3c7f95332528] # # patch "sqlite/analyze.c" # from [] # to [43a2d91242bdd71b6c299378f6b11e896ee5e43d] # # patch "sqlite/attach.c" # from [3615dbe960cbee4aa5ea300b8a213dad36527b0f] # to [4b21689700a72ae281fa85dbaff06b2a62bd49ee] # # patch "sqlite/auth.c" # from [18c5a0befe20f3a58a41e3ddd78f372faeeefe1f] # to [31e2304bef67f44d635655f44234387ea7d21454] # # patch "sqlite/btree.c" # from [d2e09ebf755bfd665727133361b22c6a915b12d7] # to [236126155d5607da945d33514218cbec762d887e] # # patch "sqlite/btree.h" # from [41a71ce027db9ddee72cb43df2316bbe3a1d92af] # to [1ed561263ca0e335bc3e81d761c9d5ff8c22f61e] # # patch "sqlite/build.c" # from [593d8fda0576a72e6f1fbf8f1a61db110dde9264] # to [74653e045581bfbadb8b35a0cb38a62f4a2c850e] # # patch "sqlite/callback.c" # from [0910b611e0c158f107ee3ff86f8a371654971e2b] # to [9a1162c8f9dae9fad6d548339669aacb5f6cf76b] # # patch "sqlite/complete.c" # from [] # to [641713ef01657f74037840abb9c0a4552c07b0d0] # # patch "sqlite/date.c" # from [2134ef4388256e8247405178df8a61bd60dc180a] # to [7444b0900a28da77e57e3337a636873cff0ae940] # # patch "sqlite/delete.c" # from [4b68127f55971c7fb459146e0b6cf3bd70cfffe9] # to [16a0e19460b14d219f39ff5c7a9eef808aa1969c] # # patch "sqlite/expr.c" # from [6d7058944c5f4b7e4304be3fe63ada91dac221a1] # to [b8dbd5a30e80b83b0c1e137dcfcd687bd5d2b76c] # # patch "sqlite/func.c" # from [f208d71f741d47b63277530939f552815af8ce35] # to [f63d417248808ff2632a3b576536abffcc21d858] # # patch "sqlite/insert.c" # from [8c0868a975fe37366ed92e1b976853be96284607] # to [484c73bc1309f283a31baa0e114f3ee980536397] # # patch "sqlite/keywordhash.h" # from [9f753ca12591e9ac7d627850e28217bf1fb96c26] # to [32380a4bfe997d18e3ecd5b85fd948cf7b52aec8] # # patch "sqlite/main.c" # from [16ab37b7b3aa57bcfb6b687474b2553c67b1a7fe] # to [422014201f22aa17b96c76650163178a91a825af] # # patch "sqlite/opcodes.c" # from [09ba45fa2716974a205f0514fda43e0d52c50ecc] # to [8b23c96979492cba740a2e3c67f6646e8b323b12] # # patch "sqlite/opcodes.h" # from [c350694b63ef80daafa7d04f71a6d921aa4935e2] # to [1848e78f249e09e0b773754679d6584412f8900f] # # patch "sqlite/os.h" # from [c4b34bd4d6fea51a420f337468b907f4edecb161] # to [c51f2747f7bd1840447e2c7d26db749604626814] # # patch "sqlite/os_common.h" # from [0e7f428ba0a6c40a61bc56c4e96f493231301b73] # to [1ff88c7e7e6bd3e5f85443106c91cc26a4f8600b] # # patch "sqlite/os_unix.c" # from [45540d7ee5095566da6685d584598edee5be857c] # to [c86cf43b7ca9200e6fb7bc202ad2cc7da2f69367] # # patch "sqlite/os_unix.h" # from [39a393252e69e72b06715c9958df05ddbc4aa971] # to [5768d56d28240d3fe4537fac08cc85e4fb52279e] # # patch "sqlite/os_win.c" # from [fe7b99cfcfb61d9bf54493ddf5857885a657fb89] # to [ed03a35b2894f9b99840415f941a9f8594dea756] # # patch "sqlite/pager.c" # from [841a2cdddd4275de36cda26ed9dc54ae942660ce] # to [adbb27f13ac75cd5bc29a3d84803e0cab1edfa88] # # patch "sqlite/pager.h" # from [0d9153d6269d60d04af3dd84a0cc0a96253cf4a4] # to [17b13225abd93c1e9f470060f40a21b9edb5a164] # # patch "sqlite/parse.c" # from [6671523c392fcf8287c08e5896cc2513987fc5cb] # to [9f03b15f12e12a7952705f50d01e3ac97bb81e34] # # patch "sqlite/parse.h" # from [55c238b9c97ae9a71722f2fabf3e0d23660e4e63] # to [c3a865a73a9e4988142a3008f99d3cc91fdf77b4] # # patch "sqlite/pragma.c" # from [5ea2ba0e43f6a83968a936b071b77bd4516d11f0] # to [6d773e25e8af13ef0820531ad2793417f8a8959d] # # patch "sqlite/prepare.c" # from [d53602d2f8e097225ae7c76ec764ae68f759ba47] # to [fc098db25d2a121affb08686cf04833fd50452d4] # # patch "sqlite/printf.c" # from [3d20b21cfecadacecac3fb7274e746cb81d3d357] # to [bd421c1ad5e01013c89af63c60eab02852ccd15e] # # patch "sqlite/select.c" # from [28b752e58955c7920711fbdbfdcd369a2bd09448] # to [9ef1dddd436e1ea86a6bf64ae0ed71bf4a0b894f] # # patch "sqlite/sqlite3.h" # from [97fec5750fa71f8b162c9571a7e08413de9886ed] # to [d1ab08a3d92270801782adad0dad0f31d6df7761] # # patch "sqlite/sqliteInt.h" # from [0722b47bae7acb182bf43be3585537027c63f741] # to [e78a7c53a97a2e5d8d6370b6836b2921124ac26f] # # patch "sqlite/tokenize.c" # from [4b45f8c000202c877bcc567688c2ec21a01984b3] # to [e1faf5637f3f4f90933785a0ecf64595f3ac3530] # # patch "sqlite/update.c" # from [e96c7b342cd8903c672162f4cf84d2c737943347] # to [c2716c2115533ffae3d08bf8853aaba4f970f37e] # # patch "sqlite/util.c" # from [96008b52604d08b9cc57ed37350149d6ac8a1bf3] # to [55caaffbb2716f9928ab452d20f3e9cbbeab872d] # # patch "sqlite/vdbe.c" # from [c2511f392598928254504e3b2c5ec47f4fef2b53] # to [de007d59f036fcd1b89a7d4172aa0d028e8689eb] # # patch "sqlite/vdbe.h" # from [75e466d84d362b0c4498978a9d6b1e6bd32ecf3b] # to [c8e105979fc7aaf5b8004e9621904e3bd096dfa2] # # patch "sqlite/vdbeInt.h" # from [4312faf41630a6c215924b6c7c2f39ebb1af8ffb] # to [3dd2a29c7b0a55404c35f93caae81fb42f4cb70a] # # patch "sqlite/vdbeapi.c" # from [3f858d2236df0d127249a6a166e0e25b5de650ed] # to [85bbe1d0243a89655433d60711b4bd71979b59cd] # # patch "sqlite/vdbeaux.c" # from [c99e32abeba4b7522e3922afff2c32ff4bd17eb5] # to [57a6ced8417bdc6f06c391d9c560ecbbed644ef3] # # patch "sqlite/vdbefifo.c" # from [] # to [9efb94c8c3f4c979ebd0028219483f88e57584f5] # # patch "sqlite/vdbemem.c" # from [48a64ae95a9edc6e8d940300dad15d70d1670398] # to [fea0744936008831daa17cdc75056c3ca1469690] # # patch "sqlite/where.c" # from [3a9a2258ab3364655e9ea215ad5ae7bf41813f54] # to [1cc55c9aa142c7ef09b427f5fd0bf0488e365fc4] # # patch "tests/t_log_brief.at" # from [41e612ccf6a0320c64b89a7cf39996d466b3f07c] # to [659ab85957e702aba713117d071bea86bd74aebf] # # patch "tests/t_restriction_with_exclude_iprint.at" # from [] # to [4a5f81447a9aef3715473d174138a2ad610d7d00] # # patch "testsuite.at" # from [9843a5c53ec471614fc6d5ef5dfcf16fc6995608] # to [4405c8c3584fd8462446135258c4bb1f1c7d41fd] # # patch "ui.cc" # from [77a48bddc373a115f5ec6cc0077afa17a2a762d0] # to [2c9b65e320b66d6b104bee5885723c4f97f36e8b] # # patch "ui.hh" # from [d5866bba3cc59b130fb56ba40e0780801d4314f9] # to [13817f413857ee072ca9ed1aa5dc90e51aaa0069] # ======================================================================== --- AUTHORS 87106004cb5e54910ebdd29989f7c83baf707bd1 +++ AUTHORS f735fbbf50cbfa0258a4fc76d70b4781fd06c60a @@ -72,8 +72,8 @@ subdirectory. Contributors include: Benoît Dejean + Satoru SATOH - supporting files: ----------------- ======================================================================== --- ChangeLog a8f0f6c5ccc10b4f16e1776741a2ed08326fdd34 +++ ChangeLog 0f79b1bab4944e0d171410d02195b6e0aa344b39 @@ -1,3 +1,74 @@ +2005-09-20 Matt Johnston + + * database.cc (space_usage): workaround the issue that in sqlite + 3.2.6, SUM({empty set}) returns NULL. (this is part of the sql spec, + see http://www.sqlite.org/cvstrac/tktview?tn=1413 and the comment for + SUM() in sqlite docs). + +2005-09-20 Matt Johnston + + * ui.cc, ui.hh, sanity.hh: replace ui.user_locale with + get_user_locale(), so that we can guarantee that it will be + initialised when the global_sanity object (and probably other things) + are instantiated. + +2005-09-20 Matthew Gregan + + * tests/t_restriction_with_exclude_iprint.at: New test, variant of + t_restriction_exclude.at, but with inodeprints enabled. Mark as + XFAILed. + * testsuite.at: Add new test. + * sqlite/*: Update in-tree SQLite from 3.2.2 to 3.2.6. + * Makefile.am: Add sqlite/{analyze,vbdefifo,complete}.c to + SQLITE_SOURCES + * schema_migration.cc (calculate_schema_id): Explicitly exclude + sqlite_stat1 table from schema ID calculation. This is a new + magic table created by the 'analyze' command in SQLite >= 3.2.3. + +2005-09-18 Nathaniel Smith + + * po/ja.po: New translation from Satoru SATOH . + * AUTHORS: Add Satoru SATOH. + +2005-09-18 Matthew Gregan + + * testsuite.at: Tweak default 'eveything' netsync glob to + something that works around the MinGW/Win32 globbing issues for + now. + * tests/t_log_brief.at: Canonicalise output on Win32. + +2005-09-17 Timothy Brownawell + + * contrib/usher.cc: Remove stray "new int[2];' statements from + debugging. Remove connections from list when finished. + +2005-09-16 Timothy Brownawell + + * Makefile.am (EXTRA_DIST): add contrib/monotone-cvs-ignore.lua, + contrib/ciabot_monotone_hookversion.py, and contrib/usher.cc . + also remove duplicate of contrib/monoprof.sh + +2005-09-16 Timothy Brownawell + + * netsync.cc: finish renaming things, so it compiles again... + +2005-09-16 Timothy Brownawell + + * contrib/usher.cc: A simple usher/proxy server. It asks connecting + clients for their include pattern, and then forwards the connection + to an appropriate (as given in a config file) monotone server. Note + that all servers operating behind one usher need to have the same + server key. + +2005-09-16 Timothy Brownawell + + * netcmd.{cc,hh}, netsync.cc: new netcmd types: usher_cmd and + usher_reply_cmd. They are not included in the HMAC, and do not + occur during normal communication. Purpose: running multiple servers + from the same port. This allows a special server to ask for the + client's include pattern, and then forward the connection to a real + monotone server. + 2005-09-16 Matt Johnston * botan/pkcs8.cpp: re-add the monotone-specific code for guessing if ======================================================================== --- Makefile.am 7a233d22f09d1b0d6eb2f010fdbb0cf97461af6c +++ Makefile.am f64733542ba308ba4047d2e7cfc8a18f95d0eb4c @@ -167,6 +167,8 @@ sqlite/vdbe.c sqlite/vdbeapi.c sqlite/vdbeaux.c \ sqlite/vdbemem.c sqlite/where.c \ sqlite/prepare.c sqlite/callback.c \ + sqlite/analyze.c sqlite/vdbefifo.c \ + sqlite/complete.c \ \ sqlite/btree.h sqlite/config.h sqlite/hash.h sqlite/opcodes.h sqlite/os.h \ sqlite/os_common.h sqlite/os_unix.h sqlite/os_win.h \ @@ -344,12 +346,14 @@ contrib/monotone-nav.el \ contrib/monotone.bash_completion \ contrib/monotone.zsh_completion \ - contrib/monoprof.sh \ contrib/mtbrowse.sh \ contrib/colorize \ contrib/color-logs.sh \ contrib/color-logs.conf \ contrib/get_stdio.pl \ + contrib/ciabot_monotone_hookversion.py \ + contrib/monotone-cvs-ignore.lua \ + contrib/usher.cc \ win32/monotone.iss \ $(wildcard $(srcdir)/debian/*) ======================================================================== --- contrib/usher.cc +++ contrib/usher.cc 8cb23c92752ea67f7858372494985d2d6204afaf @@ -0,0 +1,508 @@ +// Timothy Brownawell +// GPL v2 +// +// This is an "usher" to allow multiple monotone servers to work from +// the same port. It asks the client for the pattern it wants to sync, +// and then looks up the matching server in a table. It then forwards +// the connection to that server. All servers using the same usher need +// to have the same server key. +// +// This requires cooperation from the client, which means it only works +// for recent (post-0.22) clients. +// +// Usage: usher +// +// is the local port to listen on +// is a file containing lines of +// stem ip-address port-number +// +// A request for a pattern starting with "stem" will be directed to the +// server at : + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +int listenport = 5253; + +char const netsync_version = 5; + +char const * const greeting = " Hello! This is the monotone usher at localhost. What would you like?"; + +char const * const errmsg = "!Sorry, I don't know where to find that."; + + +#undef max +#define max(x,y) ((x) > (y) ? (x) : (y)) + +struct errstr +{ + std::string name; + int err; + errstr(std::string const & s, int e): name(s), err(e) {} +}; + +int tosserr(int ret, std::string const & name) +{ + if (ret == -1) + throw errstr(name, errno); + if (ret < 0) + throw errstr(name, ret); + return ret; +} + +struct record +{ + std::string stem; + std::string addr; + int port; +}; + +std::list servers; + +bool get_server(std::string const & reply, std::string & addr, int & port) +{ + std::list::iterator i; + for (i = servers.begin(); i != servers.end(); ++i) { + if (reply.find(i->stem) == 0) + break; + } + if (i == servers.end()) { + std::cerr<<"no server found for "<port; + addr = i->addr; +// std::cerr<<"server for "< +// byte 0x80 | +// ... +// byte 0xff & +// +// the high bit says that this byte is not the last + +void make_packet(std::string const & msg, char * & pkt, int & size) +{ + size = msg.size(); + char const * txt = msg.c_str(); + char header[6]; + header[0] = netsync_version; + header[1] = 100; + int headersize; + if (size >= 128) { + header[2] = 0x80 | (0x7f & (char)(size+2)); + header[3] = (char)((size+2)>>7); + header[4] = 0x80 | (0x7f & (char)(size)); + header[5] = (char)(size>>7); + headersize = 6; + } else if (size >= 127) { + header[2] = 0x80 | (0x7f & (char)(size+1)); + header[3] = (char)((size+1)>>7); + header[4] = (char)(size); + headersize = 5; + } else { + header[2] = (char)(size+1); + header[3] = (char)(size); + headersize = 4; + } + pkt = new char[headersize + size]; + memcpy(pkt, header, headersize); + memcpy(pkt + headersize, txt, size); + size += headersize; +} + +struct buffer +{ + static int const buf_size = 2048; + static int const buf_reset_size = 1024; + char * ptr; + int readpos; + int writepos; + buffer(): readpos(0), writepos(0) + { + ptr = new char[buf_size]; + } + ~buffer(){delete[] ptr;} + buffer(buffer const & b) + { + ptr = new char[buf_size]; + memcpy(ptr, b.ptr, buf_size); + readpos = b.readpos; + writepos = b.writepos; + } + bool canread(){return writepos > readpos;} + bool canwrite(){return writepos < buf_size;} + void getread(char *& p, int & n) + { + p = ptr + readpos; + n = writepos - readpos; + } + void getwrite(char *& p, int & n) + { + p = ptr + writepos; + n = buf_size - writepos; + } + void fixread(int n) + { + if (n < 0) throw errstr("negative read\n", 0); + readpos += n; + if (readpos == writepos) { + readpos = writepos = 0; + } else if (readpos > buf_reset_size) { + memcpy(ptr, ptr+readpos, writepos-readpos); + writepos -= readpos; + readpos = 0; + } + } + void fixwrite(int n) + { + if (n < 0) throw errstr("negative write\n", 0); + writepos += n; + } +}; + +struct sock +{ + int *s; + operator int(){return s[0];} + sock(int ss) + { + s = new int[2]; + s[0] = ss; + s[1] = 1; + } + sock(sock const & ss){s = ss.s; s[1]++;} + ~sock(){if (s[1]--) return; ::close(s[0]); delete[] s;} + sock operator=(int ss){s[0]=ss;} + void close() + { + if (s[0] == -1) return; + tosserr(shutdown(s[0], SHUT_RDWR), "shutdown()"); + while (::close(s[0]) < 0) { + if (errno != EINTR) throw errstr("close()", 0); + } + s[0]=-1; + } + bool read_to(buffer & buf) + { + char *p; + int n; + buf.getwrite(p, n); + n = read(s[0], p, n); + if (n < 1) { + close(); + return false; + } else + buf.fixwrite(n); + return true; + } + bool write_from(buffer & buf) + { + char *p; + int n; + buf.getread(p, n); + n = write(s[0], p, n); + if (n < 1) { + close(); + return false; + } else + buf.fixread(n); + return true; + } +}; + +sock start(int port) +{ + sock s = tosserr(socket(AF_INET, SOCK_STREAM, 0), "socket()"); + int yes = 1; + tosserr(setsockopt(s, SOL_SOCKET, SO_REUSEADDR, + &yes, sizeof(yes)), "setsockopt"); + sockaddr_in a; + memset (&a, 0, sizeof (a)); + a.sin_port = htons(port); + a.sin_family = AF_INET; + tosserr(bind(s, (sockaddr *) &a, sizeof(a)), "bind"); + listen(s, 10); + return s; +} + +sock make_outgoing(int port, std::string const & address) +{ + sock s = tosserr(socket(AF_INET, SOCK_STREAM, 0), "socket()"); + + struct sockaddr_in a; + memset(&a, 0, sizeof(a)); + a.sin_family = AF_INET; + a.sin_port = htons(port); + + if (!inet_aton(address.c_str(), (in_addr *) &a.sin_addr.s_addr)) + throw errstr("bad ip address format", 0); + + tosserr(connect(s, (sockaddr *) &a, sizeof (a)), "connect()"); + return s; +} + +bool extract_reply(buffer & buf, std::string & out) +{ + char *p; + int n; + buf.getread(p, n); + if (n < 4) return false; + int b = 2; + unsigned int psize = p[b]; + ++b; + if (psize >=128) { + psize = psize - 128 + ((unsigned int)(p[b])<<7); + ++b; + } + if (n < b+psize) return false; + unsigned int size = p[b]; + ++b; + if (size >=128) { + size = size - 128 + ((unsigned int)(p[b])<<7); + ++b; + } + if (n < b+size) return false; + out.clear(); + out.append(p+b, size); + buf.fixread(b + size); +} + +struct channel +{ + sock client; + sock server; + bool have_routed; + bool no_server; + buffer cbuf; + buffer sbuf; + channel(sock & c): client(c), server(-1), + have_routed(false), no_server(false) + { + char * dat; + int size; + make_packet(greeting, dat, size); + char *p; + int n; + sbuf.getwrite(p, n); + if (n < size) size = n; + memcpy(p, dat, size); + sbuf.fixwrite(size); + delete[] dat; + + client.write_from(sbuf); + } + bool is_finished() + { + return (client == -1) && (server == -1); + } + void add_to_select(int & maxfd, fd_set & rd, fd_set & wr, fd_set & er) + { + int c = client; + int s = server; + + if (c > 0) { + FD_SET(c, &er); + if (cbuf.canwrite()) + FD_SET(c, &rd); + if (sbuf.canread()) + FD_SET(c, &wr); + maxfd = max(maxfd, c); + } + if (s > 0) { + FD_SET(s, &er); + if (sbuf.canwrite()) + FD_SET(s, &rd); + if (cbuf.canread()) + FD_SET(s, &wr); + maxfd = max(maxfd, s); + } + } + bool process_selected(fd_set & rd, fd_set & wr, fd_set & er) + { + int c = client; + int s = server; +/* NB: read oob data before normal reads */ + if (c > 0 && FD_ISSET(c, &er)) { + char d; + errno = 0; + if (recv(c, &d, 1, MSG_OOB) < 1) + client.close(), c = -1; + else + send(s, &d, 1, MSG_OOB); + } + if (s > 0 && FD_ISSET(s, &er)) { + char d; + errno = 0; + if (recv(s, &d, 1, MSG_OOB) < 1) + server.close(), s = -1; + else + send(c, &d, 1, MSG_OOB); + } + + char *p=0; + int n; + + if (c > 0 && FD_ISSET(c, &rd)) { + if (!client.read_to(cbuf)) c = -1; + if (!have_routed) { + std::string reply; + if (extract_reply(cbuf, reply)) { + int port; + std::string addr; + if (get_server(reply, addr, port)) { + try { + server = make_outgoing(port, addr); + have_routed = true; + s = server; + } catch (errstr & e) { + std::cerr<<"cannot contact server "< 0 && FD_ISSET(s, &rd)) { + if (!server.read_to(sbuf)) s = -1; + } + + if (c > 0 && FD_ISSET(c, &wr)) { + if (!client.write_from(sbuf)) c = -1; + } + if (s > 0 && FD_ISSET(s, &wr)) { + if (!server.write_from(cbuf)) s = -1; + } + + // close sockets we have nothing more to send to + if (c < 0 && !cbuf.canread()) { + server.close(), s = -1; + } + if ((no_server || have_routed && s < 0) && !sbuf.canread()) { + client.close(), c = -1; + } + } +}; + +int main (int argc, char **argv) +{ + if (argc != 3) { + fprintf (stderr, "Usage\n\tusher \n"); + exit (1); + } + + record rec; + std::ifstream cf(argv[2]); + int pos = 0; + while(cf) { + if (pos == 0) + cf>>rec.stem; + else if (pos == 1) + cf>>rec.addr; + else if (pos == 2) + cf>>rec.port; + else if (pos == 3) { + pos = 0; + servers.push_back(rec); + } + ++pos; + } + + signal (SIGPIPE, SIG_IGN); + + sock h(-1); + try { + h = start(atoi(argv[1])); + } catch (errstr & s) { + std::cerr< channels; + + for (;;) { + fd_set rd, wr, er; + FD_ZERO (&rd); + FD_ZERO (&wr); + FD_ZERO (&er); + FD_SET (h, &rd); + int nfds = h; + channel *newchan = 0; + + for (std::list::iterator i = channels.begin(); + i != channels.end(); ++i) + i->add_to_select(nfds, rd, wr, er); + + int r = select(nfds+1, &rd, &wr, &er, NULL); + + if (r == -1 && errno == EINTR) + continue; + if (r < 0) { + perror ("select()"); + exit (1); + } + if (FD_ISSET(h, &rd)) { + try { + struct sockaddr_in client_address; + unsigned int l = sizeof(client_address); + memset(&client_address, 0, l); + sock cli = tosserr(accept(h, (struct sockaddr *) + &client_address, &l), "accept()"); +// std::cerr<<"connect from "<::iterator> finished; + for (std::list::iterator i = channels.begin(); + i != channels.end(); ++i) { + i->process_selected(rd, wr, er); + if (i->is_finished()) + finished.push_back(i); + } + for (std::list::iterator>::iterator i = finished.begin(); + i != finished.end(); ++i) + channels.erase(*i); + if (newchan) { + channels.push_back(*newchan); + delete newchan; + newchan = 0; + } + } + return 0; +} ======================================================================== --- database.cc 83c0e4fe4b672da030bc50966c118ac0c2c98017 +++ database.cc 4a6486b38a02fec9b281ae4a665f209bb9f3440e @@ -757,7 +757,9 @@ database::space_usage(string const & table, string const & concatenated_columns) { results res; - string query = "SELECT SUM(LENGTH(" + concatenated_columns + ")) FROM " + table; + // COALESCE is required since SUM({empty set}) is NULL. + // the sqlite docs for SUM suggest this as a workaround + string query = "SELECT COALESCE(SUM(LENGTH(" + concatenated_columns + ")), 0) FROM " + table; fetch(res, one_col, one_row, query.c_str()); return lexical_cast(res[0][0]); } ======================================================================== --- netcmd.cc 75a0d51313f112ec54f83d29eca1d1077d2547bb +++ netcmd.cc 38e6b3a85549ed7c7e5f109623d9ea1b802fc340 @@ -62,7 +62,8 @@ cmd_code == other.cmd_code && payload == other.payload; } - + +// note: usher_reply_cmd does not get included in the hmac. void netcmd::write(string & out, chained_hmac & hmac) const { @@ -71,11 +72,15 @@ out += static_cast(cmd_code); insert_variable_length_string(payload, out); - string digest = hmac.process(out, oldlen); - I(hmac.hmac_length == constants::netsync_hmac_value_length_in_bytes); - out.append(digest); + if (cmd_code != usher_reply_cmd) + { + string digest = hmac.process(out, oldlen); + I(hmac.hmac_length == constants::netsync_hmac_value_length_in_bytes); + out.append(digest); + } } +// note: usher_cmd does not get included in the hmac. bool netcmd::read(string_queue & inbuf, chained_hmac & hmac) { @@ -107,6 +112,7 @@ case static_cast(data_cmd): case static_cast(delta_cmd): case static_cast(nonexistant_cmd): + case static_cast(usher_cmd): cmd_code = static_cast(cmd_byte); break; default: @@ -124,21 +130,30 @@ throw bad_decode(F("oversized payload of '%d' bytes") % payload_len); // there might not be enough data yet in the input buffer - if (inbuf.size() < pos + payload_len + constants::netsync_hmac_value_length_in_bytes) + unsigned int minsize; + if (cmd_code == usher_cmd) + minsize = pos + payload_len; + else + minsize = pos + payload_len + constants::netsync_hmac_value_length_in_bytes; + if (inbuf.size() < minsize) { return false; } // grab it before the data gets munged I(hmac.hmac_length == constants::netsync_hmac_value_length_in_bytes); - string digest = hmac.process(inbuf, 0, pos + payload_len); + string digest; + if (cmd_code != usher_cmd) + digest = hmac.process(inbuf, 0, pos + payload_len); payload = extract_substring(inbuf, pos, payload_len, "netcmd payload"); // they might have given us bogus data - string cmd_digest = extract_substring(inbuf, pos, - constants::netsync_hmac_value_length_in_bytes, - "netcmd HMAC"); + string cmd_digest; + if (cmd_code != usher_cmd) + cmd_digest = extract_substring(inbuf, pos, + constants::netsync_hmac_value_length_in_bytes, + "netcmd HMAC"); inbuf.pop_front(pos); if (cmd_digest != digest) throw bad_decode(F("bad HMAC checksum (got %s, wanted %s)\n" @@ -544,7 +559,25 @@ payload += item(); } +void +netcmd::read_usher_cmd(utf8 & greeting) const +{ + size_t pos = 0; + std::string str; + extract_variable_length_string(payload, str, pos, "error netcmd, message"); + greeting = utf8(str); + assert_end_of_buffer(payload, pos, "error netcmd payload"); +} +void +netcmd::write_usher_reply_cmd(utf8 const & pattern) +{ + cmd_code = usher_reply_cmd; + payload.clear(); + insert_variable_length_string(pattern(), payload); +} + + #ifdef BUILD_UNIT_TESTS #include "unit_tests.hh" ======================================================================== --- netcmd.hh 8bea78d5e3429c65cc158c90450a7473528ceb07 +++ netcmd.hh 87007edfa58287e177df2f3246b28eaa5c5f6146 @@ -44,7 +44,16 @@ send_delta_cmd = 9, data_cmd = 10, delta_cmd = 11, - nonexistant_cmd = 12 + nonexistant_cmd = 12, + + // usher commands + // usher_cmd is sent by a server farm (or anyone else who wants to serve + // from multiple databases over the same port), and the reply (containing + // the client's include pattern) is used to choose a server to forward the + // connection to. + // usher_cmd is never sent by the monotone server itself. + usher_cmd = 100, + usher_reply_cmd = 101 } netcmd_code; @@ -158,6 +167,9 @@ void write_nonexistant_cmd(netcmd_item_type type, id const & item); + void read_usher_cmd(utf8 & greeting) const; + void write_usher_reply_cmd(utf8 const & pattern); + }; #endif // __NETCMD_HH__ ======================================================================== --- netsync.cc 6e37489151e0809548e293eb4d0495b8921cebfe +++ netsync.cc 5d53bf85b20e88af400ccea87f1233eefdfd5daa @@ -438,6 +438,7 @@ delta const & del); bool process_nonexistant_cmd(netcmd_item_type type, id const & item); + bool process_usher_cmd(utf8 const & msg); bool merkle_node_exists(netcmd_item_type type, size_t level, @@ -2738,6 +2739,23 @@ } bool +session::process_usher_cmd(utf8 const & msg) +{ + if (msg().size()) + { + if (msg()[0] == '!') + P(F("Received warning from usher: %s") % msg().substr(1)); + else + L(F("Received greeting from usher: %s") % msg().substr(1)); + } + netcmd cmdout; + cmdout.write_usher_reply_cmd(our_include_pattern); + write_netcmd_and_try_flush(cmdout); + L(F("Sent reply.")); + return true; +} + +bool session::merkle_node_exists(netcmd_item_type type, size_t level, prefix const & pref) @@ -2955,6 +2973,16 @@ return process_nonexistant_cmd(type, item); } break; + case usher_cmd: + { + utf8 greeting; + cmd.read_usher_cmd(greeting); + return process_usher_cmd(greeting); + } + break; + case usher_reply_cmd: + return false;// should not happen + break; } return false; } ======================================================================== --- po/LINGUAS 02e7af15c4d5ffa79b9f5cb01a42e5c264c050ab +++ po/LINGUAS a82820f5b13863f931834a13a478efa99a9fb19d @@ -1 +1,2 @@ fr +ja ======================================================================== --- po/ja.po +++ po/ja.po a3ec19a708293db5a8a1247f2c1dafaf367e6827 @@ -0,0 +1,4461 @@ +# ja.po for monotone +# Copyright (C) 2005 Graydon Hoare +# This file is distributed under the same license as the monotone package. +# Satoru SATOH , 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: monotone 0.19\n" +"Report-Msgid-Bugs-To: address@hidden" +"POT-Creation-Date: 2005-08-08 20:24-0700\n" +"PO-Revision-Date: 2005-09-18 14:55+0900\n" +"Last-Translator: Satoru SATOH \n" +"Language-Team: Japanese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: app_state.cc:58 +#, c-format +msgid "initializing from directory %s\n" +msgstr "ディレクトリ %s から初期化中\n" + +#: app_state.cc:59 +#, c-format +msgid "found working copy directory %s\n" +msgstr "作業コピーディレクトリ %s を発見\n" + +#: app_state.cc:61 +#, c-format +msgid "cannot change to directory to %s\n" +msgstr "ディレクトリ %s へ移動できません\n" + +#: app_state.cc:69 +#, c-format +msgid "branch name is '%s'\n" +msgstr "ブランチ名は '%s' です\n" + +#: app_state.cc:75 +#, c-format +msgid "relative directory is '%s'\n" +msgstr "相対ディレクトリは '%s' です\n" + +#: app_state.cc:82 +#, c-format +msgid "setting dump path to %s\n" +msgstr "ダンプパスを %s に設定しています\n" + +#: app_state.cc:93 +#, c-format +msgid "working copy directory required but not found%s%s" +msgstr "必要な作業コピーディレクトリがみつかりませんでした: %s%s" + +#: app_state.cc:101 +msgid "invalid directory ''" +msgstr "無効なディレクトリ ''" + +#: app_state.cc:105 +#, c-format +msgid "cannot change to initial directory %s\n" +msgstr "初期ディレクトリ %s へ移動できません\n" + +#: app_state.cc:109 +#, c-format +msgid "create working copy in %s\n" +msgstr "%s 内に作業コピーを作成\n" + +#: app_state.cc:120 +#, c-format +msgid "could not create directory: %s: %s\n" +msgstr "ディレクトリを作成できませんでした: %s: %s\n" + +#: app_state.cc:125 +#, c-format +msgid "cannot change to new directory %s\n" +msgstr "新しいディレクトリ %s へ移動できません\n" + +#: app_state.cc:134 +#, c-format +msgid "monotone book-keeping directory '%s' already exists in '%s'\n" +msgstr "monotone book-keeping ディレクトリ '%s' は既に '%s' 内にあります\n" + +#: app_state.cc:137 +#, c-format +msgid "creating book-keeping directory '%s' for working copy in '%s'\n" +msgstr "作業コピー用の book-keeping ディレクトリ '%s' を '%s' 内に作成しています\n" + +#: app_state.cc:159 +#, c-format +msgid "'%s' prefixed to '%s'\n" +msgstr "'%s' は '%s' の前に付きます\n" + +#: app_state.cc:178 +#, c-format +msgid "'%s' ignored by restricted path set\n" +msgstr "'%s' は制限パスセットによって無視されました\n" + +#: app_state.cc:183 +#, c-format +msgid "unknown path '%s'\n" +msgstr "不明なパス '%s'\n" + +#: app_state.cc:185 +#, c-format +msgid "'%s' added to restricted path set\n" +msgstr "'%s' を制限パスセットに追加しました\n" + +#: app_state.cc:226 +#, c-format +msgid "checking restricted path set for '%s'\n" +msgstr "'%s' について制限パスセットをチェックしています\n" + +#: app_state.cc:233 +#, c-format +msgid "path '%s' found in restricted path set; '%s' included\n" +msgstr "パス '%s' は制限パスセットに入っています; '%s' が含まれています\n" + +#: app_state.cc:239 +#, c-format +msgid "path '%s' not found in restricted path set; '%s' excluded\n" +msgstr "パス '%s' は制限パスセットに入っていません; '%s' は除外されています\n" + +#: app_state.cc:298 +#, c-format +msgid "search root '%s' does not exist\n" +msgstr "検索ルート '%s' は存在しません\n" + +#: app_state.cc:300 +#, c-format +msgid "search root '%s' is not a directory\n" +msgstr "検索ルート '%s' はディレクトリではありません\n" + +#: app_state.cc:301 +#, c-format +msgid "set search root to %s\n" +msgstr "検索ルートを %s に設定\n" + +#: app_state.cc:332 +msgid "negative depth not allowed\n" +msgstr "深さの値を負にすることはできません\n" + +#: app_state.cc:340 +msgid "negative or zero last not allowed\n" +msgstr "最終値を負または零にすることはできません\n" + +#: app_state.cc:449 +#, c-format +msgid "Failed to read options file %s" +msgstr "オプションファイル '%s' の解析に失敗" + +#: app_state.cc:466 +#, c-format +msgid "Failed to write options file %s" +msgstr "オプションファイル '%s' の書き込みに失敗" + +#: basic_io.cc:26 +#, c-format +msgid "error in %s:%d:%d:E: %s" +msgstr "エラー %s:%d:%d:E: %s" + +#: basic_io.cc:27 +#, c-format +msgid "%s:%d:%d:E: %s" +msgstr "%s:%d:%d:E: %s" + +#: cert.cc:49 +msgid "cert ok\n" +msgstr "証明 OK\n" + +#: cert.cc:56 +#, c-format +msgid "ignoring bad signature by '%s' on '%s'\n" +msgstr "'%s' による '%s' への不正な署名を無視します\n" + +#: cert.cc:64 +#, c-format +msgid "ignoring unknown signature by '%s' on '%s'\n" +msgstr "'%s' による '%s' への不明な署名を無視します\n" + +#: cert.cc:121 +#, c-format +msgid "trust function liked %d signers of %s cert on manifest %s\n" +msgstr "信頼関数 liked %d, %s 証明の署名, マニフェスト %s\n" + +#: cert.cc:127 +#, c-format +msgid "trust function disliked %d signers of %s cert on manifest %s\n" +msgstr "信頼関数 disliked %d, %s 証明の署名, マニフェスト %s\n" + +#: cert.cc:174 +#, c-format +msgid "trust function liked %d signers of %s cert on revision %s\n" +msgstr "信頼関数 liked %d, %s 証明の署名, リビジョン %s\n" + +#: cert.cc:180 +#, c-format +msgid "trust function disliked %d signers of %s cert on revision %s\n" +msgstr "信頼関数 disliked %d, %s 証明の署名, リビジョン %s\n" + +#: cert.cc:269 +#, c-format +msgid "calculated cert hash '%s' does not match '%s'" +msgstr "計算した証明ハッシュ '%s' は '%s' と一致しません" + +#: cert.cc:302 +#, c-format +msgid "address@hidden:%s]" +msgstr "address@hidden:%s]" + +#: cert.cc:303 +#, c-format +msgid "cert: signable text %s\n" +msgstr "証明: 署名テキスト %s\n" + +#: cert.cc:364 keys.cc:480 +#, c-format +msgid "no private key '%s' found in database or get_priv_key hook" +msgstr "秘密鍵 '%s' はデータベース内にも get_priv_key フック内にもみつかりません" + +#: cert.cc:373 +#, c-format +msgid "mismatch between private key '%s' in database and get_priv_key hook" +msgstr "秘密鍵 '%s' はデータベース内のものとも get_priv_key フック内のもの" +"とも一致しません" + +#: cert.cc:477 +msgid "no branch found for empty revision, please provide a branch name" +msgstr "リビジョンが空のブランチはありません. ブランチ名を指定して下さい" + +#: cert.cc:486 +#, c-format +msgid "no branch certs found for revision %s, please provide a branch name" +msgstr "" +"リビジョン %s のブランチ証明がみつかりません. ブランチ名を指定して下さい" + +#: cert.cc:490 +#, c-format +msgid "" +"multiple branch certs found for revision %s, please provide a branch name" +msgstr "リビジョン %s のブランチ証明は複数あります. ブランチ名を指定して下さい" + +#: cert.cc:507 rcs_import.cc:1234 revision.cc:1586 revision.cc:1618 +msgid "no unique private key for cert construction" +msgstr "証明構築のための固有の秘密鍵がありません" + +#: cert.cc:622 +#, c-format +msgid "no default author name for branch '%s'" +msgstr "ブランチ '%s' についてデフォルトの作者 (author) 名がありません" + +#: change_set.cc:290 +#, c-format +msgid "tid %d: parent %d, type %s, name %s\n" +msgstr "tid %d: 親 %d、タイプ %s、名前 %s\n" + +#: change_set.cc:316 +#, c-format +msgid "%d -> %d\n" +msgstr "%d -> %d\n" + +#: change_set.cc:1540 +msgid "concatenating change sets\n" +msgstr "変更セットを結合しています\n" + +#: change_set.cc:1563 +#, c-format +msgid "concatenating %d and %d deltas\n" +msgstr "%d と %d の差分を結合しています\n" + +#: change_set.cc:1573 +#, c-format +msgid "processing delta on %s\n" +msgstr "%s の差分を処理しています\n" + +#: change_set.cc:1577 +#, c-format +msgid "delta on %s in first changeset renamed to %s\n" +msgstr "最初の変更セット内の %s についての差分は %s への名称変更です\n" + +#: change_set.cc:1582 +#, c-format +msgid "discarding delta [%s]->[%s] for deleted file '%s'\n" +msgstr "差分 [%s]->[%s] (対象は削除されたファイル '%s') を破棄しています\n" + +#: change_set.cc:1600 +#, c-format +msgid "fusing deltas on %s : %s -> %s and %s -> %s\n" +msgstr "%s の差分を融合中: %s -> %s と %s -> %s\n" + +#: change_set.cc:1614 +#, c-format +msgid "delta on %s in second changeset copied forward\n" +msgstr "第二の変更セット内の %s の差分のコピーを転送しました\n" + +#: change_set.cc:1628 +msgid "finished concatenation\n" +msgstr "結合終了\n" + +#: change_set.cc:1734 change_set.cc:1741 +#, c-format +msgid "delete of %s dominates rename to %s\n" +msgstr "%s の削除は %s への名称変更を決定付けます\n" + +#: change_set.cc:1751 +#, c-format +msgid "unable to resolve file conflict '%s' -> '%s' vs. '%s'" +msgstr "ファイルの競合 '%s' -> '%s' 対 '%s' を解決できません" + +#: change_set.cc:1755 +#, c-format +msgid "unable to resolve dir conflict '%s' -> '%s' vs. '%s'" +msgstr "ディレクトリの競合 '%s' -> '%s' 対 '%s' を解決できません" + +#: change_set.cc:1760 +#, c-format +msgid "illegal conflict resolution '%s', wanted '%s' or '%s'\n" +msgstr "不法な競合の解決 '%s'. '%s' または '%s' であるべきです\n" + +#: change_set.cc:1816 +#, c-format +msgid "tid %d (%s) clobbered tid %d (%s)\n" +msgstr "tid %d (%s) は tid %d (%s) を上書きします\n" + +#: change_set.cc:1852 +#, c-format +msgid "skipping common change on %s (tid %d)\n" +msgstr "%s (tid %d) への共通の変更をスキップします\n" + +#: change_set.cc:1857 +#, c-format +msgid "skipping neutral change of %s -> %s (tid %d)\n" +msgstr "中立の変更 %s -> %s (tid %d) をスキップします\n" + +#: change_set.cc:1864 +#, c-format +msgid "propagating change on %s -> %s (tid %d)\n" +msgstr "変更を伝播しています: %s -> %s (tid %d)\n" + +#: change_set.cc:1880 +msgid "conflict detected, resolved in A's favour\n" +msgstr "競合を検出. A フレーバで解決\n" + +#: change_set.cc:1886 +msgid "conflict detected, resolved in B's favour\n" +msgstr "競合を検出. B フレーバで解決\n" + +#: change_set.cc:2053 +#, c-format +msgid "reusing merge resolution '%s' : '%s' -> '%s'\n" +msgstr "統合解決案 '%s' を再利用 : '%s' -> '%s'\n" + +#: change_set.cc:2062 +#, c-format +msgid "merge of '%s' : '%s' vs. '%s' (no common ancestor) failed" +msgstr "'%s' の統合に失敗: '%s' と '%s' が対立 (共通の祖先なし)" + +#: change_set.cc:2069 +#, c-format +msgid "merge of '%s' : '%s' -> '%s' vs '%s' failed" +msgstr "'%s' の統合に失敗: '%s' -> '%s' と '%s' が対立" + +#: change_set.cc:2073 +#, c-format +msgid "merge of '%s' : '%s' -> '%s' vs '%s' resolved to '%s'\n" +msgstr "'%s' の統合: '%s' -> '%s' と '%s' の対立を '%s' に解決\n" + +#: change_set.cc:2131 +#, c-format +msgid "skipping delta '%s'->'%s' on deleted file '%s'\n" +msgstr "差分 '%s'->'%s' (対象=削除されたファイル '%s') をスキップしています\n" + +#: change_set.cc:2139 +#, c-format +msgid "merge is copying delta '%s' : '%s' -> '%s'\n" +msgstr "統合は差分 '%s' : '%s' -> '%s' のコピーです\n" + +#: change_set.cc:2163 +#, c-format +msgid "propagating new file addition delta on '%s' : '%s' -> '%s'\n" +msgstr "'%s' の新規ファイル追加差分を伝えています: '%s' -> '%s'\n" + +#: change_set.cc:2175 +#, c-format +msgid "skipping new file addition delta on '%s' : '' -> '%s'\n" +msgstr "'%s' の新規ファイル追加差分をスキップしています: '' -> '%s'\n" + +#: change_set.cc:2183 +#, c-format +msgid "skipping common delta '%s' : '%s' -> '%s'\n" +msgstr "共通の差分 '%s' をスキップしています: '%s' -> '%s'\n" + +#: change_set.cc:2189 +#, c-format +msgid "skipping neutral delta on '%s' : %s -> %s\n" +msgstr "中立の差分 '%s' をスキップしています: '%s' -> '%s'\n" + +#: change_set.cc:2197 +#, c-format +msgid "propagating unperturbed delta on '%s' : '%s' -> '%s'\n" +msgstr "'%s' の摂動を受けない差分を伝えています: '%s' -> '%s'\n" + +#: change_set.cc:2207 +#, c-format +msgid "merging delta '%s' : '%s' -> '%s' vs. '%s'\n" +msgstr "差分 '%s' を統合しています: '%s' -> '%s' 対 '%s'\n" + +#: change_set.cc:2220 +#, c-format +msgid "resolved merge to '%s' : '%s' -> '%s'\n" +msgstr "'%s' への統合を解決しました: '%s' -> '%s'\n" + +#: change_set.cc:2249 +msgid "merging change sets\n" +msgstr "変更セットを統合中\n" + +#: change_set.cc:2311 +msgid "finished merge\n" +msgstr "統合終了\n" + +#: change_set.cc:2330 +msgid "inverting change set\n" +msgstr "変更セットを反転\n" + +#: change_set.cc:2360 +#, c-format +msgid "converted 'delete %s' to 'add as %s' in inverse\n" +msgstr "'%s の削除' を '%s の追加' (逆向き)に変換しました\n" + +#: change_set.cc:2369 +#, c-format +msgid "converted add %s to delete in inverse\n" +msgstr "%s の追加を削除(逆向き)に変換しました\n" + +#: change_set.cc:2379 +#, c-format +msgid "converting delta %s -> %s on %s\n" +msgstr "差分 %s -> %s (対象=%s) を変換しています\n" + +#: change_set.cc:2381 +#, c-format +msgid "inverse is delta %s -> %s on %s\n" +msgstr "逆向きの差分は %s -> %s (対象=%s) です\n" + +#: change_set.cc:2443 +#, c-format +msgid "moving %s -> %s\n" +msgstr "移動中 %s -> %s\n" + +#: change_set.cc:2492 +#, c-format +msgid "moving file %s -> %s\n" +msgstr "ファイルを移動中 %s -> %s\n" + +#: change_set.cc:2500 +#, c-format +msgid "moving dir %s -> %s\n" +msgstr "ディレクトリを移動中 %s -> %s\n" + +#: change_set.cc:2978 +#, c-format +msgid "[begin changeset %s]\n" +msgstr "[変更セット %s 開始]\n" + +#: change_set.cc:2983 +#, c-format +msgid "%s" +msgstr "%s" + +#: change_set.cc:2984 +#, c-format +msgid "[end changeset %s]\n" +msgstr "[変更セット %s 終了]\n" + +#: change_set.cc:3016 +msgid "beginning disjoint_merge_test\n" +msgstr "disjoint_merge_test 開始\n" + +#: change_set.cc:3034 +msgid "finished disjoint_merge_test\n" +msgstr "disjoint_merge_test 終了\n" + +#: change_set.cc:3106 change_set.cc:3191 change_set.cc:3236 +#, c-format +msgid "informative failure: %s\n" +msgstr "情報の十分な失敗: %s\n" + +#: change_set.cc:3110 change_set.cc:3195 change_set.cc:3240 +#, c-format +msgid "runtime error: %s\n" +msgstr "実行時エラー: %s\n" + +#: change_set.cc:3117 +msgid "STARTING invert_change_test\n" +msgstr "invert_change_test 開始\n" + +#: change_set.cc:3151 +msgid "ENDING invert_change_test\n" +msgstr "invert_change_test 終了中\n" + +#: change_set.cc:3260 +#, c-format +msgid "%s:%d" +msgstr "%s:%d" + +#: change_set.cc:3262 +#, c-format +msgid "BEGINNING concatenation test %s\n" +msgstr "結合テスト %s 開始\n" + +#: change_set.cc:3267 +#, c-format +msgid "FINISHING concatenation test %s\n" +msgstr "結合テスト %s 終了中\n" + +#: change_set.cc:3322 +#, c-format +msgid "RUNNING bad_concatenate_change_test %s\n" +msgstr "bad_concatenate_change_test %s 実行中\n" + +#: change_set.cc:3330 +msgid "skipping change_set printing, one or both are not sane\n" +msgstr "change_set 表示をスキップ. 妥当でないものが一つ以上あります\n" + +#: change_set.cc:3335 +msgid "concat change_set is insane\n" +msgstr "change_set の結合は妥当ではありません\n" + +#: change_set.cc:3338 +msgid "Checking combined change set\n" +msgstr "複合変更セットをチェックしています\n" + +#: change_set.cc:3345 +msgid "combined_concat is insane\n" +msgstr "combined_concat は妥当ではありません\n" + +#: change_set.cc:3351 +#, c-format +msgid "RUNNING bad_concatenate_change_test %s again backwards\n" +msgstr "再度逆行して bad_concatenate_change_test %s を実行中\n" + +#: commands.cc:133 +#, c-format +msgid "expanding command '%s'\n" +msgstr "コマンド '%s' を展開中\n" + +#: commands.cc:150 +#, c-format +msgid "expanded command to '%s'\n" +msgstr "コマンドを '%s' に展開\n" + +#: commands.cc:155 +#, c-format +msgid "command '%s' has multiple ambiguous expansions: \n" +msgstr "コマンド '%s' には曖昧な表現が複数含まれています: \n" + +#: commands.cc:234 +#, c-format +msgid "executing %s command\n" +msgstr "%s コマンドを実行中\n" + +#: commands.cc:240 +#, c-format +msgid "unknown command '%s'\n" +msgstr "不明なコマンド '%s'\n" + +#: commands.cc:287 +#, c-format +msgid "pid file '%s' already exists" +msgstr "PID ファイル '%s' は既に存在しています" + +#: commands.cc:362 +msgid "edit of log message failed" +msgstr "ログメッセージの編集に失敗しました" + +#: commands.cc:370 +#, c-format +msgid "" +"note: branch '%s' has multiple heads\n" +"note: perhaps consider 'monotone merge'" +msgstr "" +"注意: ブランチ '%s' には複数のヘッドがあります\n" +"注意: ’monotone merge' を実行した方がよいかもしれません" + +#: commands.cc:428 commands.cc:3617 +#, c-format +msgid "no such revision '%s'" +msgstr "リビジョン '%s' は存在しません" + +#: commands.cc:435 +#, c-format +msgid "expanding selection '%s'\n" +msgstr "セレクション '%s' を展開中\n" + +#: commands.cc:443 +#, c-format +msgid "no match for selection '%s'" +msgstr "セレクション '%s' に一致するものがありません" + +#: commands.cc:446 +#, c-format +msgid "selection '%s' has multiple ambiguous expansions: \n" +msgstr "セレクション '%s' には複数の曖昧な展開がありえます: \n" + +#: commands.cc:453 commands.cc:482 commands.cc:511 +#, c-format +msgid "expanded to '%s'\n" +msgstr "'%s' に展開\n" + +#: commands.cc:462 commands.cc:491 +msgid "non-hex digits in id" +msgstr "ID 内に十六進数が含まれていません" + +#: commands.cc:471 commands.cc:500 +#, c-format +msgid "partial id '%s' does not have a unique expansion" +msgstr "'%s' を含む ID は複数あり、一つの ID に展開することはできません" + +#: commands.cc:474 commands.cc:503 +#, c-format +msgid "partial id '%s' has multiple ambiguous expansions: \n" +msgstr "'%s' だけでは曖昧であり、展開できる ID は複数あります: \n" + +#: commands.cc:481 commands.cc:510 +#, c-format +msgid "expanding partial id '%s'\n" +msgstr "部分 ID '%s' を展開しています\n" + +#: commands.cc:537 +#, c-format +msgid "warning: no public key '%s' found in database\n" +msgstr "警告: 公開鍵 '%s' はデータベース内に存在しません\n" + +#: commands.cc:646 +msgid "no keys found\n" +msgstr "鍵がみつかりませんでした\n" + +#: commands.cc:648 +#, c-format +msgid "no keys found matching '%s'\n" +msgstr "'%s' に一致する鍵はみつかりませんでした\n" + +#: commands.cc:660 commands.cc:1438 commands.cc:1492 commands.cc:2976 +#, c-format +msgid "no revision %s found in database" +msgstr "リビジョン %s はデータベース内にみつかりませんでした" + +#: commands.cc:666 +#, c-format +msgid "revision %s already has children. We cannot kill it." +msgstr "リビジョン %s は既に子を持っていて、削除できません" + +#: commands.cc:806 +#, c-format +msgid "key '%s' already exists in database" +msgstr "鍵 '%s' は既にデータベース内にあります" + +#: commands.cc:810 +#, c-format +msgid "generating key-pair '%s'\n" +msgstr "鍵ペア '%s' を生成しています\n" + +#: commands.cc:812 +#, c-format +msgid "storing key-pair '%s' in database\n" +msgstr "鍵ペア '%s' をデータベースに保存しています\n" + +#: commands.cc:829 +#, c-format +msgid "dropping public key '%s' from database\n" +msgstr "公開鍵 '%s' をデータベースから破棄しています\n" + +#: commands.cc:836 +#, c-format +msgid "" +"dropping private key '%s' from database\n" +"\n" +msgstr "" +"秘密鍵 '%s' をデータベースから破棄しています\n" +"\n" + +#: commands.cc:837 +msgid "the private key data may not have been erased from the" +msgstr "秘密鍵データはデータベースから削除されていないかも" + +#: commands.cc:838 +msgid "database. it is recommended that you use 'db dump' and" +msgstr "しれません. 'db dump' と 'db load' で確認することを" + +#: commands.cc:839 +msgid "'db load' to be sure." +msgstr "お勧めします." + +#: commands.cc:845 +#, c-format +msgid "public or private key '%s' does not exist in database" +msgstr "公開または秘密鍵 '%s' はデータベース内に存在しません" + +#: commands.cc:861 +#, c-format +msgid "key '%s' does not exist in database" +msgstr "鍵 '%s' はデータベース内にありません" + +#: commands.cc:868 +msgid "passphrase changed\n" +msgstr "パスフレーズを変更しました\n" + +#: commands.cc:894 +msgid "no unique private key found, and no key specified" +msgstr "固有の秘密鍵がみつからず、かつ鍵が指定されていません" + +#: commands.cc:988 +msgid "need --branch argument for approval" +msgstr "承認には --branch 引数が必要です" + +#: commands.cc:1007 +#, c-format +msgid "revision %s has %d changesets, cannot invert\n" +msgstr "リビジョン %s には %d 個の変更セットがあり、反転できません\n" + +#: commands.cc:1011 +msgid "need --branch argument for disapproval" +msgstr "不可とするには --branch 引数が必要です" + +#: commands.cc:1034 +#, c-format +msgid "disapproval of revision %s" +msgstr "リビジョン %s を不可とする" + +#: commands.cc:1050 +msgid "edit comment failed" +msgstr "コメント編集に失敗" + +#: commands.cc:1053 +msgid "empty comment" +msgstr "空のコメント" + +#: commands.cc:1170 +#, c-format +msgid "cannot find file %s revision %s" +msgstr "ファイル %s リビジョン %s を発見できませんでした" + +#: commands.cc:1211 commands.cc:2378 +msgid "empty log message" +msgstr "空のログメッセージ" + +#: commands.cc:1246 +msgid "ancestor file id does not exist" +msgstr "祖先のファイル ID は存在しません" + +#: commands.cc:1249 +msgid "left file id does not exist" +msgstr "左ファイル ID は存在しません" + +#: commands.cc:1252 +msgid "right file id does not exist" +msgstr "右ファイル ID は存在しません" + +#: commands.cc:1263 +msgid "merge failed" +msgstr "統合失敗" + +#: commands.cc:1370 +#, c-format +msgid "no file version %s found in database" +msgstr "バージョン %s のファイルはデータベース内にはありませんでした" + +#: commands.cc:1382 +#, c-format +msgid "no file '%s' found in revision '%s'\n" +msgstr "ファイル '%s' はリビジョン '%s' にはありませんでした\n" + +#: commands.cc:1387 +#, c-format +msgid "dumping file %s\n" +msgstr "ファイル %s をダンプ中\n" + +#: commands.cc:1411 +#, c-format +msgid "no manifest version %s found in database" +msgstr "マニフェストバージョン %s はデータベース内にはありませんでした" + +#: commands.cc:1415 +#, c-format +msgid "dumping manifest %s\n" +msgstr "マニフェスト %s をダンプ中\n" + +#: commands.cc:1442 +#, c-format +msgid "dumping revision %s\n" +msgstr "リビジョン %s をダンプ中\n" + +#: commands.cc:1468 commands.cc:1480 +msgid "need --branch argument for branch-based checkout" +msgstr "ブランチを基準にしたチェックアウトには --branch 引数が必要です" + +#: commands.cc:1483 +#, c-format +msgid "branch %s is empty" +msgstr "ブランチ %s は空です" + +#: commands.cc:1484 +#, c-format +msgid "branch %s has multiple heads" +msgstr "ブランチ %s には複数のヘッド(最新版)が存在しています" + +#: commands.cc:1505 +#, c-format +msgid "found %d %s branch certs on revision %s\n" +msgstr "%d %s ブランチ証明をリビジョン %s でみつけました\n" + +#: commands.cc:1510 +#, c-format +msgid "revision %s is not a member of branch %s\n" +msgstr "リビジョン %s はブランチ %s には属していません\n" + +#: commands.cc:1526 +#, c-format +msgid "no manifest %s found in database" +msgstr "マニフェスト %s はデータベース内にはありませんでした" + +#: commands.cc:1528 +#, c-format +msgid "checking out revision %s to directory %s\n" +msgstr "リビジョン %s をディレクトリ %s にチェックアウト中\n" + +#: commands.cc:1534 +#, c-format +msgid "no file %s found in database for %s" +msgstr "ファイル %s (対象=%s)はデータベース内にはありませんでした" + +#: commands.cc:1538 commands.cc:3505 +#, c-format +msgid "writing file %s to %s\n" +msgstr "ファイル %s を %s に書き込み中\n" + +#: commands.cc:1559 commands.cc:3210 +msgid "please specify a branch, with --branch=BRANCH" +msgstr "--branch=BRANCH というようにブランチを指定して下さい" + +#: commands.cc:1564 commands.cc:3214 commands.cc:3284 commands.cc:3287 +#, c-format +msgid "branch '%s' is empty\n" +msgstr "ブランチ '%s' は空です\n" + +#: commands.cc:1566 +#, c-format +msgid "branch '%s' is currently merged:\n" +msgstr "ブランチ '%s' は現在統合済みです:\n" + +#: commands.cc:1568 +#, c-format +msgid "branch '%s' is currently unmerged:\n" +msgstr "ブランチ '%s' は現在未統合です:\n" + +#: commands.cc:1607 +#, c-format +msgid "no epoch for branch %s\n" +msgstr "ブランチ %s は epoch を持ちません\n" + +#: commands.cc:1807 commands.cc:1809 commands.cc:1872 +#, c-format +msgid "no such manifest %s" +msgstr "マニフェスト %s は存在しません" + +#: commands.cc:1832 commands.cc:1834 commands.cc:1891 +#, c-format +msgid "no such file %s" +msgstr "ファイル %s は存在しません" + +#: commands.cc:1854 +#, c-format +msgid "no such revision %s" +msgstr "リビジョン %s は存在しません" + +#: commands.cc:1923 +#, c-format +msgid "public key '%s' does not exist in database" +msgstr "公開鍵 '%s' はデータベース内に存在しません" + +#: commands.cc:1939 +#, c-format +msgid "public and private key '%s' do not exist in database" +msgstr "公開または秘密鍵 '%s' はデータベース内に存在しません" + +#: commands.cc:1956 +msgid "no packets found on stdin" +msgstr "標準入力にパケットをみつけることができませんでした" + +#: commands.cc:1958 +msgid "read 1 packet\n" +msgstr "1 パケット読み込み\n" + +#: commands.cc:1960 +#, c-format +msgid "read %d packets\n" +msgstr "%d パケット読み込み\n" + +#: commands.cc:1999 +#, c-format +msgid "setting default server to %s\n" +msgstr "デフォルトのサーバーを %s に設定しています\n" + +#: commands.cc:2005 +msgid "no hostname given" +msgstr "ホスト名を指定して下さい" + +#: commands.cc:2007 +msgid "no server given and no default server set" +msgstr "サーバが未指定であり、デフォルトのサーバーも設定されていません" + +#: commands.cc:2011 +#, c-format +msgid "using default server address: %s\n" +msgstr "デフォルトのサーバーアドレスを利用: %s\n" + +#: commands.cc:2023 +#, c-format +msgid "setting default branch include pattern to '%s'\n" +msgstr "ブランチ名に含めるデフォルトパターンを '%s' に設定しています\n" + +#: commands.cc:2029 +#, c-format +msgid "setting default branch exclude pattern to '%s'\n" +msgstr "ブランチ名に含めないデフォルトパターンを '%s' に設定しています\n" + +#: commands.cc:2035 +msgid "no branch pattern given" +msgstr "ブランチ名を指定して下さい" + +#: commands.cc:2037 +msgid "no branch pattern given and no default pattern set" +msgstr "ブランチパターンが未指定、かつデフォルトパターンも設定されていません" + +#: commands.cc:2041 +#, c-format +msgid "using default branch include pattern: '%s'\n" +msgstr "ブランチ名に含めるデフォルトのパターンを利用: '%s'\n" + +#: commands.cc:2049 +#, c-format +msgid "excluding: %s\n" +msgstr "除外: %s\n" + +#: commands.cc:2061 commands.cc:2090 commands.cc:2107 +msgid "could not guess default signing key" +msgstr "デフォルトの署名鍵を推測できませんでした" + +#: commands.cc:2076 +msgid "doing anonymous pull; use -kKEYNAME if you need authentication\n" +msgstr "匿名 pull を実行中. 認証が必要な場合は -kKEYNAME を使って下さい\n" + +#: commands.cc:2111 +msgid "" +"need permission to store persistent passphrase (see hook persist_phrase_ok())" +msgstr "" +"永続的にパスフレーズを保存しておきたいのなら権限が必要です (フック " +"persist_phrase_ok() を参照して下さい)" + +#: commands.cc:2210 +#, c-format +msgid "file '%s' not found" +msgstr "ファイル '%s' がみつかりません" + +#: commands.cc:2278 work.cc:114 +#, c-format +msgid "registering %s file in working copy\n" +msgstr "作業コピー内の %s ファイルを登録中\n" + +#: commands.cc:2307 +#, c-format +msgid "failed to parse date string '%s': %s" +msgstr "データ文字列 '%s' の解析に失敗: %s" + +#: commands.cc:2311 +#, c-format +msgid "failed to parse date string '%s'" +msgstr "データ文字列 '%s' の解析に失敗" + +#: commands.cc:2335 +msgid "no changes to commit\n" +msgstr "コミットすべき変更がありません\n" + +#: commands.cc:2346 +#, c-format +msgid "beginning commit on branch '%s'\n" +msgstr "ブランチ '%s' についてコミット開始\n" + +#: commands.cc:2347 +#, c-format +msgid "new manifest %s\n" +msgstr "新規マニフェスト %s\n" + +#: commands.cc:2348 +#, c-format +msgid "new revision %s\n" +msgstr "新規リビジョン %s\n" + +#: commands.cc:2352 +msgid "--message and --message-file are mutually exclusive" +msgstr "--message と --message-file を同時に指定することはできません" + +#: commands.cc:2355 +msgid "" +"MT/log is non-empty and --message supplied\n" +"perhaps move or delete MT/log,\n" +"or remove --message from the command line?" +msgstr "" +"MT/log は空ではなく、 --message が指定されています.\n" +"もしかしたら MT/log を移動/削除したか、コマンド\n" +"行から --message を削除したのではありませんか?" + +#: commands.cc:2360 +msgid "" +"MT/log is non-empty and --message-file supplied\n" +"perhaps move or delete MT/log,\n" +"or remove --message-file from the command line?" +msgstr "" +"MT/log は空ではなく、 --message-file が指定されています.\n" +"もしかしたら MT/log を移動/削除したか、コマンド\n" +"行から --message-file を削除したのではありませんか?" + +#: commands.cc:2390 +#, c-format +msgid "revision %s already in database\n" +msgstr "リビジョン %s は既にデータベース内に存在しています\n" + +#: commands.cc:2395 +#, c-format +msgid "inserting new revision %s\n" +msgstr "新規リビジョン %s を挿入中\n" + +#: commands.cc:2404 +#, c-format +msgid "skipping manifest %s, already in database\n" +msgstr "既にデータベースにあるマニフェスト %s をスキップしています\n" + +#: commands.cc:2408 +#, c-format +msgid "inserting manifest delta %s -> %s\n" +msgstr "マニフェスト差分 %s -> %s を挿入中\n" + +#: commands.cc:2419 +#, c-format +msgid "inserting full manifest %s\n" +msgstr "完全マニフェスト %s を挿入中\n" + +#: commands.cc:2432 +#, c-format +msgid "skipping file delta %s, already in database\n" +msgstr "既にデータベースにあるファイル差分 %s をスキップしています\n" + +#: commands.cc:2438 +#, c-format +msgid "inserting delta %s -> %s\n" +msgstr "差分 %s -> %s を挿入中\n" + +#: commands.cc:2448 commands.cc:2465 +#, c-format +msgid "file '%s' modified during commit, aborting" +msgstr "ファイル '%s' は commit 前に変更されました. 中止します" + +#: commands.cc:2458 +#, c-format +msgid "inserting full version %s\n" +msgstr "完全なバージョン %s を挿入中\n" + +#: commands.cc:2492 +#, c-format +msgid "committed revision %s\n" +msgstr "リビジョン %s をコミット\n" + +#: commands.cc:2498 +msgid "" +"note: this revision creates divergence\n" +"note: you may (or may not) wish to run 'monotone merge'" +msgstr "" +"注意: このリビジョンによって分岐が生じます\n" +"注意: 分岐を望まないなら 'monotone merge' を実行して下さい" + +#: commands.cc:2607 +#, c-format +msgid "--- %s\t%s\n" +msgstr "--- %s\t%s\n" + +#: commands.cc:2608 +#, c-format +msgid "+++ %s\t%s\n" +msgstr "+++ %s\t%s\n" + +#: commands.cc:2609 +#, c-format +msgid "@@ -0,0 +1,%d @@\n" +msgstr "@@ -0,0 +1,%d @@\n" + +#: commands.cc:2695 commands.cc:2711 commands.cc:2715 +#, c-format +msgid "revision %s does not exist" +msgstr "リビジョン %s は存在しません" + +#: commands.cc:2699 +msgid "current revision has no ancestor" +msgstr "現在のリビジョンには祖先がありません" + +#: commands.cc:2742 +#, c-format +msgid "no common ancestor for %s and %s" +msgstr "%s と %s には共通の祖先がありません" + +#: commands.cc:2748 +msgid "concatenating un-committed changeset to composite\n" +msgstr "合成のためにコミットされていない変更セットを連結しています\n" + +#: commands.cc:2774 +msgid "# no changes" +msgstr "# 変更点なし" + +#: commands.cc:2902 +#, c-format +msgid "updating %s to %s\n" +msgstr "%s を %s に更新中\n" + +#: commands.cc:2951 +msgid "this working directory is a new project; cannot update" +msgstr "この作業ディレクトリは新規のプロジェクトです; 更新できません" + +#: commands.cc:2958 +msgid "" +"your request matches no descendents of the current revision\n" +"in fact, it doesn't even match the current revision\n" +"maybe you want --revision=" +msgstr "" +"現在のリビジョンにもその子孫にもご希望に沿うものはありません.\n" +"もしかしたら --revision=<他のブランチのリビジョン> としたいのでは\n" +"ありませんか?" + +#: commands.cc:2963 +msgid "multiple update candidates:\n" +msgstr "複数の更新候補:\n" + +#: commands.cc:2966 +#, c-format +msgid " %s\n" +msgstr " %s\n" + +#: commands.cc:2967 +msgid "choose one with 'monotone update '\n" +msgstr "'monotone update ' として一つ選択\n" + +#: commands.cc:2968 +msgid "multiple candidates remain after selection" +msgstr "選択より後ろに複数の候補が残っています" + +#: commands.cc:2983 +#, c-format +msgid "already up to date at %s\n" +msgstr "%s は既に最新です\n" + +#: commands.cc:2987 +#, c-format +msgid "selected update target %s\n" +msgstr "選択された更新ターゲット %s\n" + +#: commands.cc:2999 +#, c-format +msgid "" +"revision %s is not a member of branch %s\n" +"try again with explicit --branch\n" +msgstr "" +"リビジョン %s はブランチ %s に属していません\n" +"明示的に --branch を指定して再試行して下さい\n" + +#: commands.cc:3014 +#, c-format +msgid "updating along chosen edge %s -> %s\n" +msgstr "選択した先端 %s -> %s に従って更新中\n" + +#: commands.cc:3025 +#, c-format +msgid "merging working copy with chosen edge %s -> %s\n" +msgstr "作業コピーを選択した先端 %s -> %s と統合中\n" + +#: commands.cc:3074 +#, c-format +msgid "updated to base revision %s\n" +msgstr "ベースリビジョン %s に更新\n" + +#: commands.cc:3140 +#, c-format +msgid "common ancestor %s found\n" +msgstr "共通の祖先 %s を発見\n" + +#: commands.cc:3141 +msgid "trying 3-way merge\n" +msgstr "3 方向統合を試行中\n" + +#: commands.cc:3151 +msgid "no common ancestor found, synthesizing edges\n" +msgstr "共通の祖先がありませんでしたので、先端同士を同期中\n" + +#: commands.cc:3215 +#, c-format +msgid "branch '%s' is merged\n" +msgstr "ブランチ '%s' を統合\n" + +#: commands.cc:3221 +#, c-format +msgid "starting with revision 1 / %d\n" +msgstr "リビジョン 1 / %d について作業開始\n" + +#: commands.cc:3225 +#, c-format +msgid "merging with revision %d / %d\n" +msgstr "リビジョン %d / %d について統合中\n" + +#: commands.cc:3226 commands.cc:3227 commands.cc:3294 commands.cc:3378 +#: commands.cc:3379 +#, c-format +msgid "[source] %s\n" +msgstr "[元] %s\n" + +#: commands.cc:3239 +#, c-format +msgid "" +"merge of %s\n" +" and %s\n" +msgstr "" +"%s と\n" +" %s の統合\n" + +#: commands.cc:3244 commands.cc:3331 commands.cc:3398 +#, c-format +msgid "[merged] %s\n" +msgstr "[統合済み] %s\n" + +#: commands.cc:3247 +msgid "note: your working copies have not been updated\n" +msgstr "注意: 作業コピーは更新されていません\n" + +#: commands.cc:3285 commands.cc:3288 +#, c-format +msgid "branch '%s' is not merged\n" +msgstr "ブランチ '%s' は統合されていません\n" + +#: commands.cc:3293 +#, c-format +msgid "propagating %s -> %s\n" +msgstr "伝播中 %s -> %s\n" + +#: commands.cc:3295 +#, c-format +msgid "[target] %s\n" +msgstr "[先] %s\n" + +#: commands.cc:3300 +#, c-format +msgid "branch '%s' is up-to-date with respect to branch '%s'\n" +msgstr "ブランチ '%s' はブランチ '%s' に対して最新です\n" + +#: commands.cc:3302 +msgid "no action taken\n" +msgstr "何もしません\n" + +#: commands.cc:3306 +#, c-format +msgid "no merge necessary; putting %s in branch '%s'\n" +msgstr "統合は必要ありません. %s をブランチ '%s' 内に取り込み中\n" + +#: commands.cc:3323 +#, c-format +msgid "" +"propagate from branch '%s' (head %s)\n" +" to branch '%s' (head %s)\n" +msgstr "" +"ブランチ '%s' (ヘッド %s) から伝播\n" +"ブランチ '%s' (ヘッド %s) へ\n" + +#: commands.cc:3360 commands.cc:3362 +#, c-format +msgid "%s is not an ancestor of %s" +msgstr "%s は %s の祖先ではありません" + +#: commands.cc:3371 +#, c-format +msgid "%s and %s are the same revision, aborting" +msgstr "%s と %s は同じリビジョンです. 中止します" + +#: commands.cc:3373 commands.cc:3375 +#, c-format +msgid "%s is already an ancestor of %s" +msgstr "%s は既に %s の祖先となっています" + +#: commands.cc:3389 +#, c-format +msgid "" +"explicit_merge of %s\n" +" and %s\n" +" using ancestor %s\n" +" to branch '%s'\n" +msgstr "" +"%s と %s の explicit_merge\n" +"祖先 %s をブランチ '%s' に使用\n" + +#: commands.cc:3411 +msgid "non-hex digits in partial id" +msgstr "部分 ID に十六進数が含まれていません" + +#: commands.cc:3497 +#, c-format +msgid "reverting %s from %s to %s\n" +msgstr "%s を %s から %s へ戻しています\n" + +#: commands.cc:3501 +#, c-format +msgid "no file version %s found in database for %s" +msgstr "バージョン %s のファイルはデータベース内にみつかりません (対象: %s)" + +#: commands.cc:3616 +#, c-format +msgid "no revision for file '%s' in database" +msgstr "ファイル '%s' に対するリビジョンはデータベース内にみつかりませんでした" + +#: commands.cc:3619 +#, c-format +msgid "annotate file file_path '%s'\n" +msgstr "注釈ファイル file_path '%s'\n" + +#: commands.cc:3628 +#, c-format +msgid "No such file '%s' in revision %s\n" +msgstr "ファイル '%s' はリビジョン %s 内にはありません\n" + +#: commands.cc:3630 +#, c-format +msgid "annotate for file_id %s\n" +msgstr "file_id %s に対する注釈\n" + +#: commands.cc:3696 +#, c-format +msgid "revision %s does not exist in db, skipping\n" +msgstr "リビジョン %s は db 内にありません. スキップします\n" + +#: commands.cc:3729 +#, c-format +msgid "revision '%s' in '%s' maps to '%s' in %s\n" +msgstr "リビジョン '%s' ('%s' 内) を '%s' (%s 内) にマップ\n" + +#: commands.cc:3877 +#, c-format +msgid "no var with name %s in domain %s" +msgstr "%s という変数はドメイン %s 内にはありません" + +#: database.cc:82 +#, c-format +msgid "" +"database schemas do not match: wanted %s, got %s. try migrating database" +msgstr "" +"データベーススキーマの不一致: 期待した %s ではなく %s を取得. データベースを" +"統合してみて下さい" + +#: database.cc:139 +#, c-format +msgid "database %s is a directory\n" +msgstr "データベース %s はディレクトリです\n" + +#: database.cc:146 +#, c-format +msgid "unable to probe database version in file %s" +msgstr "ファイル %s 内のデータベースバージョンを検出できませんでした" + +#: database.cc:153 +#, c-format +msgid "database %s is not an sqlite version 3 file, try dump and reload" +msgstr "" +"データベース %s は SQLite バージョン 3 のファイルではありません. ダンプした" +"後、再度読み込んでみて下さい" + +#: database.cc:169 +#, c-format +msgid "sqlite error [%d]: %s" +msgstr "SQLite エラー [%d]: %s" + +#: database.cc:177 +msgid "no database specified" +msgstr "データベース未指定" + +#: database.cc:182 +#, c-format +msgid "database %s does not exist" +msgstr "データベース %s は存在しません" + +#: database.cc:184 +#, c-format +msgid "database %s is a directory" +msgstr "データベース %s はディレクトリです" + +#: database.cc:213 +#, c-format +msgid "could not initialize database: %s: already exists" +msgstr "データベースを初期化できませんでした: %s: 既に存在しています" + +#: database.cc:218 +#, c-format +msgid "" +"existing (possibly stale) journal file '%s' has same stem as new database '%" +"s'" +msgstr "" +"既存の (おそらく古い) ジャーナルファイル '%s' は新しいデータベース '%s' と同" +"じ幹を持っています" + +#: database.cc:243 +#, c-format +msgid "INSERT INTO %s VALUES(" +msgstr "INSERT INTO %s VALUES(" + +#: database.cc:334 database.cc:435 database.cc:452 +msgid "need database name" +msgstr "データベース名が必要です" + +#: database.cc:336 +#, c-format +msgid "cannot create %s; it already exists\n" +msgstr "%s を作成できません; 既に存在しています\n" + +#: database.cc:530 +msgid "statement cache statistics\n" +msgstr "ステートメントキャッシュ統計\n" + +#: database.cc:531 +#, c-format +msgid "prepared %d statements\n" +msgstr "%d 個のプリペアードステートメント\n" + +#: database.cc:536 +#, c-format +msgid "%d executions of %s\n" +msgstr "%d 実行 (%s)\n" + +#: database.cc:593 +#, c-format +msgid "prepared statement %s\n" +msgstr "プリペアードステートメント %s\n" + +#: database.cc:597 +#, c-format +msgid "multiple statements in query: %s\n" +msgstr "クエリ中に複数のステートメント: %s\n" + +#: database.cc:603 +#, c-format +msgid "wanted %d columns got %d in query: %s\n" +msgstr "%d 列要求しましたが得たのは %d 列です: %s\n" + +#: database.cc:609 +#, c-format +msgid "binding %d parameters for %s\n" +msgstr "%d 変数を %s にバインド\n" + +#: database.cc:623 +#, c-format +msgid "binding %d with value '%s'\n" +msgstr "%d を値 '%s' にバインド\n" + +#: database.cc:639 +#, c-format +msgid "null result in query: %s\n" +msgstr "クエリ中に結果 null が含まれています: %s\n" + +#: database.cc:657 +#, c-format +msgid "wanted %d rows got %s in query: %s\n" +msgstr "%d 行要求しましたが得たのは %s です: %s\n" + +#: database.cc:853 +#, c-format +msgid "%08.8x%08.8x%08.8x%08.8x%08.8x" +msgstr "%08.8x%08.8x%08.8x%08.8x%08.8x" + +#: database.cc:865 +#, c-format +msgid "version cache expiring %s\n" +msgstr "バージョンキャッシュの有効期限が切れています: %s\n" + +#: database.cc:887 +#, c-format +msgid "version cache hit on %s\n" +msgstr "バージョンキャッシュヒット: %s\n" + +#: database.cc:932 +#, c-format +msgid "reconstructing %s in %s\n" +msgstr "%s (%s 内)を再構築中\n" + +#: database.cc:986 +#, c-format +msgid "inserting edge: %s <- %s\n" +msgstr "先端を挿入: %s <- %s\n" + +#: database.cc:990 +#, c-format +msgid "skipping merge edge %s <- %s\n" +msgstr "先端の統合 %s <- %s をスキップしています\n" + +#: database.cc:1036 +#, c-format +msgid "following delta %s -> %s\n" +msgstr "続く差分 %s -> %s\n" + +#: database.cc:1400 +#, c-format +msgid "Killing revision %s locally\n" +msgstr "ローカルにリビジョン %s を削除しています\n" + +#: database.cc:1412 +#, c-format +msgid "Deleting all references to branch %s\n" +msgstr "ブランチ %s へのすべての参照を削除しています\n" + +#: database.cc:1425 +#, c-format +msgid "Deleting all references to tag %s\n" +msgstr "タグ %s へのすべてのリファレンスを削除しています\n" + +#: database.cc:1575 database.cc:1587 +#, c-format +msgid "another key with name '%s' already exists" +msgstr "'%s' という名前の他の鍵が既に存在しています" + +#: database.cc:2166 +#, c-format +msgid "WHERE id GLOB '%s*'" +msgstr "WHERE id GLOB '%s*'" + +#: database.cc:2184 +#, c-format +msgid "WHERE name='%s' AND unbase64(value) glob '%s'" +msgstr "WHERE name='%s' AND unbase64(value) glob '%s'" + +#: database.cc:2190 +#, c-format +msgid "WHERE name='%s'" +msgstr "WHERE name='%s'" + +#: database.cc:2199 +#, c-format +msgid " WHERE (name='%s' OR name='%s' OR name='%s')" +msgstr " WHERE (name='%s' OR name='%s' OR name='%s')" + +#: database.cc:2203 +#, c-format +msgid " AND unbase64(value) glob '*%s*'" +msgstr " AND unbase64(value) glob '*%s*'" + +#: database.cc:2212 +#, c-format +msgid "SELECT id FROM revision_certs WHERE name='%s' AND " +msgstr "SELECT id FROM revision_certs WHERE name='%s' AND " + +#: database.cc:2216 +#, c-format +msgid "unbase64(value) <= X'%s'" +msgstr "unbase64(value) <= X'%s'" + +#: database.cc:2219 +#, c-format +msgid "unbase64(value) > X'%s'" +msgstr "unbase64(value) > X'%s'" + +#: database.cc:2222 +#, c-format +msgid "unbase64(value) glob '%s%s%s'" +msgstr "unbase64(value) glob '%s%s%s'" + +#: database.cc:2238 +#, c-format +msgid "SELECT id FROM %s" +msgstr "SELECT id FROM %s" + +#: database.cc:2248 +#, c-format +msgid " (name='%s' OR name='%s' OR name='%s')" +msgstr " (name='%s' OR name='%s' OR name='%s')" + +#: database.cc:2258 +#, c-format +msgid " (name='%s')" +msgstr " (name='%s')" + +#: database.cc:2261 +#, c-format +msgid " AND (unbase64(value) GLOB '%s%s%s')" +msgstr " AND (unbase64(value) GLOB '%s%s%s')" + +#: database.cc:2263 +#, c-format +msgid " AND (id IN %s)" +msgstr " AND (id IN %s)" + +#: diff_patch.cc:209 +#, c-format +msgid "exchanging preserved extent [%d+%d] with changed extent [%d+%d]\n" +msgstr "" +"前に確保したエクステント [%d+%d] を変更されたエクステント [%d+%d] に置き換え" +"ています\n" + +#: diff_patch.cc:300 +#, c-format +msgid "conflicting edits: %s %d[%d] '%s' vs. %s %d[%d] '%s'\n" +msgstr "競合する編集箇所: %s %d[%d] '%s' 対 %s %d[%d] '%s'\n" + +#: diff_patch.cc:328 +#, c-format +msgid "conflicting edits: [%s %d %d] vs. [%s %d %d]\n" +msgstr "競合する編集箇所: [%s %d %d] 対 [%s %d %d]\n" + +#: diff_patch.cc:376 +#, c-format +msgid "calculating left edit script on %d -> %d lines\n" +msgstr "%d -> %d 行について左側を編集するスクリプトを計算中\n" + +#: diff_patch.cc:384 +#, c-format +msgid "calculating right edit script on %d -> %d lines\n" +msgstr "%d -> %d 行について右側を編集するスクリプトを計算中\n" + +#: diff_patch.cc:392 +#, c-format +msgid "calculating left extents on %d edits\n" +msgstr "%d 編集箇所について左エクステントを計算しています\n" + +#: diff_patch.cc:397 +#, c-format +msgid "calculating right extents on %d edits\n" +msgstr "%d 編集箇所について右エクステントを計算しています\n" + +#: diff_patch.cc:402 +#, c-format +msgid "normalizing %d right extents\n" +msgstr "%d 右エクステントを正規化しています\n" + +#: diff_patch.cc:405 +#, c-format +msgid "normalizing %d left extents\n" +msgstr "%d 左エクステントを正規化しています\n" + +#: diff_patch.cc:411 +msgid "conflicting prefixes\n" +msgstr "競合するプレフィクス\n" + +#: diff_patch.cc:417 +msgid "conflicting suffixes\n" +msgstr "競合するサフィックス\n" + +#: diff_patch.cc:421 +#, c-format +msgid "merging %d left, %d right extents\n" +msgstr "%d å·¦, %d 右エクステントを統合中\n" + +#: diff_patch.cc:452 +msgid "conflict detected. no merge.\n" +msgstr "競合を検出、統合しません\n" + +#: diff_patch.cc:472 +#, c-format +msgid "recording successful merge of %s <-> %s into %s\n" +msgstr "%s <-> %s から %s への成功した統合を記録中\n" + +#: diff_patch.cc:528 +#, c-format +msgid "trying to merge %s <-> %s (ancestor: %s)\n" +msgstr "%s <-> %s (祖先: %s) の統合を試しています\n" + +#: diff_patch.cc:533 diff_patch.cc:634 +msgid "files are identical\n" +msgstr "ファイルは全く同じです\n" + +#: diff_patch.cc:575 +msgid "internal 3-way merged ok\n" +msgstr "内部三方向統合 OK\n" + +#: diff_patch.cc:589 +msgid "help required for 3-way merge\n" +msgstr "内部三方向統合には手助けが必要です\n" + +#: diff_patch.cc:590 +#, c-format +msgid "[ancestor] %s\n" +msgstr "[祖先] %s\n" + +#: diff_patch.cc:591 diff_patch.cc:646 +#, c-format +msgid "[ left] %s\n" +msgstr "[ å·¦] %s\n" + +#: diff_patch.cc:592 diff_patch.cc:647 +#, c-format +msgid "[ right] %s\n" +msgstr "[ 右] %s\n" + +#: diff_patch.cc:593 diff_patch.cc:648 +#, c-format +msgid "[ merged] %s\n" +msgstr "[ 統合済み] %s\n" + +#: diff_patch.cc:602 +msgid "lua merge3 hook merged ok\n" +msgstr "lua merge3 フック統合 OK\n" + +#: diff_patch.cc:629 +#, c-format +msgid "trying to merge %s <-> %s\n" +msgstr "%s <-> %s の統合を試しています\n" + +#: diff_patch.cc:645 +msgid "help required for 2-way merge\n" +msgstr "二方向統合には手助けが必要です\n" + +#: diff_patch.cc:656 +msgid "lua merge2 hook merged ok\n" +msgstr "lua merge2 フック統合 OK\n" + +#: diff_patch.cc:687 +#, c-format +msgid "temporarily recording merge of %s <-> %s into %s\n" +msgstr "一時的に %s <-> %s から %s への統合を記録しています\n" + +#: diff_patch.cc:704 +#, c-format +msgid "file %s does not exist in working copy" +msgstr "ファイル %s は作業コピー中にはありません" + +#: diff_patch.cc:708 +#, c-format +msgid "file %s in working copy has id %s, wanted %s" +msgstr "作業コピー内のファイル %s の ID は %s ですが、欲しいのは %s です" + +#: file_io.cc:38 +#, c-format +msgid "initial path is %s\n" +msgstr "初期パスは %s です\n" + +#: file_io.cc:51 +#, c-format +msgid "searching for '%s' directory with root '%s'\n" +msgstr "'%s' ディレクトリを '%s' を起点に検索中\n" + +#: file_io.cc:65 +#, c-format +msgid "'%s' not found in '%s' with '%s' removed\n" +msgstr "'%s' は '%s' 内('%s' 削除)にはありません\n" + +#: file_io.cc:72 +#, c-format +msgid "search for '%s' ended at '%s' with '%s' removed\n" +msgstr "'%s' を検索、'%s' で停止、'%s' を削除\n" + +#: file_io.cc:77 +#, c-format +msgid "'%s' does not exist\n" +msgstr "'%s' は存在しません\n" + +#: file_io.cc:83 +#, c-format +msgid "'%s' is not a directory\n" +msgstr "'%s' はディレクトリではありません\n" + +#: file_io.cc:90 +#, c-format +msgid "problems with '%s' (missing '.' or '..')\n" +msgstr "'%s' について問題があります ('.' または '..' がありません)\n" + +#: file_io.cc:116 +msgid "Searching for home directory\n" +msgstr "ホームディレクトリを検索中\n" + +#: file_io.cc:122 +msgid "Home directory from MONOTONE_HOME\n" +msgstr "MONOTONE_HOME をホームディレクトリとして使います\n" + +#: file_io.cc:132 +msgid "Home directory from HOME\n" +msgstr "HOME をホームディレクトリとして使います\n" + +#: file_io.cc:139 +msgid "Home directory from USERPROFILE\n" +msgstr "USERPROFILE をホームディレクトリとして使います\n" + +#: file_io.cc:148 +msgid "Home directory from HOMEDRIVE+HOMEPATH\n" +msgstr "HOMEDRIVE+HOMEPATH をホームディレクトリとして使います\n" + +#: file_io.cc:152 +msgid "" +"could not find home directory (tried MONOTONE_HOME, HOME (if cygwin/mingw), " +"USERPROFILE, HOMEDRIVE/HOMEPATH" +msgstr "" +"ホームディレクトリをみつけることができませんでした (MONOTONE_HOME, HOME " +"cygwin/mingw の場合), USERPROFILE, HOMEDRIVE/HOMEPATH について試しました" + +#: file_io.cc:160 +#, c-format +msgid "could not find home directory for uid %d" +msgstr "UID %d のホームディレクトリをみつけることができませんでした" + +#: file_io.cc:205 +#, c-format +msgid "could not find home directory for user %s" +msgstr "ユーザー %s のホームディレクトリをみつけることができませんでした" + +#: file_io.cc:268 +#, c-format +msgid "expected file '%s', but it is a directory." +msgstr "'%s' は期待していたファイルではなく、ディレクトリです" + +#: file_io.cc:295 file_io.cc:303 +#, c-format +msgid "file to delete '%s' does not exist" +msgstr "削除するファイル '%s' は存在しません" + +#: file_io.cc:311 file_io.cc:319 +#, c-format +msgid "directory to delete '%s' does not exist" +msgstr "削除するディレクトリ '%s' は存在しません" + +#: file_io.cc:328 file_io.cc:340 +#, c-format +msgid "rename source file '%s' does not exist" +msgstr "名称変更する元のファイル '%s' は存在しません" + +#: file_io.cc:330 file_io.cc:342 +#, c-format +msgid "rename target file '%s' already exists" +msgstr "名称変更する予定のファイル '%s' は既に存在しています" + +#: file_io.cc:352 file_io.cc:364 +#, c-format +msgid "rename source dir '%s' does not exist" +msgstr "名称変更する元のディレクトリ '%s' は存在しません" + +#: file_io.cc:354 file_io.cc:366 +#, c-format +msgid "rename target dir '%s' already exists" +msgstr "名称変更する予定のディレクトリ '%s' は既に存在しています" + +#: file_io.cc:419 +msgid "Cannot read standard input multiple times" +msgstr "標準入力を何度も読み込むことはできません" + +#: file_io.cc:510 +#, c-format +msgid "file '%s' does not exist" +msgstr "ファイル '%s' は存在しません" + +#: file_io.cc:551 +#, c-format +msgid "removing %s failed" +msgstr "%s の削除に失敗" + +#: file_io.cc:642 +#, c-format +msgid "ignoring book keeping entry %s\n" +msgstr "ブックキープエントリ %s を無視します\n" + +#: file_io.cc:661 +#, c-format +msgid "caught runtime error %s constructing file path for %s\n" +msgstr "%s についてファイルパス作成中に実行時エラー %s 発生\n" + +#: file_io.cc:693 +#, c-format +msgid "no such file or directory: %s" +msgstr "そのようなファイルまたはディレクトリはありません: %s" + +#: keys.cc:42 +#, c-format +msgid "running arc4 process on %d bytes of data\n" +msgstr "データ %d バイト目について arc4 プロセスを実行中\n" + +#: keys.cc:80 +msgid "got empty passphrase from get_passphrase() hook" +msgstr "get_passphrase() フックは空のパスフレーズを返しました" + +#: keys.cc:96 +msgid "empty passphrase not allowed" +msgstr "パスフレーズは空にできません" + +#: keys.cc:108 +msgid "empty passphrases not allowed, try again\n" +msgstr "パスフレーズは空にできません. 再度試して下さい\n" + +#: keys.cc:109 keys.cc:116 +msgid "too many failed passphrases\n" +msgstr "パスフレーズについて失敗が多すぎます\n" + +#: keys.cc:115 +msgid "passphrases do not match, try again\n" +msgstr "パスフレーズが不一致. 再度試して下さい\n" + +#: keys.cc:122 +msgid "no passphrase given" +msgstr "パスフレーズを指定して下さい" + +#: keys.cc:184 +#, c-format +msgid "generated %d-byte public key\n" +msgstr "%d バイトの公開鍵を生成\n" + +#: keys.cc:185 +#, c-format +msgid "generated %d-byte (encrypted) private key\n" +msgstr "%d バイトの暗号化された秘密鍵を生成しました\n" + +#: keys.cc:205 keys.cc:261 +#, c-format +msgid "building signer from %d-byte decrypted private key\n" +msgstr "%d バイトの復号化された秘密鍵から署名を作成中\n" + +#: keys.cc:254 +#, c-format +msgid "base64-decoding %d-byte private key\n" +msgstr "%d バイト秘密鍵の base64 デコード\n" + +#: keys.cc:298 +#, c-format +msgid "produced %d-byte signature\n" +msgstr "%d バイトの署名を作成\n" + +#: keys.cc:326 +#, c-format +msgid "building verifier for %d-byte pub key\n" +msgstr "%d バイトの公開鍵について識別子を構築中\n" + +#: keys.cc:348 +#, c-format +msgid "checking %d-byte (%d decoded) signature\n" +msgstr "%d バイト (%d デコード)の署名を検証中\n" + +#: keys.cc:482 +#, c-format +msgid "no public key '%s' found in database" +msgstr "データベース内に公開鍵 '%s' はありません" + +#: keys.cc:493 +#, c-format +msgid "passphrase for '%s' is incorrect" +msgstr "'%s' に対するパスフレーズが間違っています" + +#: lua.cc:79 +#, c-format +msgid "%s\n" +msgstr "%s\n" + +#: lua.cc:91 +msgid "lua istable() failed\n" +msgstr "lua istable() 失敗\n" + +#: lua.cc:97 +msgid "lua stack top > 0 failed\n" +msgstr "lua スタック top > 0 失敗\n" + +#: lua.cc:111 +msgid "lua isfunction() failed in get_fn\n" +msgstr "lua get_fn 内で isfunction() 失敗\n" + +#: lua.cc:123 +msgid "lua istable() failed in get_tab\n" +msgstr "lua get_tab 内で isfunction() 失敗\n" + +#: lua.cc:135 +msgid "lua isstring() failed in get_str\n" +msgstr "lua get_str 内で isstring() 失敗\n" + +#: lua.cc:147 +msgid "lua isnumber() failed in get_num\n" +msgstr "lua get_num 内で isnumber() 失敗\n" + +#: lua.cc:159 +msgid "lua isboolean() failed in get_bool\n" +msgstr "lua get_bool 内で isboolean() 失敗\n" + +#: lua.cc:172 +msgid "lua isstring() failed in extract_str\n" +msgstr "lua extract_str 内で isstring() 失敗\n" + +#: lua.cc:185 +msgid "lua isnumber() failed in extract_int\n" +msgstr "lua extract_int 内で isnumber() 失敗\n" + +#: lua.cc:198 +msgid "lua isnumber() failed in extract_double\n" +msgstr "lua extract_double 内で isnumber() 失敗\n" + +#: lua.cc:212 +msgid "lua isboolean() failed in extract_bool\n" +msgstr "lua extract_bool 内で isboolean() 失敗\n" + +#: lua.cc:228 +msgid "lua istable() failed in begin\n" +msgstr "lua begin のところで istable() 失敗\n" + +#: lua.cc:242 +msgid "lua istable() failed in next\n" +msgstr "lua next のところで istable() 失敗\n" + +#: lua.cc:329 +msgid "lua stack top >= count failed\n" +msgstr "lua スタック top >= count に失敗\n" + +#: lua.cc:501 +msgid "guess_binary called with an invalid parameter" +msgstr "guess_binary 呼出し時の変数が不適切です" + +#: lua.cc:510 +msgid "Include called with an invalid parameter" +msgstr "Include 呼出し時の変数が不適切です" + +#: lua.cc:525 +msgid "IncludeDir called with an invalid parameter" +msgstr "IncludeDir 呼出し時の変数が不適切です" + +#: lua.cc:528 +#, c-format +msgid "Directory '%s' does not exists" +msgstr "ディレクトリ '%s' は存在しません" + +#: lua.cc:529 +#, c-format +msgid "'%s' is not a directory" +msgstr "'%s' はディレクトリではありません" + +#: lua.cc:548 lua.cc:675 +#, c-format +msgid "lua error while loading rcfile '%s'" +msgstr "初期化ファイル '%s' を読み込み中に lua のエラー" + +#: lua.cc:672 lua.cc:685 +#, c-format +msgid "opening rcfile '%s' ...\n" +msgstr "初期化ファイル '%s' を開いています...\n" + +#: lua.cc:676 lua.cc:688 +#, c-format +msgid "'%s' is ok\n" +msgstr "'%s' OK\n" + +#: lua.cc:687 +#, c-format +msgid "lua error while loading '%s'" +msgstr "lua '%s' を読み込み中にエラー" + +#: lua.cc:692 +#, c-format +msgid "rcfile '%s' does not exist" +msgstr "初期化ファイル '%s' は存在しません" + +#: lua.cc:693 +#, c-format +msgid "skipping nonexistent rcfile '%s'\n" +msgstr "存在しない初期化ファイル '%s' をスキップしています\n" + +#: manifest.cc:55 +#, c-format +msgid "scanning file %s\n" +msgstr "ファイル %s を走査中\n" + +#: manifest.cc:188 +#, c-format +msgid "missing %s" +msgstr "%s がみつかりません" + +#: manifest.cc:201 +#, c-format +msgid "" +"%d missing files\n" +"to restore consistency, on each missing file run either\n" +"'monotone drop FILE' to remove it permanently, or\n" +"'monotone revert FILE' to restore it\n" +msgstr "" +"一貫性を保つために必要な\n" +"ファイルが %d 個みつかりません。各々のファイルについて\n" +"'monotone drop FILE' として恒久的にファイルを削除するか、\n" +"'monotone revert FILE' として復活させて下さい。\n" + +#: merkle_tree.cc:281 +#, c-format +msgid "node level is %d, exceeds maximum %d" +msgstr "ノードレベル %d は最大制限 %d を越えています" + +#: merkle_tree.cc:317 +#, c-format +msgid "mismatched node hash value %s, expected %s" +msgstr "一致しないノードハッシュ値 %s、期待されるのは %s です" + +#: monotone.cc:197 +#, c-format +msgid "problem parsing arguments from file %s: %s" +msgstr "ファイル %s からの引数を解析中に問題発生: %s" + +#: monotone.cc:206 +#, c-format +msgid "weird error when stuffing arguments read from %s: %s\n" +msgstr "%s から引数群を読み取り中に予期せぬエラー発生: %s\n" + +#: monotone.cc:257 +#, c-format +msgid "command line: %s\n" +msgstr "コマンド行: %s\n" + +#: monotone.cc:260 +#, c-format +msgid "set locale: LC_CTYPE=%s, LC_MESSAGES=%s\n" +msgstr "ロカール設定: LC_CTYPE=%s, LC_MESSAGES=%s\n" + +#: monotone.cc:452 +#, c-format +msgid "syntax error near the \"%s\" option: %s" +msgstr "\"%s\" オプションの側に構文エラー: %s" + +#: monotone.cc:491 +#, c-format +msgid "monotone %s doesn't use the option %s" +msgstr "monotone %s: オプション %s は指定できません" + +#: monotone.cc:513 +#, c-format +msgid "Removed 'hidden' from option # %d\n" +msgstr "オプション # %d から 'hidden' を削除\n" + +#: monotone.cc:519 monotone.cc:530 +#, c-format +msgid "Added 'hidden' to option # %d\n" +msgstr "オプション # %d に 'hidden' を追加\n" + +#: netcmd.cc:42 +#, c-format +msgid "unknown item type 0x%x for '%s'" +msgstr "不明な項目タイプ 0x%x ('%s' に対して)" + +#: netcmd.cc:89 +#, c-format +msgid "protocol version mismatch: wanted '%d' got '%d'" +msgstr "" +"プロトコルバージョンの不一致: 期待したのは '%d' ですが得たのは '%d' です" + +#: netcmd.cc:113 +#, c-format +msgid "unknown netcmd code 0x%x" +msgstr "不明な netcmd コード 0x%x" + +#: netcmd.cc:124 +#, c-format +msgid "oversized payload of '%d' bytes" +msgstr "'%d' バイトの長さ超過のペイロード" + +#: netcmd.cc:153 +#, c-format +msgid "" +"bad HMAC checksum (got %s, wanted %s)\n" +"this suggests data was corrupted in transit\n" +msgstr "" +"不正な HMAC チェックサム (計算値 %s / 期待値 %s)\n" +"これは転送中にデータが壊れたことを示唆しています\n" + +#: netcmd.cc:230 netcmd.cc:276 +#, c-format +msgid "unknown role specifier %d" +msgstr "不明なロール指定子 %d" + +#: netcmd.cc:632 +msgid "checking i/o round trip on error_cmd\n" +msgstr "error_cmd の I/O ラウンドトリップをチェック中\n" + +#: netcmd.cc:640 +#, c-format +msgid "errmsg_cmd test done, buffer was %d bytes\n" +msgstr "errmsg_cmd テスト完了 (バッファ %d バイト)\n" + +#: netcmd.cc:645 +msgid "checking i/o round trip on bye_cmd\n" +msgstr "bye_cmd の I/O ラウンドトリップをチェック中\n" + +#: netcmd.cc:649 +#, c-format +msgid "bye_cmd test done, buffer was %d bytes\n" +msgstr "bye_cmd テスト完了 (バッファ %d バイト)\n" + +#: netcmd.cc:654 +msgid "checking i/o round trip on hello_cmd\n" +msgstr "hello_cmd の I/O ラウンドトリップをチェック中\n" + +#: netcmd.cc:666 +#, c-format +msgid "hello_cmd test done, buffer was %d bytes\n" +msgstr "hello_cmd テスト完了 (バッファ %d バイト)\n" + +#: netcmd.cc:671 +msgid "checking i/o round trip on anonymous_cmd\n" +msgstr "anonymous_cmd の I/O ラウンドトリップをチェック中\n" + +#: netcmd.cc:688 +#, c-format +msgid "anonymous_cmd test done, buffer was %d bytes\n" +msgstr "anonymous_cmd テスト完了 (バッファ %d バイト)\n" + +#: netcmd.cc:693 +msgid "checking i/o round trip on auth_cmd\n" +msgstr "auth_cmd の I/O ラウンドトリップをチェック中\n" + +#: netcmd.cc:718 +#, c-format +msgid "auth_cmd test done, buffer was %d bytes\n" +msgstr "auth_cmd テスト完了 (バッファ %d バイト)\n" + +#: netcmd.cc:723 +msgid "checking i/o round trip on confirm_cmd\n" +msgstr "confirm_cmd の I/O ラウンドトリップをチェック中\n" + +#: netcmd.cc:729 +#, c-format +msgid "confirm_cmd test done, buffer was %d bytes\n" +msgstr "confirm_cmd テスト完了 (バッファ %d バイト)\n" + +#: netcmd.cc:734 +msgid "checking i/o round trip on refine_cmd\n" +msgstr "refine_cmd の I/O ラウンドトリップをチェック中\n" + +#: netcmd.cc:752 +#, c-format +msgid "refine_cmd test done, buffer was %d bytes\n" +msgstr "refine_cmd テスト完了 (バッファ %d バイト)\n" + +#: netcmd.cc:757 +msgid "checking i/o round trip on done_cmd\n" +msgstr "done_cmd の I/O ラウンドトリップをチェック中\n" + +#: netcmd.cc:768 +#, c-format +msgid "done_cmd test done, buffer was %d bytes\n" +msgstr "done_cmd テスト完了 (バッファ %d バイト)\n" + +#: netcmd.cc:773 +msgid "checking i/o round trip on send_data_cmd\n" +msgstr "send_data_cmd の I/O ラウンドトリップをチェック中\n" + +#: netcmd.cc:784 +#, c-format +msgid "send_data_cmd test done, buffer was %d bytes\n" +msgstr "send_data_cmd テスト完了 (バッファ %d バイト)\n" + +#: netcmd.cc:789 +msgid "checking i/o round trip on send_delta_cmd\n" +msgstr "send_delta_cmd の I/O ラウンドトリップをチェック中\n" + +#: netcmd.cc:802 +#, c-format +msgid "send_delta_cmd test done, buffer was %d bytes\n" +msgstr "send_delta_cmd テスト完了 (バッファ %d バイト)\n" + +#: netcmd.cc:807 +msgid "checking i/o round trip on data_cmd\n" +msgstr "data_cmd の I/O ラウンドトリップをチェック中\n" + +#: netcmd.cc:818 +#, c-format +msgid "data_cmd test done, buffer was %d bytes\n" +msgstr "data_cmd テスト完了 (バッファ %d バイト)\n" + +#: netcmd.cc:823 +msgid "checking i/o round trip on delta_cmd\n" +msgstr "delta_cmd の I/O ラウンドトリップをチェック中\n" + +#: netcmd.cc:838 +#, c-format +msgid "delta_cmd test done, buffer was %d bytes\n" +msgstr "delta_cmd テスト完了 (バッファ %d バイト)\n" + +#: netcmd.cc:843 +msgid "checking i/o round trip on nonexistant_cmd\n" +msgstr "nonexistant_cmd の I/O ラウンドトリップをチェック中\n" + +#: netcmd.cc:854 +#, c-format +msgid "nonexistant_cmd test done, buffer was %d bytes\n" +msgstr "nonexistant_cmd テスト完了 (バッファ %d バイト)\n" + +#: netcmd.cc:860 +#, c-format +msgid "bad decode exception: '%s'\n" +msgstr "不正なデコードの例外: '%s'\n" + +#: netio.hh:37 +#, c-format +msgid "need %d bytes to decode %s at %d, only have %d" +msgstr "%d バイト必要 (%s のデコード、位置 %d) ですが %d しかありません" + +#: netio.hh:65 +#, c-format +msgid "uleb128 decode for '%s' into %d-byte datum overflowed" +msgstr "'%s' について uleb128 デコード; %d バイトオーバーフロー" + +#: netio.hh:85 +#, c-format +msgid "ran out of bytes reading uleb128 value for '%s' at pos %d" +msgstr "'%s' について uleb128 値を読み込み中にポジション %d でデータ欠損" + +#: netio.hh:161 +#, c-format +msgid "decoding variable length string of %d bytes for '%s', maximum is %d" +msgstr "%d バイトの可変長文字列 ('%s' について; 最大長 %d) をデコード中" + +#: netio.hh:196 +#, c-format +msgid "expected %s to end at %d, have %d bytes" +msgstr "予想 %s、終端 %d、読み込み %d バイト" + +#: netsync.cc:211 +#, c-format +msgid "check of '%s' failed" +msgstr "'%s' のチェックに失敗しました" + +#: netsync.cc:703 +msgid "all epochs processed, opening database valve\n" +msgstr "すべての epoch を処理しました. データベースバルブを開いています\n" + +#: netsync.cc:791 +msgid "dropping outgoing netcmd (because we're in error unwind mode)\n" +msgstr "外向きの netcmd を破棄しています (エラーから回避不能なため)\n" + +#: netsync.cc:815 +#, c-format +msgid "error: %s\n" +msgstr "エラー: %s\n" + +#: netsync.cc:823 +#, c-format +msgid "analyzing %d entries in manifest\n" +msgstr "マニフェスト内の %d エントリを解析中\n" + +#: netsync.cc:867 +#, c-format +msgid "revision %s is attached via database\n" +msgstr "リビジョン %s はデータベースを介して添付されています\n" + +#: netsync.cc:872 +#, c-format +msgid "checking attachment of %s in ancestry\n" +msgstr "系統内の %s の添付を検証中\n" + +#: netsync.cc:879 +#, c-format +msgid "checking attachment of %s in parent %s\n" +msgstr "%s の添付(親 %s 内)を検証中\n" + +#: netsync.cc:883 +#, c-format +msgid "revision %s is attached via parent %s\n" +msgstr "リビジョン %s は親 %s を介して添付されています\n" + +#: netsync.cc:889 +#, c-format +msgid "decided that revision %s %s attached\n" +msgstr "添付のリビジョン %s %s を決定\n" + +#: netsync.cc:956 +#, c-format +msgid "not requesting (in reverse) initial manifest %s as we already have it\n" +msgstr "" +"既に持っている初期マニフェスト %s については(逆向きに)リクエストしません\n" + +#: netsync.cc:959 +#, c-format +msgid "requesting (in reverse) initial manifest data %s\n" +msgstr "初期マニフェストデータ %s を(逆向きに)リクエストしています\n" + +#: netsync.cc:969 +#, c-format +msgid "" +"not requesting (in reverse) manifest delta to %s as we already have it\n" +msgstr "" +"既に持っている %s のマニフェスト差分については(逆向きに)リクエストしません\n" + +#: netsync.cc:972 +#, c-format +msgid "requesting (in reverse) manifest delta %s -> %s\n" +msgstr "マニフェスト差分 %s -> %s を(逆向きに)リクエストしています\n" + +#: netsync.cc:999 +#, c-format +msgid "not requesting (in reverse) initial file %s as we already have it\n" +msgstr "" +"既に持っている初期化ファイル %s については(逆向きに)リクエストしません\n" + +#: netsync.cc:1002 +#, c-format +msgid "requesting (in reverse) initial file data %s\n" +msgstr "初期化ファイルデータ %s を(逆向きに)リクエストしています\n" + +#: netsync.cc:1012 +#, c-format +msgid "not requesting (in reverse) file delta to %s as we already have it\n" +msgstr "既に持っている %s へのファイル差分は(逆向きに)リクエストしません\n" + +#: netsync.cc:1015 +#, c-format +msgid "requesting (in reverse) file delta %s -> %s on %s\n" +msgstr "ファイル差分 %s -> %s (対象: %s)を(逆向きに)リクエストしています\n" + +#: netsync.cc:1047 +#, c-format +msgid "visiting revision '%s' for forward deltas\n" +msgstr "前向きの差分についてリビジョン '%s' を見ています\n" + +#: netsync.cc:1075 +#, c-format +msgid "not requesting forward manifest delta to '%s' as we already have it\n" +msgstr "" +"既に持っている '%s' への前向きのマニフェスト差分についてはリクエストしませ" +"ん\n" + +#: netsync.cc:1081 +#, c-format +msgid "requesting full manifest data %s\n" +msgstr "完全なマニフェストデータ %s をリクエストしています\n" + +#: netsync.cc:1086 +#, c-format +msgid "requesting forward manifest delta %s -> %s\n" +msgstr "前向きのマニフェスト差分 %s -> %s をリクエストしています\n" + +#: netsync.cc:1100 +#, c-format +msgid "" +"not requesting forward delta %s -> %s on file %s as we already have it\n" +msgstr "" +"既に持っている前向きの差分 %s -> %s (対象ファイル %s) についてはリクエストし" +"ません\n" + +#: netsync.cc:1106 +#, c-format +msgid "requesting full file data %s\n" +msgstr "完全なファイルデータ %s をリクエストしています\n" + +#: netsync.cc:1112 +#, c-format +msgid "requesting forward delta %s -> %s on file %s\n" +msgstr "前方向の差分 %s -> %s (対象ファイル %s) をリクエストしています\n" + +#: netsync.cc:1142 +#, c-format +msgid "analyzing %d ancestry edges\n" +msgstr "%d ancestry の端を解析中\n" + +#: netsync.cc:1198 +#, c-format +msgid "Dropping branch certs for unwanted branch %s" +msgstr "希望しないブランチ %s のブランチ証明を削除中" + +#: netsync.cc:1253 +#, c-format +msgid "isolated %d heads\n" +msgstr "孤立した %d ヘッド\n" + +#: netsync.cc:1280 +#, c-format +msgid "requesting attached ancestry of revision '%s'\n" +msgstr "リビジョン '%s' に付随する系統をリクエスト中\n" + +#: netsync.cc:1285 +#, c-format +msgid "requesting detached ancestry of revision '%s'\n" +msgstr "リビジョン '%s' から遊離した系統をリクエスト中\n" + +#: netsync.cc:1319 +#, c-format +msgid "read %d bytes from fd %d (peer %s)\n" +msgstr "%d バイト読み込み: fd %d (ピーア %s)\n" + +#: netsync.cc:1322 +msgid "in error unwind mode, so throwing them into the bit bucket\n" +msgstr "エラー復帰モードなので、これらをビットバケット中に捨てます\n" + +#: netsync.cc:1354 +#, c-format +msgid "wrote %d bytes to fd %d (peer %s)\n" +msgstr "%d バイト書き込み: fd %d (ピーア %s)\n" + +#: netsync.cc:1362 +msgid "finished flushing output queue in error unwind mode, disconnecting\n" +msgstr "エラー復帰モードで出力キューフラッシュ完了、切断中\n" + +#: netsync.cc:1376 +msgid "queueing 'bye' command\n" +msgstr "'bye' コマンドをキューに追加しています\n" + +#: netsync.cc:1386 +msgid "queueing 'error' command\n" +msgstr "'error' コマンドをキューに追加しています\n" + +#: netsync.cc:1399 +#, c-format +msgid "queueing 'done' command for %s level %s\n" +msgstr "'%s' (レベル %s) について 'done' コマンドをキューに追加しています\n" + +#: netsync.cc:1475 +#, c-format +msgid "queueing request for refinement of %s node '%s', level %d\n" +msgstr "%s ノード '%s', レベル %d の微調整リクエストをキューに追加しています\n" + +#: netsync.cc:1493 +#, c-format +msgid "not queueing request for %s '%s' as we are in pure source role\n" +msgstr "" +"純粋なソースの役割を果しているので %s '%s' のリクエストはキューに追加しませ" +"ん\n" + +#: netsync.cc:1500 +#, c-format +msgid "not queueing request for %s '%s' as we already requested it\n" +msgstr "既にリクエスト済みの %s '%s' はキューに追加しません\n" + +#: netsync.cc:1505 +#, c-format +msgid "queueing request for data of %s item '%s'\n" +msgstr "%s 項目 '%s' のデータについてリクエストをキューに追加しています\n" + +#: netsync.cc:1529 +#, c-format +msgid "" +"not queueing request for %s delta '%s' -> '%s' as we are in pure source " +"role\n" +msgstr "" +"純粋なソースの役割を果しているので %s 差分 '%s' -> '%s' についてリクエストを" +"キューに追加しません\n" + +#: netsync.cc:1536 +#, c-format +msgid "" +"not queueing request for %s delta '%s' -> '%s' as we already requested the " +"target\n" +msgstr "" +"既にリクエスト済みなので %s 差分 '%s' -> '%s' についてリクエストをキューに追" +"加しません\n" + +#: netsync.cc:1541 +#, c-format +msgid "queueing request for contents of %s delta '%s' -> '%s'\n" +msgstr "" +"%s 差分 '%s' -> '%s' の内容についてリクエストをキューに追加しています\n" + +#: netsync.cc:1561 +#, c-format +msgid "not queueing %s data for '%s' as we are in pure sink role\n" +msgstr "" +"純粋なシンクの役割を果しているので %s データ (対象: '%s' )をキューに追加しま" +"せん\n" + +#: netsync.cc:1566 +#, c-format +msgid "queueing %d bytes of data for %s item '%s'\n" +msgstr "%d バイト (%s 項目 '%s' のデータ)をキューに追加しています\n" + +#: netsync.cc:1591 +#, c-format +msgid "not queueing %s delta '%s' -> '%s' as we are in pure sink role\n" +msgstr "" +"純粋なシンクの役割を果しているので %s 差分 '%s' -> '%s' をキューに追加しませ" +"ん\n" + +#: netsync.cc:1596 +#, c-format +msgid "queueing %s delta '%s' -> '%s'\n" +msgstr "%s 差分 '%s' -> '%s' をキューに追加しています\n" + +#: netsync.cc:1614 +#, c-format +msgid "" +"not queueing note of nonexistence of %s item '%s' as we are in pure sink " +"role\n" +msgstr "" +"純粋なシンクの役割を果しているので %s 項目 '%s' がないことについてノートを" +"キューに追加しません\n" + +#: netsync.cc:1619 +#, c-format +msgid "queueing note of nonexistance of %s item '%s'\n" +msgstr "%s 項目 '%s' がないことについてノートをキューに追加しています\n" + +#: netsync.cc:1631 +msgid "received 'bye' netcmd\n" +msgstr "'bye' netcmd を受信\n" + +#: netsync.cc:1639 +#, c-format +msgid "received network error: %s\n" +msgstr "ネットワークエラーを受信: %s\n" + +#: netsync.cc:1656 +#, c-format +msgid "received 'done' for empty %s level %d, marking as complete\n" +msgstr "空の %s レベル %d について 'done' 受信, 完了としてマーク\n" + +#: netsync.cc:1678 +#, c-format +msgid "" +"received 'done' for %s level %d, which had refinements; sending echo of done " +"for level %d\n" +msgstr "" +"微調整を含んでいた %s レベル %d について 'done' 受信;レベル %d の各 'done' に" +"ついて送信\n" + +#: netsync.cc:1711 +#, c-format +msgid "server key has name %s, hash %s\n" +msgstr "サーバー鍵の名前 %s、ハッシュ %s\n" + +#: netsync.cc:1719 netsync.cc:1721 +msgid "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" +msgstr "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n" + +#: netsync.cc:1720 +msgid "@ WARNING: SERVER IDENTIFICATION HAS CHANGED @\n" +msgstr "@ 警告: サーバー ID が変更されました @\n" + +#: netsync.cc:1722 +msgid "IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY\n" +msgstr "誰か何か悪いことをしている可能性があります\n" + +#: netsync.cc:1723 +msgid "it is also possible that the server key has just been changed\n" +msgstr "または単にサーバーの鍵が変更されたのかもしれません\n" + +#: netsync.cc:1724 +#, c-format +msgid "remote host sent key %s\n" +msgstr "リモートホストは鍵 %s を送信\n" + +#: netsync.cc:1725 +#, c-format +msgid "I expected %s\n" +msgstr "期待値 %s\n" + +#: netsync.cc:1726 +#, c-format +msgid "'monotone unset %s %s' overrides this check\n" +msgstr "'monotone unset %s %s' とするとこのチェックは上書きされます\n" + +#: netsync.cc:1728 +msgid "server key changed" +msgstr "サーバー鍵が変更されました" + +#: netsync.cc:1733 +#, c-format +msgid "first time connecting to server %s\n" +msgstr "サーバー %s への初めての接続\n" + +#: netsync.cc:1734 +msgid "I'll assume it's really them, but you might want to double-check\n" +msgstr "偽物でないとは思いますが、鍵の指紋を二重チェックして\n" + +#: netsync.cc:1735 +#, c-format +msgid "their key's fingerprint: %s\n" +msgstr "確かめることができます: %s\n" + +#: netsync.cc:1740 +#, c-format +msgid "saving public key for %s to database\n" +msgstr "%s の公開鍵をデータベースに保存中\n" + +#: netsync.cc:1747 +#, c-format +msgid "received 'hello' netcmd from server '%s' with nonce '%s'\n" +msgstr "サーバー '%s' から nonce '%s' と一緒に 'hello' netcmd を受信\n" + +#: netsync.cc:1828 +msgid "rejected attempt at anonymous connection for write\n" +msgstr "匿名接続からの書き込みを拒否\n" + +#: netsync.cc:1835 +msgid "rejected attempt at anonymous connection while running as sink\n" +msgstr "シンクとして実行中の匿名接続からの書き込みを拒否\n" + +#: netsync.cc:1852 +#, c-format +msgid "anonymous access to branch '%s' denied by server" +msgstr "ブランチ '%s' への匿名アクセスはサーバーによって拒否されました" + +#: netsync.cc:1857 +#, c-format +msgid "allowed anonymous read permission for '%s' excluding '%s'\n" +msgstr "'%s' ('%s' を除く)への匿名読み込みを許可しました\n" + +#: netsync.cc:1889 +msgid "detected replay attack in auth netcmd\n" +msgstr "auth netcmd 中に繰り返し攻撃を検出\n" + +#: netsync.cc:1910 +#, c-format +msgid "remote public key hash '%s' is unknown\n" +msgstr "リモートの公開鍵ハッシュ '%s' は不明なものです\n" + +#: netsync.cc:1926 +#, c-format +msgid "" +"denied '%s' read permission for '%s' excluding '%s' while running as pure " +"sink\n" +msgstr "" +"純粋シンクとして実行中の '%s' の読み込み権限 ('%s' について; '%s' を除く) を拒否しました\n" + +#: netsync.cc:1942 +#, c-format +msgid "" +"denied '%s' read permission for '%s' excluding '%s' because of branch '%s'\n" +msgstr "" +"'%s' の読み込み権限 ('%s' について; '%s' を除く)をブランチ '%s' のために拒否しました\n" + +#: netsync.cc:1944 +#, c-format +msgid "access to branch '%s' denied by server" +msgstr "ブランチ '%s' へのアクセスはサーバーによって拒否されました" + +#: netsync.cc:1952 +#, c-format +msgid "allowed '%s' read permission for '%s' excluding '%s'\n" +msgstr "'%s' の '%s' ('%s' を除く)への匿名での読み込みを許可しました\n" + +#: netsync.cc:1961 +#, c-format +msgid "" +"denied '%s' write permission for '%s' excluding '%s' while running as pure " +"source\n" +msgstr "" +"純粋ソースとして実行中の '%s' の書き込み権限 ('%s' について; '%s' を除く) を拒否しました\n" + +#: netsync.cc:1969 +#, c-format +msgid "denied '%s' write permission for '%s' excluding '%s'\n" +msgstr "'%s' の '%s' ('%s' を除く)への書き込みを拒否しました\n" + +#: netsync.cc:1975 +#, c-format +msgid "allowed '%s' write permission for '%s' excluding '%s'\n" +msgstr "'%s' の書き込み権限 ('%s' について; '%s' を除く) を許可\n" + +#: netsync.cc:1990 +msgid "client signature OK, accepting authentication\n" +msgstr "クライアント署名 OK、認証完了\n" + +#: netsync.cc:2012 +msgid "bad client signature\n" +msgstr "不正なクライアント署名\n" + +#: netsync.cc:2027 +#, c-format +msgid "" +"received 'confirm' netcmd from server '%s' for pattern '%s' exclude '%s' in %" +"s mode\n" +msgstr "" +"サーバー '%s' からパターン '%s' ('%s' を除く; %s モード)への 'confirm' netcmd を受信\n" + +#: netsync.cc:2043 +msgid "server signature OK, accepting authentication\n" +msgstr "サーバー署名 OK、認証完了\n" + +#: netsync.cc:2048 +msgid "bad server signature\n" +msgstr "不正なサーバー署名\n" + +#: netsync.cc:2053 +msgid "unknown server key\n" +msgstr "不明なサーバー鍵\n" + +#: netsync.cc:2122 +#, c-format +msgid "epoch with hash '%s' does not exist in our database" +msgstr "こちらのデータベースにはハッシュ '%s' の epoch は含まれていません" + +#: netsync.cc:2132 +#, c-format +msgid "public key '%s' is also called '%s'\n" +msgstr "公開鍵 '%s' の別名は '%s' です\n" + +#: netsync.cc:2137 +#, c-format +msgid "public key '%s' does not exist in our database" +msgstr "こちらのデータベースには公開鍵 '%s' は含まれていません" + +#: netsync.cc:2151 +#, c-format +msgid "revision '%s' does not exist in our database" +msgstr "こちらのデータベースにはリビジョン '%s' は含まれていません" + +#: netsync.cc:2165 +#, c-format +msgid "manifest '%s' does not exist in our database" +msgstr "こちらのデータベースにはマニフェスト '%s' は含まれていません" + +#: netsync.cc:2179 +#, c-format +msgid "file '%s' does not exist in our database" +msgstr "こちらのデータベースにはファイル '%s' は含まれていません" + +#: netsync.cc:2193 +#, c-format +msgid "cert '%s' does not exist in our database" +msgstr "こちらのデータベースには証明 '%s' は含まれていません" + +#: netsync.cc:2212 +#, c-format +msgid "received 'refine' netcmd on %s node '%s', level %d\n" +msgstr "%s ノード '%s'、レベル %d で 'refine' netcmd を受信\n" + +# CHECKED1 +#: netsync.cc:2217 +#, c-format +msgid "no corresponding %s merkle node for prefix '%s', level %d\n" +msgstr "" +"相当する %s merkle ノード(対象: プレフィクス '%s'、レベル %d)を持っています\n" + +#: netsync.cc:2227 +#, c-format +msgid "" +"(#0) they have an empty slot %d (in a %s node '%s', level %d, we do not " +"have)\n" +msgstr "" +"(#0) こちらにはない空のスロット %d (%s ノード '%s' 内, レベル %d) を持ってい" +"ます\n" + +#: netsync.cc:2239 +#, c-format +msgid "" +"(#0) they have a live leaf at slot %d (in a %s node '%s', level %d, we do " +"not have)\n" +msgstr "" +"(#0) こちらにはないスロット %d (%s ノード '%s' 内, レベル %d) に生きたリーフ" +"を持っています\n" + +#: netsync.cc:2241 +#, c-format +msgid "(#0) requesting their %s leaf %s\n" +msgstr "(#0) %s リーフ %s をリクエストしています\n" + +#: netsync.cc:2248 +#, c-format +msgid "" +"(#0) they have a dead leaf at slot %d (in a %s node '%s', level %d, we do " +"not have)\n" +msgstr "" +"(#0) こちらにはないスロット %d (%s ノード '%s 内, レベル %d) に死んだリーフが" +"あります\n" + +#: netsync.cc:2256 +#, c-format +msgid "" +"(#0) they have a subtree at slot %d (in a %s node '%s', level %d, we do not " +"have)\n" +msgstr "" +"(#0) こちらにはないスロット %d (%s ノード '%s' 内, レベル %d) にサブツリーを" +"持っています\n" + +#: netsync.cc:2272 +#, c-format +msgid "found corresponding %s merkle node for prefix '%s', level %d\n" +msgstr "" +"相当する %s merkle ノード (対象: プレフィクス '%s', レベル %d)をみつけまし" +"た\n" + +#: netsync.cc:2286 +#, c-format +msgid "" +"(#1) they have an empty slot %d in %s node '%s', level %d, and so do we\n" +msgstr "" +"(#1) こちらにもある空のスロット %d (%s ノード '%s' 内, レベル %d)を持っていま" +"す\n" + +#: netsync.cc:2293 +#, c-format +msgid "" +"(#2) they have an empty slot %d in %s node '%s', level %d, we have a live " +"leaf\n" +msgstr "" +"(#2) こちら側では生きたリーフのある空のスロット %d (%s ノード '%s' 内, レベ" +"ル %d) を持っています\n" + +#: netsync.cc:2307 +#, c-format +msgid "" +"(#3) they have an empty slot %d in %s node '%s', level %d, we have a dead " +"leaf\n" +msgstr "" +"(#3) こちら側では死んだリーフのある空のスロット %d (%s ノード '%s' 内, レベ" +"ル %d) を持っています\n" + +#: netsync.cc:2314 +#, c-format +msgid "" +"(#4) they have an empty slot %d in %s node '%s', level %d, we have a " +"subtree\n" +msgstr "" +"(#4) こちらではサブツリーのある空のスロット %d (%s ノード '%s' 内, レベル %" +"d) を持っています\n" + +#: netsync.cc:2341 +#, c-format +msgid "" +"(#5) they have a live leaf at slot %d in %s node '%s', level %d, we have " +"nothing\n" +msgstr "" +"(#5) こちらにはないスロット %d (%s ノード '%s' 内, レベル %d) に生きたリーフ" +"を持っています\n" + +#: netsync.cc:2352 +#, c-format +msgid "(#6) they have a live leaf at slot %d in %s node '%s', and so do we\n" +msgstr "" +"(#6) こちらにもあるスロット %d (%s ノード '%s' 内) に生きたリーフを持っていま" +"す\n" + +#: netsync.cc:2362 +#, c-format +msgid "(#6) we both have live %s leaf '%s'\n" +msgstr "(#6) 両方とも生きた %s リーフ '%s' を持っています\n" + +#: netsync.cc:2378 +#, c-format +msgid "" +"(#7) they have a live leaf at slot %d in %s node %s, level %d, we have a " +"dead one\n" +msgstr "" +"(#7) こちら側では生きていない、生きたリーフをスロット %d (%s ノード %s、レベ" +"ル %d) に持っています\n" + +#: netsync.cc:2388 +#, c-format +msgid "(#7) it's the same %s leaf '%s', but ours is dead\n" +msgstr "(#7) 同じ %s リーフ '%s' ですがこちらのものは死んでいます\n" + +#: netsync.cc:2401 +#, c-format +msgid "" +"(#8) they have a live leaf in slot %d of %s node '%s', level %d, we have a " +"subtree\n" +msgstr "" +"(#8) こちらではサブツリーを持つ、生きたリーフをスロット %d (%s ノード %s、レ" +"ベル %d) に持っています\n" + +#: netsync.cc:2410 +#, c-format +msgid "" +"(#8) we have a copy of their live leaf '%s' in slot %d of %s node '%s', " +"level %d\n" +msgstr "" +"(#8) 生きたリーフ '%s' (スロット %d, %s ノード '%s'、レベル %d) のコピーを" +"持っています\n" + +#: netsync.cc:2414 +#, c-format +msgid "" +"(#8) requesting a copy of their live leaf '%s' in slot %d of %s node '%s', " +"level %d\n" +msgstr "" +"(#8) 生きたリーフ '%s' (スロット %d, %s ノード '%s'、レベル %d) のコピーをリ" +"クエストしています\n" + +#: netsync.cc:2419 +#, c-format +msgid "" +"(#8) sending our subtree for refinement, in slot %d of %s node '%s', level %" +"d\n" +msgstr "" +"(#8) 再調整のためにスロット %d (%s ノード '%s', レベル %d)のサブツリーを送信" +"しています\n" + +#: netsync.cc:2442 +#, c-format +msgid "" +"(#9) they have a dead leaf at slot %d in %s node '%s', level %d, we have " +"nothing\n" +msgstr "" +"(#9) こちらにはない、死んだリーフをスロット %d (%s ノード '%s' 内、レベル %" +"d) に持っています\n" + +#: netsync.cc:2449 +#, c-format +msgid "" +"(#10) they have a dead leaf at slot %d in %s node '%s', level %d, we have a " +"live one\n" +msgstr "" +"(#10) こちらでは生きている、死んだリーフをスロット %d (%s ノード '%s' 内、レ" +"ベル %d)に持っています\n" + +#: netsync.cc:2459 +#, c-format +msgid "(#10) we both have %s leaf %s, theirs is dead\n" +msgstr "" +"(#10) 双方とも %s リーフ %s を持っていますが、彼らのものは死んでいます\n" + +#: netsync.cc:2475 +#, c-format +msgid "" +"(#11) they have a dead leaf at slot %d in %s node '%s', level %d, so do we\n" +msgstr "" +"(#11) こちらにもある、死んだリーフをスロット %d (%s ノード '%s' 内、レベル %" +"d)に持っています\n" + +#: netsync.cc:2482 +#, c-format +msgid "" +"(#12) they have a dead leaf in slot %d of %s node '%s', we have a subtree\n" +msgstr "" +"(#12) サブツリーを持っている、死んだリーフをスロット %d (%s ノード '%s' 内)に" +"持っています\n" + +#: netsync.cc:2505 +#, c-format +msgid "" +"(#13) they have a subtree at slot %d in %s node '%s', level %d, we have " +"nothing\n" +msgstr "" +"(#13) こちらにはないサブツリーをスロット %d (%s ノード '%s' 内、レベル %d)に" +"持っています\n" + +#: netsync.cc:2518 +#, c-format +msgid "" +"(#14) they have a subtree at slot %d in %s node '%s', level %d, we have a " +"live leaf\n" +msgstr "" +"(#14) こちらには生きたリーフのあるサブツリーをスロット %d, (%s ノード '%s' " +"内、レベル %d)に持っています\n" + +#: netsync.cc:2530 +#, c-format +msgid "(#14) pushed our leaf '%s' into fake subtree slot %d, level %d\n" +msgstr "" +"(#14) こちらのリーフ '%s' を仮のサブツリースロット %d, レベル %d に挿入\n" + +#: netsync.cc:2542 +#, c-format +msgid "" +"(#15) they have a subtree at slot %d in %s node '%s', level %d, we have a " +"dead leaf\n" +msgstr "" +"(#15) こちらには死んだリーフのあるサブツリーを、スロット %d (%s ノード '%s'、" +"レベル %d)に持っています\n" + +#: netsync.cc:2561 +#, c-format +msgid "" +"(#16) they have a subtree at slot %d in %s node '%s', level %d, and so do " +"we\n" +msgstr "" +"(#16) こちらにもあるサブツリーをスロット %d (%s ノード '%s', レベル %d)に持っ" +"ています\n" + +#: netsync.cc:2571 +#, c-format +msgid "(#16) we both have %s subtree '%s'\n" +msgstr "(#16) 双方とも %s サブツリー '%s' を持っています\n" + +#: netsync.cc:2576 +#, c-format +msgid "(#16) %s subtrees at slot %d differ, refining ours\n" +msgstr "" +"(#16) %s サブツリー (スロット %d) は違っています. こちら側のものを調整しま" +"す\n" + +#: netsync.cc:2603 +#, c-format +msgid "received 'send_data' netcmd requesting %s '%s'\n" +msgstr "%s '%s' をリクエストする 'send_data' netcmd を受信\n" + +#: netsync.cc:2631 +#, c-format +msgid "received 'send_delta' netcmd requesting %s edge '%s' -> '%s'\n" +msgstr "%s 先端 '%s' -> '%s' をリクエストする 'send_delta' netcmd を受信\n" + +#: netsync.cc:2685 +#, c-format +msgid "delta requested for item type %s\n" +msgstr "項目タイプ %s についてリクエストされた差分\n" + +#: netsync.cc:2708 +#, c-format +msgid "epoch '%s' already exists in our database\n" +msgstr "epoch '%s' は既にデータベースにあります\n" + +#: netsync.cc:2715 +#, c-format +msgid "received epoch %s for branch %s\n" +msgstr "epoch %s (ブランチ %s) を受信\n" + +#: netsync.cc:2722 +#, c-format +msgid "branch %s has no epoch; setting epoch to %s\n" +msgstr "ブランチ %s には epoch はありません; epoch を %s に設定します\n" + +#: netsync.cc:2728 +#, c-format +msgid "branch %s already has an epoch; checking\n" +msgstr "ブランチ %s には既に epoch があります; チェック中\n" + +#: netsync.cc:2739 +#, c-format +msgid "Mismatched epoch on branch %s. Server has '%s', client has '%s'." +msgstr "" +"ブランチ %s について epoch が一致しません: サーバー側 '%s', クライアント側 '%" +"s'" + +#: netsync.cc:2750 +#, c-format +msgid "public key '%s' already exists in our database\n" +msgstr "公開鍵 '%s' は既にデータベースにあります\n" + +#: netsync.cc:2759 +#, c-format +msgid "hash check failed for public key '%s' (%s); wanted '%s' got '%s'" +msgstr "公開鍵 '%s' (%s) についてハッシュ検証に失敗; 期待値 '%s'、計算値 '%s'" + +#: netsync.cc:2768 +#, c-format +msgid "cert '%s' already exists in our database\n" +msgstr "証明 '%s' は既にデータベースにあります\n" + +#: netsync.cc:2776 +#, c-format +msgid "hash check failed for revision cert '%s'" +msgstr "リビジョン証明 '%s' についてハッシュ検証に失敗" + +#: netsync.cc:2792 +#, c-format +msgid "revision '%s' already exists in our database\n" +msgstr "リビジョン '%s' は既にデータベースにあります\n" + +#: netsync.cc:2795 +#, c-format +msgid "received revision '%s' \n" +msgstr "リビジョン '%s' を受信\n" + +#: netsync.cc:2814 +#, c-format +msgid "manifest version '%s' already exists in our database\n" +msgstr "バージョン '%s' のマニフェストは既にデータベースにあります\n" + +#: netsync.cc:2829 +#, c-format +msgid "file version '%s' already exists in our database\n" +msgstr "バージョン '%s' のファイルは既にデータベースにあります\n" + +#: netsync.cc:2899 +#, c-format +msgid "ignoring delta received for item type %s\n" +msgstr "項目タイプ %s について受信した差分を無視しています\n" + +#: netsync.cc:2913 +#, c-format +msgid "received 'nonexistant' netcmd for %s '%s'\n" +msgstr "%s '%s' について 'nonexistant' netcmd を受信\n" + +#: netsync.cc:2990 +#, c-format +msgid "" +"received 'anonymous' netcmd from client for pattern '%s' excluding '%s' in %" +"s mode\n" +msgstr "" +"クライアントからパターン '%s' ('%s' を除く; %s モード)への 'anonymous' netcmd を受信\n" + +#: netsync.cc:3021 +#, c-format +msgid "" +"received 'auth(hmac)' netcmd from client '%s' for pattern '%s' exclude '%s' " +"in %s mode with nonce1 '%s'\n" +msgstr "" +"クライアント '%s' からパターン '%s' ('%s' を除く; モード %s) について" +"nonce1 '%s' とともに 'auth(hmac)' netcmd を受信\n" + +#: netsync.cc:3187 +#, c-format +msgid "processing %d byte input buffer from peer %s\n" +msgstr "%d バイトの入力バッファ (送信元: ピーア %s) を処理中\n" + +#: netsync.cc:3190 +#, c-format +msgid "input buffer for peer %s is overfull after netcmd dispatch\n" +msgstr "netcmd dispatch の後でピーア %s の入力バッファがあふれました\n" + +#: netsync.cc:3197 netsync.cc:3231 netsync.cc:3258 +#, c-format +msgid "protocol error while processing peer %s: '%s'\n" +msgstr "ピーア %s: '%s' を処理中にプロトコルエラー発生\n" + +#: netsync.cc:3217 +#, c-format +msgid "connecting to %s\n" +msgstr "%s に接続中\n" + +#: netsync.cc:3244 +#, c-format +msgid "timed out waiting for I/O with peer %s, disconnecting\n" +msgstr "ピーア %s の I/O を待っている間にタイムアウト, 切断中\n" + +#: netsync.cc:3266 +#, c-format +msgid "read from fd %d (peer %s) closed OK after goodbye\n" +msgstr "fd %d (ピーア %s) からの読み込みは goodbye の後で問題なく閉じました\n" + +#: netsync.cc:3268 +#, c-format +msgid "read from fd %d (peer %s) failed, disconnecting\n" +msgstr "fd %d (ピーア %s) からの読み込みに失敗, 切断中\n" + +#: netsync.cc:3278 +#, c-format +msgid "write on fd %d (peer %s) closed OK after goodbye\n" +msgstr "fd %d (ピーア %s) への書き込みは goodbye の後で問題なく閉じました\n" + +#: netsync.cc:3280 +#, c-format +msgid "write on fd %d (peer %s) failed, disconnecting\n" +msgstr "fd %d (ピーア %s) からの書き込みに失敗, 切断中\n" + +#: netsync.cc:3287 +#, c-format +msgid "got OOB data on fd %d (peer %s), disconnecting\n" +msgstr "fd %d (ピーア %s) で OOB データを受信、切断中\n" + +#: netsync.cc:3296 +#, c-format +msgid "terminated exchange with %s\n" +msgstr "%s との交換を切断\n" + +#: netsync.cc:3304 +#, c-format +msgid "successful exchange with %s\n" +msgstr "%s との交換に成功\n" + +#: netsync.cc:3325 +#, c-format +msgid "fd %d is armed\n" +msgstr "fd %d: armed\n" + +#: netsync.cc:3332 +#, c-format +msgid "protocol error while processing peer %s: '%s', marking as bad\n" +msgstr "ピーア %s: '%s' を処理中にプロトコルエラー発生, 間違いとして印付け\n" + +#: netsync.cc:3354 +#, c-format +msgid "accepting new connection on %s : %d\n" +msgstr "%s での新しい接続を受理しています: %d\n" + +#: netsync.cc:3360 +msgid "accept() returned a dead client\n" +msgstr "accept() は死んだクライアントを返しました\n" + +#: netsync.cc:3364 +#, c-format +msgid "accepted new client connection from %s\n" +msgstr "%s からの新しいクライアント接続を受理しました\n" + +#: netsync.cc:3391 +#, c-format +msgid "protocol error while processing peer %s: '%s', disconnecting\n" +msgstr "ピーア %s: '%s' からを処理中にプロトコルエラー発生, 切断中\n" + +#: netsync.cc:3399 +#, c-format +msgid "fd %d (peer %s) read failed, disconnecting\n" +msgstr "fd %d (ピーア %s) 読み込み失敗, 切断中\n" + +#: netsync.cc:3415 +#, c-format +msgid "fd %d (peer %s) write failed, disconnecting\n" +msgstr "fd %d (ピーア %s) 書き込み失敗, 切断中\n" + +#: netsync.cc:3439 +#, c-format +msgid "fd %d (peer %s) processing finished, disconnecting\n" +msgstr "fd %d (ピーア %s) 処理終了, 切断中\n" + +#: netsync.cc:3461 +#, c-format +msgid "fd %d (peer %s) has been idle too long, disconnecting\n" +msgstr "fd %d (ピーア %s) はアイドル時間が長すぎます. 切断中\n" + +#: netsync.cc:3467 +#, c-format +msgid "fd %d (peer %s) exchanged goodbyes and flushed output, disconnecting\n" +msgstr "fd %d (ピーア %s) は goodbye を交し出力をフラッシュしました. 切断中\n" + +#: netsync.cc:3498 +#, c-format +msgid "beginning service on %s : %d\n" +msgstr "%s : %d でサービスを開始しています\n" + +#: netsync.cc:3512 +#, c-format +msgid "session limit %d reached, some connections will be refused\n" +msgstr "" +"セッション制限 %d に達っしました. いくつかの接続については拒否されます\n" + +#: netsync.cc:3518 +#, c-format +msgid "i/o probe with %d armed\n" +msgstr "%d armed で i/o プローブ\n" + +#: netsync.cc:3528 +#, c-format +msgid "timed out waiting for I/O (listening on %s : %d)\n" +msgstr "I/O (%s : %d でリスン中) 待機中にタイムアウト\n" + +#: netsync.cc:3544 +#, c-format +msgid "got woken up for action on unknown fd %d\n" +msgstr "不明な fd %d はアクションのために起こされました\n" + +#: netsync.cc:3559 +#, c-format +msgid "got some OOB data on fd %d (peer %s), disconnecting\n" +msgstr "fd %d (ピーア %s) で OOB データを受信. 切断中\n" + +#: netsync.cc:3621 +msgid "finding items to synchronize:\n" +msgstr "同期するアイテムを検索中:\n" + +#: netsync.cc:3624 +#, c-format +msgid "including branch %s" +msgstr "ブランチ %s を含めます" + +#: netsync.cc:3675 +#, c-format +msgid "setting epoch on %s to zero\n" +msgstr "%s の epoch を零に設定\n" + +#: netsync.cc:3766 +#, c-format +msgid "network error: %s" +msgstr "ネットワークエラー: %s" + +#: netsync.cc:3771 +#, c-format +msgid "network error: %s\n" +msgstr "ネットワークエラー: %s\n" + +#: packet.cc:324 +#, c-format +msgid "writing delayed revision data packet for %s\n" +msgstr "%s について遅延したリビジョンデータパケットを書き込み中\n" + +#: packet.cc:331 +#, c-format +msgid "discarding revision data packet %s with unmet dependencies\n" +msgstr "依存関係を満たさないリビジョンデータパケット %s を破棄しています\n" + +#: packet.cc:337 +#, c-format +msgid "writing delayed manifest data packet for %s\n" +msgstr "%s について遅延したマニフェストデータパケットを書き込み中\n" + +#: packet.cc:344 +#, c-format +msgid "discarding manifest data packet %s with unmet dependencies\n" +msgstr "依存関係を満たさないマニフェストデータパケット %s を破棄しています\n" + +#: packet.cc:350 +#, c-format +msgid "writing delayed file data packet for %s\n" +msgstr "%s について遅延ファイルデータパケットを書き込み中\n" + +#: packet.cc:363 +#, c-format +msgid "writing delayed manifest %s packet for %s -> %s\n" +msgstr "遅延マニフェスト %s パケット(%s -> %s)を書き込み中\n" + +#: packet.cc:376 +#, c-format +msgid "discarding manifest delta packet %s -> %s with unmet dependencies\n" +msgstr "依存関係を満たさないマニフェスト差分パケット %s -> %s を破棄しています\n" + +#: packet.cc:383 +#, c-format +msgid "writing delayed file %s packet for %s -> %s\n" +msgstr "遅延したファイル %s パケット(%s -> %s)を書き込み中\n" + +#: packet.cc:396 +#, c-format +msgid "discarding file delta packet %s -> %s with unmet dependencies\n" +msgstr "依存関係を満たさないファイル差分パケット %s -> %s を破棄しています\n" + +#: packet.cc:403 +#, c-format +msgid "writing delayed revision cert on %s\n" +msgstr "%s の遅延リビジョン証明を書き込み中\n" + +#: packet.cc:410 +#, c-format +msgid "discarding revision cert packet %s with unmet dependencies\n" +msgstr "依存関係を満たさないリビジョン証明パケット %s を破棄しています\n" + +#: packet.cc:417 +#, c-format +msgid "writing delayed public key %s\n" +msgstr "遅延公開鍵 %s を書き込み中\n" + +#: packet.cc:430 +#, c-format +msgid "writing delayed private key %s\n" +msgstr "遅延秘密鍵 %s を書き込み中\n" + +#: packet.cc:600 +#, c-format +msgid "noting acceptence of revision %s\n" +msgstr "リビジョン %s について受理したものはありません\n" + +#: packet.cc:613 +#, c-format +msgid "noting acceptence of manifest %s\n" +msgstr "マニフェスト %s について受理したものはありません\n" + +#: packet.cc:626 +#, c-format +msgid "noting acceptence of file %s\n" +msgstr "ファイル %s について受理したものはありません\n" + +#: packet.cc:648 +#, c-format +msgid "skipping existing file version %s\n" +msgstr "既存のファイル、バージョン %s をスキップしています\n" + +#: packet.cc:676 +#, c-format +msgid "reconstructed file from delta '%s' -> '%s' has wrong id '%s'\n" +msgstr "" +"差分 '%s' -> '%s' から再構築されたファイルは不正な ID '%s' を持っています\n" + +#: packet.cc:682 +#, c-format +msgid "delaying file delta %s -> %s for preimage\n" +msgstr "事前イメージのためのファイル差分 %s -> %s を遅延中\n" + +#: packet.cc:692 +#, c-format +msgid "skipping delta to existing file version %s\n" +msgstr "既存のファイル、バージョン %s への差分をスキップしています\n" + +#: packet.cc:720 +#, c-format +msgid "reconstructed file from reverse delta '%s' -> '%s' has wrong id '%s'\n" +msgstr "" +"逆向きの差分 '%s' -> '%s' から再構築されたファイルは不正な ID '%s' を持ってい" +"ます\n" + +#: packet.cc:726 +#, c-format +msgid "delaying reverse file delta %s -> %s for preimage\n" +msgstr "事前イメージのための逆向きのファイル差分 %s -> %s を遅延中\n" + +#: packet.cc:736 +#, c-format +msgid "skipping reverse delta to existing file version %s\n" +msgstr "既存のファイル、バージョン %s への逆向きの差分をスキップしています\n" + +#: packet.cc:753 +#, c-format +msgid "skipping existing manifest version %s\n" +msgstr "既存のマニフェスト、バージョン %s をスキップしています\n" + +#: packet.cc:781 +#, c-format +msgid "reconstructed manifest from delta '%s' -> '%s' has wrong id '%s'\n" +msgstr "" +"差分 '%s' -> '%s' から再構築されたマニフェストは不正な ID '%s' を持っていま" +"す\n" + +#: packet.cc:787 +#, c-format +msgid "delaying manifest delta %s -> %s for preimage\n" +msgstr "事前イメージのための逆向きのファイル差分 %s -> %s を遅延中\n" + +#: packet.cc:797 +#, c-format +msgid "skipping delta to existing manifest version %s\n" +msgstr "既存のマニフェストバージョン %s への差分をスキップしています\n" + +#: packet.cc:825 +#, c-format +msgid "" +"reconstructed manifest from reverse delta '%s' -> '%s' has wrong id '%s'\n" +msgstr "" +"逆向きの差分 '%s' -> '%s' から再構築されたマニフェストは不正な ID '%s' を持っ" +"ています\n" + +#: packet.cc:831 +#, c-format +msgid "delaying manifest reverse delta %s -> %s for preimage\n" +msgstr "事前イメージのためのマニフェストの逆向きの差分 %s -> %s を遅延中\n" + +#: packet.cc:841 +#, c-format +msgid "skipping reverse delta to existing manifest version %s\n" +msgstr "" +"既存のマニフェスト、バージョン %s への逆向きの差分をスキップしています\n" + +#: packet.cc:863 +#, c-format +msgid "delaying revision %s for new manifest %s\n" +msgstr "リビジョン %s (新しいマニフェスト %s) を遅延しています\n" + +#: packet.cc:877 +#, c-format +msgid "delaying revision %s for old manifest %s\n" +msgstr "リビジョン %s (古いマニフェスト %s) を遅延しています\n" + +#: packet.cc:887 +#, c-format +msgid "delaying revision %s for old revision %s\n" +msgstr "リビジョン %s (古いリビジョン %s) を遅延しています\n" + +#: packet.cc:900 +#, c-format +msgid "delaying revision %s for old file %s\n" +msgstr "リビジョン %s (古いファイル %s) を遅延しています\n" + +#: packet.cc:910 +#, c-format +msgid "delaying revision %s for new file %s\n" +msgstr "リビジョン %s (新しいファイル %s) を遅延しています\n" + +#: packet.cc:928 +#, c-format +msgid "skipping existing revision %s\n" +msgstr "既存のリビジョン %s をスキップしています\n" + +#: packet.cc:946 +#, c-format +msgid "delaying revision cert on %s\n" +msgstr "%s のリビジョン証明を遅延しています\n" + +#: packet.cc:959 +#, c-format +msgid "skipping existing revision cert %s\n" +msgstr "既存のリビジョン証明 %s をスキップしています\n" + +#: packet.cc:973 +#, c-format +msgid "skipping prohibited public key %s\n" +msgstr "禁止された公開鍵 %s をスキップしています\n" + +#: packet.cc:986 +#, c-format +msgid "key '%s' is not equal to key '%s' in database\n" +msgstr "鍵 '%s' はデータベース内の鍵 '%s' と一致しません\n" + +#: packet.cc:987 +#, c-format +msgid "skipping existing public key %s\n" +msgstr "既存の公開鍵 %s をスキップしています\n" + +#: packet.cc:1000 +#, c-format +msgid "skipping prohibited private key %s\n" +msgstr "禁止された秘密鍵 %s をスキップしています\n" + +#: packet.cc:1009 +#, c-format +msgid "skipping existing private key %s\n" +msgstr "既存の秘密鍵 %s をスキップしています\n" + +#: packet.cc:1045 +msgid "packet valve opened\n" +msgstr "パケットバルブ: 開\n" + +#: packet.cc:1057 +#, c-format +msgid "wrote %i queued packets\n" +msgstr "%i キューパケット書き込み\n" + +#: packet.cc:1306 +msgid "read data packet\n" +msgstr "データパケット読み込み\n" + +#: packet.cc:1328 +msgid "read delta packet\n" +msgstr "差分パケット読み込み\n" + +#: packet.cc:1359 +msgid "read cert packet\n" +msgstr "証明パケット読み込み\n" + +#: packet.cc:1385 +msgid "read key data packet\n" +msgstr "鍵データパケット読み込み\n" + +#: rcs_file.cc:343 +#, c-format +msgid "parse failure %d:%d: expecting %s, got %s with value '%s'\n" +msgstr "解析失敗 %d:%d: 期待値 %s, 取得 %s (値 '%s')\n" + +#: rcs_file.cc:362 +#, c-format +msgid "parse failure %d:%d: expecting word '%s'\n" +msgstr "解析失敗 %d:%d: 期待される語句 '%s'\n" + +#: rcs_file.cc:377 +#, c-format +msgid "parse failure %d:%d: expecting word\n" +msgstr "解析失敗 %d:%d: 期待される語句\n" + +#: rcs_import.cc:249 +#, c-format +msgid "Calculating time of %s\n" +msgstr "%s の時間を計算中\n" + +#: rcs_import.cc:263 +#, c-format +msgid "= %i\n" +msgstr "= %i\n" + +#: rcs_import.cc:283 +#, c-format +msgid "version %s -> tag %s\n" +msgstr "バージョン %s - タグ %s\n" + +#: rcs_import.cc:450 +msgid "skipping identity file edge\n" +msgstr "識別ファイルの先端をスキップしています\n" + +#: rcs_import.cc:458 rcs_import.cc:484 +#, c-format +msgid "existing path to %s found, skipping\n" +msgstr "%s への既存のパスを発見、スキップしています\n" + +#: rcs_import.cc:476 +msgid "skipping identity manifest edge\n" +msgstr "識別マニフェストの先端をスキップしています\n" + +#: rcs_import.cc:594 +#, c-format +msgid "version %s has %d lines\n" +msgstr "バージョン %s には %d 行あります\n" + +#: rcs_import.cc:607 +#, c-format +msgid "following RCS edge %s -> %s\n" +msgstr "次の RCS 先端 %s -> %s\n" + +#: rcs_import.cc:610 +#, c-format +msgid "constructed RCS version %s, inserting into database\n" +msgstr "構築された RCS バージョン %s をデータベースに挿入\n" + +#: rcs_import.cc:653 +#, c-format +msgid "following RCS branch %s = '%s'\n" +msgstr "次の RCS ブランチ %s = '%s' を追跡中\n" + +#: rcs_import.cc:663 +#, c-format +msgid "finished RCS branch %s = '%s'\n" +msgstr "RCS ブランチ %s ='%s' を終了\n" + +#: rcs_import.cc:684 rcs_import.cc:733 +#, c-format +msgid "parsing RCS file %s\n" +msgstr "RCS ファイル %s を解析中\n" + +#: rcs_import.cc:686 rcs_import.cc:736 +#, c-format +msgid "parsed RCS file %s OK\n" +msgstr "解析した RCS ファイル %s: OK\n" + +#: rcs_import.cc:776 +#, c-format +msgid "importing file '%s'\n" +msgstr "ファイル '%s' を取り込み中\n" + +#: rcs_import.cc:848 +#, c-format +msgid "first version in branch %s would be %s\n" +msgstr "ブランチ %s 内の最初のバージョンは %s でしょう\n" + +#: rcs_import.cc:855 +#, c-format +msgid "file branchpoint for %s at %s\n" +msgstr "%s のファイルブランチ点 %s\n" + +#: rcs_import.cc:925 +#, c-format +msgid "error reading RCS file %s: %s\n" +msgstr "RCS ファイル %s を読み込み中にエラー: %s\n" + +#: rcs_import.cc:929 +#, c-format +msgid "skipping non-RCS file %s\n" +msgstr "非 RCS ファイル %s をスキップしています\n" + +#: rcs_import.cc:1108 +#, c-format +msgid "examining next commit [t:%d] [p:%s] [a:%s] [c:%s]\n" +msgstr "次のコミット [t:%d] [p:%s] [a:%s] [c:%s] を検査中\n" + +#: rcs_import.cc:1121 +msgid "expiring cluster\n" +msgstr "クラスタを終了中\n" + +#: rcs_import.cc:1137 +#, c-format +msgid "examining cluster %d to see if it touched %d\n" +msgstr "クラスタ %d が %d にふれているか調べています\n" + +#: rcs_import.cc:1145 +#, c-format +msgid "found cluster touching %d: [t:%d] [a:%d] [c:%d]\n" +msgstr "%d: [t:%d] [a:%d] [c:%d] にふれているクラスタをみつけました\n" + +#: rcs_import.cc:1153 +#, c-format +msgid "last modification time is %d\n" +msgstr "最終更新日時は %d です\n" + +#: rcs_import.cc:1169 +#, c-format +msgid "picked existing cluster [t:%d] [a:%d] [c:%d]\n" +msgstr "既存のクラスタ [t:%d] [a:%d] [c:%d] を選択\n" + +#: rcs_import.cc:1183 +#, c-format +msgid "building new cluster [t:%d] [a:%d] [c:%d]\n" +msgstr "新しいクラスタ [t:%d] [a:%d] [c:%d] を作成中\n" + +#: rcs_import.cc:1208 +msgid "finished branch commits, writing all pending clusters\n" +msgstr "ブランチコミットを終了し、すべての待機中のクラスタを書き込んでいます\n" + +#: rcs_import.cc:1214 +msgid "finished writing pending clusters\n" +msgstr "待機中のクラスタを書き込んでいます\n" + +#: rcs_import.cc:1226 +#, c-format +msgid "" +"%s appears to be a CVS repository root directory\n" +"try importing a module instead, with 'cvs_import %s/" +msgstr "" +"%s は CVS リポジトリのルートディレクトリのようです.\n" +"代りに 'cvs_import %s/<モジュール名>' で取り込んでみて下さい" + +#: rcs_import.cc:1239 +msgid "need base --branch argument for importing" +msgstr "取り込みにはベース --branch 引数が必要です" + +#: rcs_import.cc:1251 +#, c-format +msgid "path %s does not exist" +msgstr "パス %s は存在しません" + +#: rcs_import.cc:1253 +#, c-format +msgid "path %s is not a directory" +msgstr "パス %s はディレクトリではありません" + +#: rcs_import.cc:1256 +#, c-format +msgid "could not change directory to %s" +msgstr "ディレクトリ %s に移動できません" + +#: rcs_import.cc:1272 +#, c-format +msgid "branch %s has %d entries\n" +msgstr "ブランチ %s は %d 個のエントリを持っています\n" + +#: rcs_import.cc:1282 +#, c-format +msgid "trunk has %d entries\n" +msgstr "trunk は %d 個のエントリを持っています\n" + +#: rcs_import.cc:1335 +#, c-format +msgid "initial cluster on branch %s has %d live entries\n" +msgstr "ブランチ %s の初期クラスタは %d 個の生きたエントリを持っています\n" + +#: rcs_import.cc:1342 +#, c-format +msgid "initial cluster contains %s at %s\n" +msgstr "初期クラスタは %s を %s に含んでいます\n" + +#: rcs_import.cc:1388 +#, c-format +msgid "storing manifest '%s' (base %s)\n" +msgstr "マニフェスト '%s' (ベース %s) を保存しています\n" + +#: rcs_import.cc:1393 +#, c-format +msgid "storing head %s\n" +msgstr "ヘッド %s を保存しています\n" + +#: rcs_import.cc:1408 +msgid "skipping delta to null manifest\n" +msgstr "空マニフェストについての差分をスキップしています\n" + +#: rcs_import.cc:1420 +#, c-format +msgid "skipping cyclical manifest delta %s -> %s\n" +msgstr "マニフェストの循環差分 %s -> %s をスキップしています\n" + +#: rcs_import.cc:1426 +#, c-format +msgid "writing full manifest %s\n" +msgstr "完全なマニフェスト %s を書き込み中\n" + +#: rcs_import.cc:1436 +#, c-format +msgid "storing manifest delta %s -> %s\n" +msgstr "マニフェスト差分 %s -> %s を保存中\n" + +#: rcs_import.cc:1498 +#, c-format +msgid "adding entry state '%s' on '%s'\n" +msgstr "エントリ状態 '%s' ('%s') を追加しています\n" + +#: rcs_import.cc:1505 +#, c-format +msgid "applying state delta on '%s' : '%s' -> '%s'\n" +msgstr "'%s' : '%s' -> '%s' の状態差分を適用中\n" + +#: rcs_import.cc:1516 +#, c-format +msgid "deleting entry state '%s' on '%s'\n" +msgstr "エントリ状態 '%s' ('%s') を削除しています\n" + +#: rcs_import.cc:1535 +msgid "BEGIN consume_cluster()\n" +msgstr "BEGIN consume_cluster()\n" + +#: rcs_import.cc:1555 +#, c-format +msgid "END consume_cluster('%s') (parent '%s')\n" +msgstr "END consume_cluster('%s') (親 '%s')\n" + +#: revision.cc:124 +msgid "verifying new revisions (this may take a while)\n" +msgstr "新しいリビジョンを検証中 (しばらく御待ち下さい)\n" + +#: revision.cc:126 +#, c-format +msgid "Verifying revision %s has sane history (to depth %i)\n" +msgstr "リビジョン %s が正しい履歴を持っているか検証しています(深さ %i)\n" + +#: revision.cc:164 +#, c-format +msgid "Examining %s -> %s\n" +msgstr "%s -> %s を検討中\n" + +#: revision.cc:241 +#, c-format +msgid "%s and %s have no common ancestor, so done\n" +msgstr "%s と %s には共通の祖先はありません. 完了\n" + +#: revision.cc:247 +msgid "already checked common ancestor, so done\n" +msgstr "既にチェック済の共通の祖先. 完了\n" + +#: revision.cc:250 +#, c-format +msgid "%s is a merge; verifying paths to common ancestor %s are sane\n" +msgstr "%s は統合です; 共通の祖先 %s へのパスが適切なものか検証しています\n" + +#: revision.cc:304 +#, c-format +msgid "loading parents for node %d\n" +msgstr "ノード %d の親を読み込み中\n" + +#: revision.cc:324 +#, c-format +msgid "parent %s -> node %d\n" +msgstr "親 %s -> ノード %d\n" + +#: revision.cc:474 +#, c-format +msgid "found %d intersecting nodes\n" +msgstr "交差ノードが %d みつかりました\n" + +#: revision.cc:527 +#, c-format +msgid "searching for common ancestor, left=%s right=%s\n" +msgstr "å·¦=%s 右=%s の共通の祖先を検索中\n" + +#: revision.cc:532 +#, c-format +msgid "common ancestor scan [par=%d,anc=%d,dom=%d]\n" +msgstr "共通の祖先を走査 [親=%d,祖先=%d,支配=%d]\n" + +#: revision.cc:537 +#, c-format +msgid "found node %d, ancestor of left %s and dominating right %s\n" +msgstr "みつかったノード %d は左 %s と支配している右 %s の祖先です\n" + +#: revision.cc:544 +#, c-format +msgid "found node %d, ancestor of right %s and dominating left %s\n" +msgstr "みつかったノード %d は右 %s と支配している左 %s の祖先です\n" + +#: revision.cc:581 +#, c-format +msgid "searching for least common ancestor, left=%s right=%s\n" +msgstr "最小公倍の祖先を検索中, å·¦=%s 右=%s\n" + +#: revision.cc:585 +#, c-format +msgid "least common ancestor scan [par=%d,anc=%d]\n" +msgstr "最小公倍の祖先を走査 [親=%d,祖先=%d]\n" + +#: revision.cc:590 +#, c-format +msgid "found node %d, ancestor of left %s and right %s\n" +msgstr "みつかったノード %d は左 %s、右 %s の祖先です\n" + +#: revision.cc:644 +#, c-format +msgid "checking whether %s is an ancestor of %s\n" +msgstr "%s が %s の祖先かどうかチェックしています\n" + +#: revision.cc:756 +#, c-format +msgid "new root: %s\n" +msgstr "新規ルート: %s\n" + +#: revision.cc:771 +#, c-format +msgid "new leaf: %s\n" +msgstr "新規リーフ: %s\n" + +#: revision.cc:913 +#, c-format +msgid "exploring changesets from parents of %s, seeking towards %s\n" +msgstr "%s の親から %s に向って変更セットを調査中\n" + +#: revision.cc:926 +#, c-format +msgid "considering parent %s of %s\n" +msgstr "親 %s (%s) について検討中\n" + +#: revision.cc:952 +#, c-format +msgid "revision %s is relevant, composing with edge to %s\n" +msgstr "リビジョン %s は %s への先端と関連し複合しています\n" + +#: revision.cc:959 +#, c-format +msgid "parent %s of %s is not relevant\n" +msgstr "親 %s (%s) は関連していません\n" + +#: revision.cc:995 +#, c-format +msgid "adding parents of %s to subgraph\n" +msgstr "%s の親をサブグラフに追加しています\n" + +#: revision.cc:1005 +#, c-format +msgid "found parent %s of %s\n" +msgstr "親 %s (%s) を発見\n" + +#: revision.cc:1009 +#, c-format +msgid "adding parent %s to next frontier\n" +msgstr "親 %s を次の先端に追加中\n" + +#: revision.cc:1024 +#, c-format +msgid "calculating composite changeset between %s and %s\n" +msgstr "%s と %s の間の複合変更セットを見積っています\n" + +#: revision.cc:1042 +#, c-format +msgid "calculating changeset from %s to %s\n" +msgstr "%s から %s への変更セットを見積っています\n" + +#: revision.cc:1046 +#, c-format +msgid "no common ancestor for %s and %s\n" +msgstr "%s と %s の共通の祖先はありません\n" + +#: revision.cc:1047 +#, c-format +msgid "common ancestor is %s\n" +msgstr "共通の祖先は %s です\n" + +#: revision.cc:1078 +#, c-format +msgid "analyzing manifest changes from '%s' -> '%s'\n" +msgstr "'%s' -> '%s' からマニフェストの変更を解析しています\n" + +#: revision.cc:1091 +#, c-format +msgid "splitting ancestry for file %s\n" +msgstr "ファイル %s の系統を分離中\n" + +#: revision.cc:1158 +#, c-format +msgid "noting ancestry from child %d -> parent %d\n" +msgstr "子 %d -> 親 %d の系統はありません\n" + +#: revision.cc:1191 +#, c-format +msgid "setting epoch for %s to %s\n" +msgstr "%s の epoch を %s に設定\n" + +#: revision.cc:1247 +msgid "scanning for nodes with 3+ parents\n" +msgstr "3 個以上の親を持つノードを走査しています\n" + +#: revision.cc:1288 +#, c-format +msgid "optimizing out redundant edge %i -> %i\n" +msgstr "冗長な先端 %i -> %i を最適化しています\n" + +#: revision.cc:1315 +#, c-format +msgid "rebuilding %d nodes\n" +msgstr "再構築中: %d ノード\n" + +#: revision.cc:1352 +#, c-format +msgid "node %d = manifest %s\n" +msgstr "ノード %d = マニフェスト %s\n" + +#: revision.cc:1363 +#, c-format +msgid "loaded '%s' manifest cert for node %s\n" +msgstr "'%s' マニフェスト証明 (ノード %s) を読み込み\n" + +#: revision.cc:1391 +#, c-format +msgid "node %d = revision %s = manifest %s\n" +msgstr "ノード %d = リビジョン %s = マニフェスト %s\n" + +#: revision.cc:1403 +#, c-format +msgid "loaded '%s' revision cert for node %s\n" +msgstr "'%s' リビジョン証明 (ノード %s) を読み込み\n" + +#: revision.cc:1427 +#, c-format +msgid "processing node %d\n" +msgstr "ノード %d を処理中\n" + +#: revision.cc:1431 +#, c-format +msgid "node %d already processed, skipping\n" +msgstr "ノード %d は既に処理されています. スキップします\n" + +#: revision.cc:1445 +#, c-format +msgid "node %d is a root node\n" +msgstr "ノード %d はルートノードです\n" + +#: revision.cc:1461 revision.cc:1544 +#, c-format +msgid "parent node %d = revision %s\n" +msgstr "親ノード %d = リビジョン %s\n" + +#: revision.cc:1523 +#, c-format +msgid "processing edge from child %d -> parent %d\n" +msgstr "子 %d -> 親 %d から先端を処理中\n" + +#: revision.cc:1561 +#, c-format +msgid "mapped node %d to revision %s\n" +msgstr "ノード %d をリビジョン %s へ割り当てました\n" + +#: revision.cc:1567 +#, c-format +msgid "skipping already existing revision %s\n" +msgstr "既存のリビジョン %s をスキップしています\n" + +#: revision.cc:1579 +msgid "rebuilding revision graph from existing graph\n" +msgstr "既存のグラフからリビジョングラフを再度構成中\n" + +#: revision.cc:1612 +msgid "rebuilding revision graph from manifest certs\n" +msgstr "マニフェスト証明からリビジョングラフを再度構成中\n" + +#: sanity.cc:37 +#, c-format +msgid "started up on %s\n" +msgstr "%s で開始\n" + +#: sanity.cc:246 +msgid "ignoring request to give last gasp; already in process of dumping\n" +msgstr "最後の変更要請を無視します; 既にダンプ中です\n" + +#: sanity.cc:250 +#, c-format +msgid "saving current work set: %i items" +msgstr "現在の作業セットを保存中: %i アイテム" + +#: sanity.cc:252 +#, c-format +msgid "Current work set: %i items\n" +msgstr "現在の作業セット: %i アイテム\n" + +#: sanity.cc:265 sanity.cc:270 +msgid "ignoring error trigged by saving work set to debug log" +msgstr "作業セットの保存によって引き起されたデバッグログへのエラーを無視します" + +#: sanity.cc:274 +msgid "finished saving work set" +msgstr "作業セットの保存終了" + +#: sanity.hh:231 +#, c-format +msgid "----- begin '%s' (in %s, at %s:%d)\n" +msgstr "----- '%s' 開始 (%s 内、箇所 %s:%d)\n" + +#: sanity.hh:235 +#, c-format +msgid "----- end '%s' (in %s, at %s:%d)\n" +msgstr "----- 終了 '%s' (%s 内、箇所 %s:%d)\n" + +#: schema_migration.cc:260 +#, c-format +msgid "database schema %s is unknown; cannot perform migration" +msgstr "不明なデータベーススキーマ %s; 統合できません" + +#: schema_migration.cc:265 +#, c-format +msgid "no migration performed; database schema already up-to-date at %s\n" +msgstr "統合しません; データベーススキーマは既に最新になっています: %s\n" + +#: transforms.cc:523 +#, c-format +msgid "converting %d bytes from %s to %s\n" +msgstr "%d バイト: %s から %s へ変換中\n" + +#: transforms.cc:529 +#, c-format +msgid "failed to convert string from %s to %s: '%s'" +msgstr "文字列の変換 (%s から %s へ) に失敗: '%s'" + +#: transforms.cc:577 +#, c-format +msgid "converting %d bytes from IDNA ACE to UTF-8\n" +msgstr "IDNA ACE から UTF-8 へ変換中 (%d バイト)\n" + +#: transforms.cc:580 transforms.cc:594 +#, c-format +msgid "error converting %d UTF-8 bytes to IDNA ACE: %s" +msgstr "UTF-8 から IDNA ACE へ変換中にエラー(%d バイト): %s" + +#: transforms.cc:591 +#, c-format +msgid "converting %d bytes from UTF-8 to IDNA ACE\n" +msgstr "UTF-8 から IDNA ACE へ変換中 (%d バイト)\n" + +#: transforms.cc:845 +#, c-format +msgid "doing linesep conversion to %s\n" +msgstr "%s について行末を変換中\n" + +#: transforms.cc:1121 +#, c-format +msgid "ACE-encoded %s: '%s'\n" +msgstr "ACE エンコード %s: '%s'\n" + +#: ui.cc:126 +#, c-format +msgid "%.1f%s" +msgstr "%.1f%s" + +#: ui.cc:130 +#, c-format +msgid "%d" +msgstr "%d" + +#: update.cc:66 +#, c-format +msgid "failed to decode boolean testresult cert value '%s'\n" +msgstr "テスト結果真偽値の証明値 '%s' のデコードに失敗\n" + +#: update.cc:78 +#, c-format +msgid "Considering update target %s\n" +msgstr "ターゲット %s の更新について考慮中\n" + +#: update.cc:88 +#, c-format +msgid "%s not in branch %s\n" +msgstr "%s はブランチ %s 内にはありません\n" + +#: update.cc:97 +#, c-format +msgid "%s is acceptable update candidate\n" +msgstr "%s は受け入れ可能な更新候補です\n" + +#: update.cc:102 +#, c-format +msgid "%s has unacceptable test results\n" +msgstr "%s は受け入れられないテスト結果です\n" + +#: update.cc:160 +msgid "cannot determine branch for update" +msgstr "更新するブランチを決定できません" + +#: vocab.cc:57 +#, c-format +msgid "hex encoded ID '%s' size != %d" +msgstr "十六進エンコード ID '%s' サイズ != %d" + +#: vocab.cc:60 +#, c-format +msgid "bad character '%c' in id name '%s'" +msgstr "不正な文字 '%c' (ID 名 '%s' 内)" + +#: vocab.cc:73 +#, c-format +msgid "bad character '%c' in ace string '%s'" +msgstr "不正な文字 '%c' (ace 文字列 '%s' 内)" + +#: vocab.cc:87 +#, c-format +msgid "bad character '%c' in cert name '%s'" +msgstr "不正な文字 '%c' (証明 '%s' 内)" + +#: vocab.cc:100 +#, c-format +msgid "bad character '%c' in key name '%s'" +msgstr "不正な文字 '%c' (キー名 '%s' 内)" + +#: vocab.cc:118 +#, c-format +msgid "Invalid key length of %d bytes" +msgstr "不正な鍵長 %d バイト" + +#: vocab.cc:136 +#, c-format +msgid "Invalid hmac length of %d bytes" +msgstr "不正な HMAC 長 %d バイト" + +#: vocab.cc:166 +#, c-format +msgid "prohibited absolute path '%s'" +msgstr "禁止された絶対パス '%s'" + +#: vocab.cc:171 +#, c-format +msgid "empty path component in '%s'" +msgstr "空のパスコンポーネント ('%s' 内)" + +#: vocab.cc:174 +#, c-format +msgid "prohibited path component '%s' in '%s'" +msgstr "禁止されたパスコンポーネント '%s' ('%s' 内)" + +#: vocab.cc:178 +#, c-format +msgid "bad character '%d' in path component '%s' of '%s'" +msgstr "不正な文字 '%d' (パスコンポーネント内 '%s'、'%s')" + +#: vocab.cc:184 +#, c-format +msgid "null byte in path component '%s' of '%s'" +msgstr "パスコンポーネント '%s' ('%s') 内に NULL バイト" + +#: vocab.cc:239 +#, c-format +msgid "prohibited book-keeping path in '%s'" +msgstr "'%s' 内の禁止された book-keeping パス" + +#: work.cc:60 +#, c-format +msgid "skipping ignorable file %s\n" +msgstr "無視可能なファイル %s をスキップしています\n" + +#: work.cc:66 +#, c-format +msgid "skipping %s, already accounted for in working copy\n" +msgstr "既に作業コピーに追加されている %s をスキップしています\n" + +#: work.cc:70 +#, c-format +msgid "adding %s to working copy add set\n" +msgstr "作業コピー追加セットに %s を追加しています\n" + +#: work.cc:98 work.cc:204 +msgid "invalid path ''" +msgstr "不適切なパス ''" + +#: work.cc:100 +#, c-format +msgid "path %s does not exist\n" +msgstr "パス %s は存在しません\n" + +#: work.cc:137 +#, c-format +msgid "adding attribute '%s' to file %s to %s\n" +msgstr "属性 '%s' (ファイル %s)を %s に追加しています\n" + +#: work.cc:208 +#, c-format +msgid "skipping %s, not currently tracked\n" +msgstr "現在追跡対象ではない %s をスキップしています\n" + +#: work.cc:212 +#, c-format +msgid "adding %s to working copy delete set\n" +msgstr "%s を作業コピー削除セットに追加しています\n" + +#: work.cc:216 +#, c-format +msgid "" +"sorry -- 'drop ' is currently broken.\n" +"try 'find %s -type f | monotone drop address@hidden'\n" +msgstr "" +"申し分けないですが 'drop <ディレクトリ>' は使えません.\n" +"代りに 'find %s -type f | monotone drop address@hidden' を試してみて下さい.\n" + +#: work.cc:228 +#, c-format +msgid "dropped attributes for file %s from %s\n" +msgstr "ファイル %s の属性を %s から削除しました\n" + +#: work.cc:251 +msgid "invalid source path ''" +msgstr "不適切なソースパス ''" + +#: work.cc:252 +msgid "invalid destination path ''" +msgstr "不適切な方向パス ''" + +#: work.cc:263 +#, c-format +msgid "%s does not exist in current revision\n" +msgstr "ファイル %s は現在のリビジョン内にはありません\n" + +#: work.cc:266 +#, c-format +msgid "%s already exists in current revision\n" +msgstr "%s は現在のリビジョン内に存在しています\n" + +#: work.cc:268 +#, c-format +msgid "adding %s -> %s to working copy rename set\n" +msgstr "%s -> %s を作業コピー名称変更セットに追加しています\n" + +#: work.cc:288 +#, c-format +msgid "%s has existing attributes in %s; clean them up first" +msgstr "%s は既存の %s 内に属性を持っています; まずそれを削除して下さい" + +#: work.cc:297 +#, c-format +msgid "moving attributes for %s to %s\n" +msgstr "%s の属性を %s に移動中\n" + +#: work.cc:316 +#, c-format +msgid "work path is %s\n" +msgstr "作業パスは %s です\n" + +#: work.cc:325 +#, c-format +msgid "checking for un-committed work file %s\n" +msgstr "未コミットの作業ファイル %s をチェック中\n" + +#: work.cc:329 +#, c-format +msgid "read rearrangement from %s\n" +msgstr "%s から再調整読み取り\n" + +#: work.cc:333 +#, c-format +msgid "no un-committed work file %s\n" +msgstr "未コミットの作業ファイル %s はありません\n" + +#: work.cc:370 +#, c-format +msgid "revision path is %s\n" +msgstr "リビジョンパスは %s です\n" + +#: work.cc:380 +#, c-format +msgid "working copy is corrupt: %s does not exist\n" +msgstr "作業コピーは壊れています: %s は存在しません\n" + +#: work.cc:383 +#, c-format +msgid "loading revision id from %s\n" +msgstr "%s からリビジョン ID を読み込み中\n" + +#: work.cc:390 +#, c-format +msgid "Problem with working directory: %s is unreadable" +msgstr "作業ディレクトリに問題があります: %s を読み込めません" + +#: work.cc:399 +#, c-format +msgid "writing revision id to %s\n" +msgstr "リビジョン ID を %s に書き込み中\n" + +#: work.cc:418 +#, c-format +msgid "base revision %s does not exist in database\n" +msgstr "データベースにベースリビジョン %s は含まれていません\n" + +#: work.cc:421 +#, c-format +msgid "old manifest is %s\n" +msgstr "古い manifest は %s です\n" + +#: work.cc:424 +#, c-format +msgid "base manifest %s does not exist in database\n" +msgstr "データベースにベースマニフェスト %s は含まれていません\n" + +#: work.cc:429 +#, c-format +msgid "old manifest has %d entries\n" +msgstr "古い manifest は %d 個のエントリを持っています\n" + +#: work.cc:450 +#, c-format +msgid "user log path is %s\n" +msgstr "ユーザーログパスは %s です\n" + +#: work.cc:499 +#, c-format +msgid "options path is %s\n" +msgstr "オプションパスは %s です\n" + +#: work.cc:546 +#, c-format +msgid "local dump path is %s\n" +msgstr "ローカルのダンプパスは %s です\n" + +#: work.cc:598 +#, c-format +msgid "attribute map path is %s\n" +msgstr "属性マップパスは %s です\n" + +#: xdelta.cc:346 +msgid "computing binary delta instructions\n" +msgstr "バイナリ差分命令を計算しています\n" + +#: xdelta.cc:348 +msgid "computed binary delta instructions\n" +msgstr "バイナリ差分命令の計算結果\n" + +#: xdelta.cc:804 +#, c-format +msgid "src %d, dst %d, fdel %d, rdel %d\n" +msgstr "src %d, dst %d, fdel %d, rdel %d\n" + +#: xdelta.cc:808 +msgid "confirming src == dst and rdel == 0\n" +msgstr "src == dst, rdel == 0 を確認中\n" + +#: xdelta.cc:816 +#, c-format +msgid "confirming dst1 %d, dst2 %d\n" +msgstr "dst1 %d, dst2 %d を確認中\n" ======================================================================== --- sanity.hh 4b60e04581e65bb1426c17f8807b37ec0e7775d8 +++ sanity.hh 2c8cee0f678668a356de29a5c61fb3eed8c87b74 @@ -92,10 +92,10 @@ extern sanity global_sanity; // F is for when you want to build a boost formatter for display -#define F(str) boost::format(gettext(str), ui.user_locale) +#define F(str) boost::format(gettext(str), get_user_locale()) // FP is for when you want to build a boost formatter for displaying a plural -#define FP(str1, strn, count) boost::format(ngettext(str1, strn, count), ui.user_locale) +#define FP(str1, strn, count) boost::format(ngettext(str1, strn, count), get_user_locale()) // L is for logging, you can log all you want #define L(fmt) global_sanity.log(fmt, __FILE__, __LINE__) ======================================================================== --- schema_migration.cc 38c6a6d8a82751cc80ff017b0a7f863d0b50eac6 +++ schema_migration.cc 282f8216d2face69303858b84939b3f01ffdd6c6 @@ -156,6 +156,7 @@ // those are auto-generated indices (for // UNIQUE constraints, etc.). "AND sql IS NOT NULL " + "AND name != 'sqlite_stat1' " "ORDER BY name", &append_sql_stmt, &tmp, NULL); if (res != SQLITE_OK) ======================================================================== --- sqlite/alter.c 03041f2464e22532601254f87cb49997fa21dcdf +++ sqlite/alter.c 26d755f2143719dd3f5b8aaf6cbe3c7f95332528 @@ -12,7 +12,7 @@ ** This file contains C code routines that used to generate VDBE code ** that implements the ALTER TABLE command. ** -** $Id: alter.c,v 1.7 2005/06/06 21:19:57 drh Exp $ +** $Id: alter.c,v 1.8 2005/08/19 19:14:13 drh Exp $ */ #include "sqliteInt.h" #include @@ -258,6 +258,7 @@ char *zWhere = 0; /* Where clause to locate temp triggers */ #endif + if( sqlite3_malloc_failed ) goto exit_rename_table; assert( pSrc->nSrc==1 ); pTab = sqlite3LocateTable(pParse, pSrc->a[0].zName, pSrc->a[0].zDatabase); @@ -500,8 +501,10 @@ int i; int nAlloc; + /* Look up the table being altered. */ - assert( !pParse->pNewTable ); + assert( pParse->pNewTable==0 ); + if( sqlite3_malloc_failed ) goto exit_begin_add_column; pTab = sqlite3LocateTable(pParse, pSrc->a[0].zName, pSrc->a[0].zDatabase); if( !pTab ) goto exit_begin_add_column; @@ -520,6 +523,7 @@ pNew = (Table *)sqliteMalloc(sizeof(Table)); if( !pNew ) goto exit_begin_add_column; pParse->pNewTable = pNew; + pNew->nRef = 1; pNew->nCol = pTab->nCol; assert( pNew->nCol>0 ); nAlloc = (((pNew->nCol-1)/8)*8)+8; ======================================================================== --- sqlite/analyze.c +++ sqlite/analyze.c 43a2d91242bdd71b6c299378f6b11e896ee5e43d @@ -0,0 +1,388 @@ +/* +** 2005 July 8 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains code associated with the ANALYZE command. +** +** @(#) $Id: analyze.c,v 1.8 2005/09/10 22:40:54 drh Exp $ +*/ +#ifndef SQLITE_OMIT_ANALYZE +#include "sqliteInt.h" + +/* +** This routine generates code that opens the sqlite_stat1 table on cursor +** iStatCur. +** +** If the sqlite_stat1 tables does not previously exist, it is created. +** If it does previously exist, all entires associated with table zWhere +** are removed. If zWhere==0 then all entries are removed. +*/ +static void openStatTable( + Parse *pParse, /* Parsing context */ + int iDb, /* The database we are looking in */ + int iStatCur, /* Open the sqlite_stat1 table on this cursor */ + const char *zWhere /* Delete entries associated with this table */ +){ + sqlite3 *db = pParse->db; + Db *pDb; + int iRootPage; + Table *pStat; + Vdbe *v = sqlite3GetVdbe(pParse); + + pDb = &db->aDb[iDb]; + if( (pStat = sqlite3FindTable(db, "sqlite_stat1", pDb->zName))==0 ){ + /* The sqlite_stat1 tables does not exist. Create it. + ** Note that a side-effect of the CREATE TABLE statement is to leave + ** the rootpage of the new table on the top of the stack. This is + ** important because the OpenWrite opcode below will be needing it. */ + sqlite3NestedParse(pParse, + "CREATE TABLE %Q.sqlite_stat1(tbl,idx,stat)", + pDb->zName + ); + iRootPage = 0; /* Cause rootpage to be taken from top of stack */ + }else if( zWhere ){ + /* The sqlite_stat1 table exists. Delete all entries associated with + ** the table zWhere. */ + sqlite3NestedParse(pParse, + "DELETE FROM %Q.sqlite_stat1 WHERE tbl=%Q", + pDb->zName, zWhere + ); + iRootPage = pStat->tnum; + }else{ + /* The sqlite_stat1 table already exists. Delete all rows. */ + iRootPage = pStat->tnum; + sqlite3VdbeAddOp(v, OP_Clear, pStat->tnum, iDb); + } + + /* Open the sqlite_stat1 table for writing. + */ + sqlite3VdbeAddOp(v, OP_Integer, iDb, 0); + sqlite3VdbeAddOp(v, OP_OpenWrite, iStatCur, iRootPage); + sqlite3VdbeAddOp(v, OP_SetNumColumns, iStatCur, 3); +} + +/* +** Generate code to do an analysis of all indices associated with +** a single table. +*/ +static void analyzeOneTable( + Parse *pParse, /* Parser context */ + Table *pTab, /* Table whose indices are to be analyzed */ + int iStatCur, /* Cursor that writes to the sqlite_stat1 table */ + int iMem /* Available memory locations begin here */ +){ + Index *pIdx; /* An index to being analyzed */ + int iIdxCur; /* Cursor number for index being analyzed */ + int nCol; /* Number of columns in the index */ + Vdbe *v; /* The virtual machine being built up */ + int i; /* Loop counter */ + int topOfLoop; /* The top of the loop */ + int endOfLoop; /* The end of the loop */ + int addr; /* The address of an instruction */ + + v = sqlite3GetVdbe(pParse); + if( pTab==0 || pTab->pIndex==0 ){ + /* Do no analysis for tables that have no indices */ + return; + } + +#ifndef SQLITE_OMIT_AUTHORIZATION + if( sqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0, + pParse->db->aDb[pTab->iDb].zName ) ){ + return; + } +#endif + + iIdxCur = pParse->nTab; + for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ + /* Open a cursor to the index to be analyzed + */ + sqlite3VdbeAddOp(v, OP_Integer, pIdx->iDb, 0); + VdbeComment((v, "# %s", pIdx->zName)); + sqlite3VdbeOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, + (char*)&pIdx->keyInfo, P3_KEYINFO); + nCol = pIdx->nColumn; + if( iMem+nCol*2>=pParse->nMem ){ + pParse->nMem = iMem+nCol*2+1; + } + sqlite3VdbeAddOp(v, OP_SetNumColumns, iIdxCur, nCol+1); + + /* Memory cells are used as follows: + ** + ** mem[iMem]: The total number of rows in the table. + ** mem[iMem+1]: Number of distinct values in column 1 + ** ... + ** mem[iMem+nCol]: Number of distinct values in column N + ** mem[iMem+nCol+1] Last observed value of column 1 + ** ... + ** mem[iMem+nCol+nCol]: Last observed value of column N + ** + ** Cells iMem through iMem+nCol are initialized to 0. The others + ** are initialized to NULL. + */ + sqlite3VdbeAddOp(v, OP_Integer, 0, 0); + for(i=0; i<=nCol; i++){ + sqlite3VdbeAddOp(v, OP_MemStore, iMem+i, i==nCol); + } + sqlite3VdbeAddOp(v, OP_Null, 0, 0); + for(i=0; i0 then it is always the case the D>0 so division by zero + ** is never possible. + */ + sqlite3VdbeAddOp(v, OP_MemLoad, iMem, 0); + addr = sqlite3VdbeAddOp(v, OP_IfNot, 0, 0); + sqlite3VdbeAddOp(v, OP_NewRowid, iStatCur, 0); + sqlite3VdbeOp3(v, OP_String8, 0, 0, pTab->zName, 0); + sqlite3VdbeOp3(v, OP_String8, 0, 0, pIdx->zName, 0); + sqlite3VdbeAddOp(v, OP_MemLoad, iMem, 0); + sqlite3VdbeOp3(v, OP_String8, 0, 0, " ", 0); + for(i=0; idb; + HashElem *k; + int iStatCur; + int iMem; + + sqlite3BeginWriteOperation(pParse, 0, iDb); + iStatCur = pParse->nTab++; + openStatTable(pParse, iDb, iStatCur, 0); + iMem = pParse->nMem; + for(k=sqliteHashFirst(&db->aDb[iDb].tblHash); k; k=sqliteHashNext(k)){ + Table *pTab = (Table*)sqliteHashData(k); + analyzeOneTable(pParse, pTab, iStatCur, iMem); + } + loadAnalysis(pParse, iDb); +} + +/* +** Generate code that will do an analysis of a single table in +** a database. +*/ +static void analyzeTable(Parse *pParse, Table *pTab){ + int iDb; + int iStatCur; + + assert( pTab!=0 ); + iDb = pTab->iDb; + sqlite3BeginWriteOperation(pParse, 0, iDb); + iStatCur = pParse->nTab++; + openStatTable(pParse, iDb, iStatCur, pTab->zName); + analyzeOneTable(pParse, pTab, iStatCur, pParse->nMem); + loadAnalysis(pParse, iDb); +} + +/* +** Generate code for the ANALYZE command. The parser calls this routine +** when it recognizes an ANALYZE command. +** +** ANALYZE -- 1 +** ANALYZE -- 2 +** ANALYZE ?.? -- 3 +** +** Form 1 causes all indices in all attached databases to be analyzed. +** Form 2 analyzes all indices the single database named. +** Form 3 analyzes all indices associated with the named table. +*/ +void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){ + sqlite3 *db = pParse->db; + int iDb; + int i; + char *z, *zDb; + Table *pTab; + Token *pTableName; + + /* Read the database schema. If an error occurs, leave an error message + ** and code in pParse and return NULL. */ + if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ + return; + } + + if( pName1==0 ){ + /* Form 1: Analyze everything */ + for(i=0; inDb; i++){ + if( i==1 ) continue; /* Do not analyze the TEMP database */ + analyzeDatabase(pParse, i); + } + }else if( pName2==0 || pName2->n==0 ){ + /* Form 2: Analyze the database or table named */ + iDb = sqlite3FindDb(db, pName1); + if( iDb>=0 ){ + analyzeDatabase(pParse, iDb); + }else{ + z = sqlite3NameFromToken(pName1); + pTab = sqlite3LocateTable(pParse, z, 0); + sqliteFree(z); + if( pTab ){ + analyzeTable(pParse, pTab); + } + } + }else{ + /* Form 3: Analyze the fully qualified table name */ + iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pTableName); + if( iDb>=0 ){ + zDb = db->aDb[iDb].zName; + z = sqlite3NameFromToken(pTableName); + pTab = sqlite3LocateTable(pParse, z, zDb); + sqliteFree(z); + if( pTab ){ + analyzeTable(pParse, pTab); + } + } + } +} + +/* +** Used to pass information from the analyzer reader through to the +** callback routine. +*/ +typedef struct analysisInfo analysisInfo; +struct analysisInfo { + sqlite3 *db; + const char *zDatabase; +}; + +/* +** This callback is invoked once for each index when reading the +** sqlite_stat1 table. +** +** argv[0] = name of the index +** argv[1] = results of analysis - on integer for each column +*/ +static int analysisLoader(void *pData, int argc, char **argv, char **azNotUsed){ + analysisInfo *pInfo = (analysisInfo*)pData; + Index *pIndex; + int i, c; + unsigned int v; + const char *z; + + assert( argc==2 ); + if( argv==0 || argv[0]==0 || argv[1]==0 ){ + return 0; + } + pIndex = sqlite3FindIndex(pInfo->db, argv[0], pInfo->zDatabase); + if( pIndex==0 ){ + return 0; + } + z = argv[1]; + for(i=0; *z && i<=pIndex->nColumn; i++){ + v = 0; + while( (c=z[0])>='0' && c<='9' ){ + v = v*10 + c - '0'; + z++; + } + pIndex->aiRowEst[i] = v; + if( *z==' ' ) z++; + } + return 0; +} + +/* +** Load the content of the sqlite_stat1 table into the index hash tables. +*/ +void sqlite3AnalysisLoad(sqlite3 *db, int iDb){ + analysisInfo sInfo; + HashElem *i; + char *zSql; + + /* Clear any prior statistics */ + for(i=sqliteHashFirst(&db->aDb[iDb].idxHash); i; i=sqliteHashNext(i)){ + Index *pIdx = sqliteHashData(i); + sqlite3DefaultRowEst(pIdx); + } + + /* Check to make sure the sqlite_stat1 table existss */ + sInfo.db = db; + sInfo.zDatabase = db->aDb[iDb].zName; + if( sqlite3FindTable(db, "sqlite_stat1", sInfo.zDatabase)==0 ){ + return; + } + + + /* Load new statistics out of the sqlite_stat1 table */ + zSql = sqlite3MPrintf("SELECT idx, stat FROM %Q.sqlite_stat1", + sInfo.zDatabase); + sqlite3SafetyOff(db); + sqlite3_exec(db, zSql, analysisLoader, &sInfo, 0); + sqlite3SafetyOn(db); + sqliteFree(zSql); +} + + +#endif /* SQLITE_OMIT_ANALYZE */ ======================================================================== --- sqlite/attach.c 3615dbe960cbee4aa5ea300b8a213dad36527b0f +++ sqlite/attach.c 4b21689700a72ae281fa85dbaff06b2a62bd49ee @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the ATTACH and DETACH commands. ** -** $Id: attach.c,v 1.33 2005/03/16 12:15:21 danielk1977 Exp $ +** $Id: attach.c,v 1.34 2005/08/20 03:03:04 drh Exp $ */ #include "sqliteInt.h" @@ -146,8 +146,8 @@ db->aDb[i].pBt = 0; } sqlite3ResetInternalSchema(db, 0); - if( 0==pParse->nErr ){ - pParse->nErr++; + assert( pParse->nErr>0 ); /* Always set by sqlite3ReadSchema() */ + if( pParse->rc==SQLITE_OK ){ pParse->rc = SQLITE_ERROR; } } ======================================================================== --- sqlite/auth.c 18c5a0befe20f3a58a41e3ddd78f372faeeefe1f +++ sqlite/auth.c 31e2304bef67f44d635655f44234387ea7d21454 @@ -14,7 +14,7 @@ ** systems that do not need this facility may omit it by recompiling ** the library with -DSQLITE_OMIT_AUTHORIZATION=1 ** -** $Id: auth.c,v 1.21 2005/01/29 08:32:44 danielk1977 Exp $ +** $Id: auth.c,v 1.22 2005/07/29 15:36:15 drh Exp $ */ #include "sqliteInt.h" @@ -114,6 +114,7 @@ TriggerStack *pStack; /* The stack of current triggers */ if( db->xAuth==0 ) return; + if( pExpr->op==TK_AS ) return; assert( pExpr->op==TK_COLUMN ); for(iSrc=0; pTabList && iSrcnSrc; iSrc++){ if( pExpr->iTable==pTabList->a[iSrc].iCursor ) break; ======================================================================== --- sqlite/btree.c d2e09ebf755bfd665727133361b22c6a915b12d7 +++ sqlite/btree.c 236126155d5607da945d33514218cbec762d887e @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.261 2005/05/24 20:19:58 drh Exp $ +** $Id: btree.c,v 1.269 2005/09/17 15:20:27 drh Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** For a detailed discussion of BTrees, refer to @@ -234,8 +234,19 @@ /* ** This is a magic string that appears at the beginning of every ** SQLite database in order to identify the file as a real database. -** 123456789 123456 */ -static const char zMagicHeader[] = "SQLite format 3"; +** +** You can change this value at compile-time by specifying a +** -DSQLITE_FILE_HEADER="..." on the compiler command-line. The +** header must be exactly 16 bytes including the zero-terminator so +** the string itself should be 15 characters long. If you change +** the header, then your custom library will not be able to read +** databases generated by the standard tools and the standard tools +** will not be able to read databases created by your custom library. +*/ +#ifndef SQLITE_FILE_HEADER /* 123456789 123456 */ +# define SQLITE_FILE_HEADER "SQLite format 3" +#endif +static const char zMagicHeader[] = SQLITE_FILE_HEADER; /* ** Page type flags. An ORed combination of these flags appear as the @@ -483,7 +494,7 @@ assert( pBt->autoVacuum ); if( key==0 ){ - return SQLITE_CORRUPT; + return SQLITE_CORRUPT_BKPT; } iPtrmap = PTRMAP_PAGENO(pBt->usableSize, key); rc = sqlite3pager_get(pBt->pPager, iPtrmap, (void **)&pPtrmap); @@ -529,7 +540,7 @@ if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]); sqlite3pager_unref(pPtrmap); - if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT; + if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_BKPT; return SQLITE_OK; } @@ -1019,7 +1030,7 @@ assert( pPage->aData == &((unsigned char*)pPage)[-pBt->pageSize] ); if( pPage->pParent!=pParent && (pPage->pParent!=0 || pPage->isInit) ){ /* The parent page should never change unless the file is corrupt */ - return SQLITE_CORRUPT; /* bkpt-CORRUPT */ + return SQLITE_CORRUPT_BKPT; } if( pPage->isInit ) return SQLITE_OK; if( pPage->pParent==0 && pParent!=0 ){ @@ -1037,11 +1048,11 @@ pPage->nCell = get2byte(&data[hdr+3]); if( pPage->nCell>MX_CELL(pBt) ){ /* To many cells for a single page. The page must be corrupt */ - return SQLITE_CORRUPT; /* bkpt-CORRUPT */ + return SQLITE_CORRUPT_BKPT; } if( pPage->nCell==0 && pParent!=0 && pParent->pgno!=1 ){ /* All pages must have at least one cell, except for root pages */ - return SQLITE_CORRUPT; /* bkpt-CORRUPT */ + return SQLITE_CORRUPT_BKPT; } /* Compute the total free space on the page */ @@ -1051,13 +1062,13 @@ int next, size; if( pc>usableSize-4 ){ /* Free block is off the page */ - return SQLITE_CORRUPT; /* bkpt-CORRUPT */ + return SQLITE_CORRUPT_BKPT; } next = get2byte(&data[pc]); size = get2byte(&data[pc+2]); if( next>0 && next<=pc+size+3 ){ /* Free blocks must be in accending order */ - return SQLITE_CORRUPT; /* bkpt-CORRUPT */ + return SQLITE_CORRUPT_BKPT; } nFree += size; pc = next; @@ -1065,7 +1076,7 @@ pPage->nFree = nFree; if( nFree>=usableSize ){ /* Free space cannot exceed total page size */ - return SQLITE_CORRUPT; /* bkpt-CORRUPT */ + return SQLITE_CORRUPT_BKPT; } pPage->isInit = 1; @@ -1135,7 +1146,7 @@ ){ int rc; if( pgno==0 ){ - return SQLITE_CORRUPT; /* bkpt-CORRUPT */ + return SQLITE_CORRUPT_BKPT; } rc = getPage(pBt, pgno, ppPage); if( rc==SQLITE_OK && (*ppPage)->isInit==0 ){ @@ -1334,6 +1345,15 @@ } #endif +/* +** Return TRUE if the given btree is set to safety level 1. In other +** words, return TRUE if no sync() occurs on the disk files. +*/ +int sqlite3BtreeSyncDisabled(Btree *pBt){ + assert( pBt && pBt->pPager ); + return sqlite3pager_nosync(pBt->pPager); +} + #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) || !defined(SQLITE_OMIT_VACUUM) /* ** Change the default pages size and the number of reserved bytes per page. @@ -1595,8 +1615,6 @@ */ int sqlite3BtreeBeginTrans(Btree *pBt, int wrflag){ int rc = SQLITE_OK; - int busy = 0; - BusyHandler *pH; /* If the btree is already in a write-transaction, or it ** is already in a read-transaction and a read-transaction @@ -1630,9 +1648,7 @@ unlockBtreeIfUnused(pBt); } }while( rc==SQLITE_BUSY && pBt->inTrans==TRANS_NONE && - (pH = pBt->pBusyHandler)!=0 && - pH->xFunc && pH->xFunc(pH->pArg, busy++) - ); + sqlite3InvokeBusyHandler(pBt->pBusyHandler) ); return rc; } @@ -1698,7 +1714,7 @@ if( eType==PTRMAP_OVERFLOW2 ){ /* The pointer is always the first 4 bytes of the page in this case. */ if( get4byte(pPage->aData)!=iFrom ){ - return SQLITE_CORRUPT; + return SQLITE_CORRUPT_BKPT; } put4byte(pPage->aData, iTo); }else{ @@ -1731,7 +1747,7 @@ if( i==nCell ){ if( eType!=PTRMAP_BTREE || get4byte(&pPage->aData[pPage->hdrOffset+8])!=iFrom ){ - return SQLITE_CORRUPT; + return SQLITE_CORRUPT_BKPT; } put4byte(&pPage->aData[pPage->hdrOffset+8], iTo); } @@ -1844,7 +1860,7 @@ assert( pBt->autoVacuum ); if( PTRMAP_ISPAGE(pgsz, sqlite3pager_pagecount(pPager)) ){ - return SQLITE_CORRUPT; + return SQLITE_CORRUPT_BKPT; } /* Figure out how many free-pages are in the database. If there are no @@ -1859,7 +1875,7 @@ origSize = sqlite3pager_pagecount(pPager); nPtrMap = (nFreeList-origSize+PTRMAP_PAGENO(pgsz, origSize)+pgsz/5)/(pgsz/5); finSize = origSize - nFreeList - nPtrMap; - if( origSize>PENDING_BYTE_PAGE(pBt) && finSize<=PENDING_BYTE_PAGE(pBt) ){ + if( origSize>=PENDING_BYTE_PAGE(pBt) && finSize<=PENDING_BYTE_PAGE(pBt) ){ finSize--; if( PTRMAP_ISPAGE(pBt->usableSize, finSize) ){ finSize--; @@ -1882,7 +1898,7 @@ rc = ptrmapGet(pBt, iDbPage, &eType, &iPtrPage); if( rc!=SQLITE_OK ) goto autovacuum_out; if( eType==PTRMAP_ROOTPAGE ){ - rc = SQLITE_CORRUPT; + rc = SQLITE_CORRUPT_BKPT; goto autovacuum_out; } @@ -2398,7 +2414,7 @@ } if( amt>0 ){ - return SQLITE_CORRUPT; /* bkpt-CORRUPT */ + return SQLITE_CORRUPT_BKPT; } return SQLITE_OK; } @@ -2416,7 +2432,7 @@ assert( pCur->isValid ); assert( pCur->pPage!=0 ); if( pCur->pPage->intKey ){ - return SQLITE_CORRUPT; + return SQLITE_CORRUPT_BKPT; } assert( pCur->pPage->intKey==0 ); assert( pCur->idx>=0 && pCur->idxpPage->nCell ); @@ -2465,13 +2481,11 @@ ){ unsigned char *aPayload; MemPage *pPage; - Btree *pBt; u32 nKey; int nLocal; assert( pCur!=0 && pCur->pPage!=0 ); assert( pCur->isValid ); - pBt = pCur->pBt; pPage = pCur->pPage; pageIntegrity(pPage); assert( pCur->idx>=0 && pCur->idxnCell ); @@ -2538,7 +2552,7 @@ pCur->idx = 0; pCur->info.nSize = 0; if( pNewPage->nCell<1 ){ - return SQLITE_CORRUPT; /* bkpt-CORRUPT */ + return SQLITE_CORRUPT_BKPT; } return SQLITE_OK; } @@ -2569,7 +2583,6 @@ ** the largest cell index. */ static void moveToParent(BtCursor *pCur){ - Pgno oldPgno; MemPage *pParent; MemPage *pPage; int idxParent; @@ -2584,7 +2597,6 @@ pageIntegrity(pParent); idxParent = pPage->idxParent; sqlite3pager_ref(pParent->aData); - oldPgno = pPage->pgno; releasePage(pPage); pCur->pPage = pParent; pCur->info.nSize = 0; @@ -2749,7 +2761,7 @@ lwr = 0; upr = pPage->nCell-1; if( !pPage->intKey && pKey==0 ){ - return SQLITE_CORRUPT; + return SQLITE_CORRUPT_BKPT; } pageIntegrity(pPage); while( lwr<=upr ){ @@ -3034,7 +3046,7 @@ TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1)); }else if( k>pBt->usableSize/4 - 8 ){ /* Value of k is out of range. Database corruption */ - return SQLITE_CORRUPT; /* bkpt-CORRUPT */ + return SQLITE_CORRUPT_BKPT; #ifndef SQLITE_OMIT_AUTOVACUUM }else if( searchList && nearby==iTrunk ){ /* The list is being searched and this trunk page is the page @@ -3109,7 +3121,7 @@ *pPgno = iPage; if( *pPgno>sqlite3pager_pagecount(pBt->pPager) ){ /* Free page off the end of the file */ - return SQLITE_CORRUPT; /* bkpt-CORRUPT */ + return SQLITE_CORRUPT_BKPT; } TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d" ": %d more free pages\n", @@ -3250,7 +3262,7 @@ while( ovflPgno!=0 ){ MemPage *pOvfl; if( ovflPgno>sqlite3pager_pagecount(pBt->pPager) ){ - return SQLITE_CORRUPT; + return SQLITE_CORRUPT_BKPT; } rc = getPage(pBt, ovflPgno, &pOvfl); if( rc ) return rc; @@ -3595,17 +3607,19 @@ data = pPage->aData; hdr = pPage->hdrOffset; put2byte(&data[hdr+3], nCell); - cellbody = allocateSpace(pPage, totalSize); - assert( cellbody>0 ); - assert( pPage->nFree >= 2*nCell ); - pPage->nFree -= 2*nCell; - for(i=0; i0 ); + assert( pPage->nFree >= 2*nCell ); + pPage->nFree -= 2*nCell; + for(i=0; ipBt->usableSize ); } - assert( cellbody==pPage->pBt->usableSize ); pPage->nCell = nCell; } @@ -3809,7 +3823,7 @@ /* ** A special case: If a new entry has just been inserted into a ** table (that is, a btree with integer keys and all data at the leaves) - ** an the new entry is the right-most entry in the tree (it has the + ** and the new entry is the right-most entry in the tree (it has the ** largest key) then use the special balance_quick() routine for ** balancing. balance_quick() is much faster and results in a tighter ** packing of data in the common case. @@ -4082,8 +4096,13 @@ szNew[i] = szRight; szNew[i-1] = szLeft; } - assert( cntNew[0]>0 ); + /* Either we found one or more cells (cntnew[0])>0) or we are the + ** a virtual root page. A virtual root page is when the real root + ** page is page 1 and we are the only child of that page. + */ + assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) ); + /* ** Allocate k new pages. Reuse old pages where possible. */ @@ -4171,7 +4190,7 @@ assert( jpgno==pgnoNew[i] ); assemblePage(pNew, cntNew[i]-j, &apCell[j], &szCell[j]); - assert( pNew->nCell>0 ); + assert( pNew->nCell>0 || (nNew==1 && cntNew[0]==0) ); assert( pNew->nOverflow==0 ); #ifndef SQLITE_OMIT_AUTOVACUUM @@ -4649,7 +4668,7 @@ rc = sqlite3BtreeNext(&leafCur, ¬Used); if( rc!=SQLITE_OK ){ if( rc!=SQLITE_NOMEM ){ - rc = SQLITE_CORRUPT; /* bkpt-CORRUPT */ + rc = SQLITE_CORRUPT_BKPT; } } if( rc==SQLITE_OK ){ @@ -4835,7 +4854,7 @@ int i; if( pgno>sqlite3pager_pagecount(pBt->pPager) ){ - return SQLITE_CORRUPT; + return SQLITE_CORRUPT_BKPT; } rc = getAndInitPage(pBt, pgno, &pPage, pParent); @@ -5457,7 +5476,7 @@ u8 *data; BtCursor cur; Btree *pBt; - int maxLocal, usableSize; + int usableSize; char zContext[100]; char *hit; @@ -5474,7 +5493,6 @@ "unable to get the page. error code=%d", rc); return 0; } - maxLocal = pPage->leafData ? pBt->maxLeaf : pBt->maxLocal; if( (rc = initPage(pPage, pParent))!=0 ){ checkAppendMsg(pCheck, zContext, "initPage() returns error code %d", rc); releasePage(pPage); @@ -5721,7 +5739,7 @@ */ int sqlite3BtreeCopyFile(Btree *pBtTo, Btree *pBtFrom){ int rc = SQLITE_OK; - Pgno i, nPage, nToPage; + Pgno i, nPage, nToPage, iSkip; if( pBtTo->inTrans!=TRANS_WRITE || pBtFrom->inTrans!=TRANS_WRITE ){ return SQLITE_ERROR; @@ -5729,8 +5747,10 @@ if( pBtTo->pCursor ) return SQLITE_BUSY; nToPage = sqlite3pager_pagecount(pBtTo->pPager); nPage = sqlite3pager_pagecount(pBtFrom->pPager); + iSkip = PENDING_BYTE_PAGE(pBtTo); for(i=1; rc==SQLITE_OK && i<=nPage; i++){ void *pPage; + if( i==iSkip ) continue; rc = sqlite3pager_get(pBtFrom->pPager, i, &pPage); if( rc ) break; rc = sqlite3pager_overwrite(pBtTo->pPager, i, pPage); @@ -5739,6 +5759,7 @@ } for(i=nPage+1; rc==SQLITE_OK && i<=nToPage; i++){ void *pPage; + if( i==iSkip ) continue; rc = sqlite3pager_get(pBtTo->pPager, i, &pPage); if( rc ) break; rc = sqlite3pager_write(pPage); ======================================================================== --- sqlite/btree.h 41a71ce027db9ddee72cb43df2316bbe3a1d92af +++ sqlite/btree.h 1ed561263ca0e335bc3e81d761c9d5ff8c22f61e @@ -13,7 +13,7 @@ ** subsystem. See comments in the source code for a detailed description ** of what each interface routine does. ** -** @(#) $Id: btree.h,v 1.63 2005/03/21 04:04:03 danielk1977 Exp $ +** @(#) $Id: btree.h,v 1.64 2005/08/27 16:36:49 drh Exp $ */ #ifndef _BTREE_H_ #define _BTREE_H_ @@ -58,6 +58,7 @@ int sqlite3BtreeSetBusyHandler(Btree*,BusyHandler*); int sqlite3BtreeSetCacheSize(Btree*,int); int sqlite3BtreeSetSafetyLevel(Btree*,int); +int sqlite3BtreeSyncDisabled(Btree*); int sqlite3BtreeSetPageSize(Btree*,int,int); int sqlite3BtreeGetPageSize(Btree*); int sqlite3BtreeGetReserve(Btree*); ======================================================================== --- sqlite/build.c 593d8fda0576a72e6f1fbf8f1a61db110dde9264 +++ sqlite/build.c 74653e045581bfbadb8b35a0cb38a62f4a2c850e @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.326 2005/06/12 21:35:52 drh Exp $ +** $Id: build.c,v 1.350 2005/09/16 02:48:02 drh Exp $ */ #include "sqliteInt.h" #include @@ -85,6 +85,7 @@ sqlite3VdbeAddOp(v, OP_Goto, 0, pParse->cookieGoto); } +#ifndef SQLITE_OMIT_TRACE /* Add a No-op that contains the complete text of the compiled SQL ** statement as its P3 argument. This does not change the functionality ** of the program. @@ -92,6 +93,7 @@ ** This is used to implement sqlite3_trace(). */ sqlite3VdbeOp3(v, OP_Noop, 0, 0, pParse->zSql, pParse->zTail-pParse->zSql); +#endif /* SQLITE_OMIT_TRACE */ } @@ -101,7 +103,7 @@ FILE *trace = (db->flags & SQLITE_VdbeTrace)!=0 ? stdout : 0; sqlite3VdbeTrace(v, trace); sqlite3VdbeMakeReady(v, pParse->nVar, pParse->nMem+3, - pParse->nTab+3, pParse->nMaxDepth+1, pParse->explain); + pParse->nTab+3, pParse->explain); pParse->rc = SQLITE_DONE; pParse->colNamesSet = 0; }else if( pParse->rc==SQLITE_OK ){ @@ -130,7 +132,6 @@ void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){ va_list ap; char *zSql; - int rc; # define SAVE_SZ (sizeof(Parse) - offsetof(Parse,nVar)) char saveBuf[SAVE_SZ]; @@ -145,7 +146,7 @@ pParse->nested++; memcpy(saveBuf, &pParse->nVar, SAVE_SZ); memset(&pParse->nVar, 0, SAVE_SZ); - rc = sqlite3RunParser(pParse, zSql, 0); + sqlite3RunParser(pParse, zSql, 0); sqliteFree(zSql); memcpy(&pParse->nVar, saveBuf, SAVE_SZ); pParse->nested--; @@ -200,9 +201,6 @@ if( p==0 ){ if( zDbase ){ sqlite3ErrorMsg(pParse, "no such table: %s.%s", zDbase, zName); - }else if( sqlite3FindTable(pParse->db, zName, 0)!=0 ){ - sqlite3ErrorMsg(pParse, "table \"%s\" is not in database \"%s\"", - zName, zDbase); }else{ sqlite3ErrorMsg(pParse, "no such table: %s", zName); } @@ -258,10 +256,7 @@ assert( db!=0 && p->zName!=0 ); pOld = sqlite3HashInsert(&db->aDb[p->iDb].idxHash, p->zName, strlen(p->zName)+1, 0); - if( pOld!=0 && pOld!=p ){ - sqlite3HashInsert(&db->aDb[p->iDb].idxHash, pOld->zName, - strlen(pOld->zName)+1, pOld); - } + assert( pOld==0 || pOld==p ); freeIndex(p); } @@ -535,7 +530,7 @@ ** index of the named database in db->aDb[], or -1 if the named db ** does not exist. */ -static int findDb(sqlite3 *db, Token *pName){ +int sqlite3FindDb(sqlite3 *db, Token *pName){ int i = -1; /* Database number */ int n; /* Number of characters in the name */ Db *pDb; /* A database whose name space is being searched */ @@ -583,7 +578,7 @@ if( pName2 && pName2->n>0 ){ assert( !db->init.busy ); *pUnqual = pName2; - iDb = findDb(db, pName1); + iDb = sqlite3FindDb(db, pName1); if( iDb<0 ){ sqlite3ErrorMsg(pParse, "unknown database %T", pName1); pParse->nErr++; @@ -640,7 +635,6 @@ int isView /* True if this is a VIEW */ ){ Table *pTable; - Index *pIdx; char *zName = 0; /* The name of the new table */ sqlite3 *db = pParse->db; Vdbe *v; @@ -719,8 +713,7 @@ sqlite3ErrorMsg(pParse, "table %T already exists", pName); goto begin_table_error; } - if( (pIdx = sqlite3FindIndex(db, zName, 0))!=0 && - ( iDb==0 || !db->init.busy) ){ + if( sqlite3FindIndex(db, zName, 0)!=0 && (iDb==0 || !db->init.busy) ){ sqlite3ErrorMsg(pParse, "there is already an index named %s", zName); goto begin_table_error; } @@ -745,7 +738,7 @@ ** so that INSERT can find the table easily. */ #ifndef SQLITE_OMIT_AUTOINCREMENT - if( strcmp(zName, "sqlite_sequence")==0 ){ + if( !pParse->nested && strcmp(zName, "sqlite_sequence")==0 ){ db->aDb[iDb].pSeqTab = pTable; } #endif @@ -902,11 +895,11 @@ ** If none of the substrings in the above table are found, ** SQLITE_AFF_NUMERIC is returned. */ -static char sqlite3AffinityType(const char *zType, int nType){ +char sqlite3AffinityType(const Token *pType){ u32 h = 0; char aff = SQLITE_AFF_NUMERIC; - const unsigned char *zIn = zType; - const unsigned char *zEnd = (zIn+nType); + const unsigned char *zIn = pType->z; + const unsigned char *zEnd = &pType->z[pType->n]; while( zIn!=zEnd ){ h = (h<<8) + sqlite3UpperToLower[*zIn]; @@ -938,30 +931,18 @@ ** that contains the typename of the column and store that string ** in zType. */ -void sqlite3AddColumnType(Parse *pParse, Token *pFirst, Token *pLast){ +void sqlite3AddColumnType(Parse *pParse, Token *pType){ Table *p; - int i, j; - int n; - char *z; - const unsigned char *zIn; - + int i; Column *pCol; + if( (p = pParse->pNewTable)==0 ) return; i = p->nCol-1; if( i<0 ) return; pCol = &p->aCol[i]; - zIn = pFirst->z; - n = pLast->n + (pLast->z - zIn); - assert( pCol->zType==0 ); - z = pCol->zType = sqliteMallocRaw(n+1); - if( z==0 ) return; - for(i=j=0; iaffinity = sqlite3AffinityType(z, n); + sqliteFree(pCol->zType); + pCol->zType = sqlite3NameFromToken(pType); + pCol->affinity = sqlite3AffinityType(pType); } /* @@ -977,14 +958,15 @@ void sqlite3AddDefaultValue(Parse *pParse, Expr *pExpr){ Table *p; Column *pCol; - if( (p = pParse->pNewTable)==0 ) return; - pCol = &(p->aCol[p->nCol-1]); - if( !sqlite3ExprIsConstant(pExpr) ){ - sqlite3ErrorMsg(pParse, "default value of column [%s] is not constant", - pCol->zName); - }else{ - sqlite3ExprDelete(pCol->pDflt); - pCol->pDflt = sqlite3ExprDup(pExpr); + if( (p = pParse->pNewTable)!=0 ){ + pCol = &(p->aCol[p->nCol-1]); + if( !sqlite3ExprIsConstantOrFunction(pExpr) ){ + sqlite3ErrorMsg(pParse, "default value of column [%s] is not constant", + pCol->zName); + }else{ + sqlite3ExprDelete(pCol->pDflt); + pCol->pDflt = sqlite3ExprDup(pExpr); + } } sqlite3ExprDelete(pExpr); } @@ -1033,7 +1015,9 @@ break; } } - if( iColnCol ) pTab->aCol[iCol].isPrimKey = 1; + if( iColnCol ){ + pTab->aCol[iCol].isPrimKey = 1; + } } if( pList->nExpr>1 ) iCol = -1; } @@ -1317,13 +1301,11 @@ */ if( p->pSelect==0 ){ /* A regular table */ - /* sqlite3VdbeAddOp(v, OP_CreateTable, p->iDb, 0); */ zType = "table"; zType2 = "TABLE"; #ifndef SQLITE_OMIT_VIEW }else{ /* A view */ - /* sqlite3VdbeAddOp(v, OP_Integer, 0, 0); */ zType = "view"; zType2 = "VIEW"; #endif @@ -1535,10 +1517,13 @@ ** Actually, this error is caught previously and so the following test ** should always fail. But we will leave it in place just to be safe. */ +#if 0 if( pTable->nCol<0 ){ sqlite3ErrorMsg(pParse, "view %s is circularly defined", pTable->zName); return 1; } +#endif + assert( pTable->nCol>=0 ); /* If we get this far, it means we need to compute the table names. ** Note that the call to sqlite3ResultSetOfSelect() will expand any @@ -1973,7 +1958,6 @@ int addr1; /* Address of top of loop */ int tnum; /* Root page of index */ Vdbe *v; /* Generate code into this virtual machine */ - int isUnique; /* True for a unique index */ #ifndef SQLITE_OMIT_AUTHORIZATION if( sqlite3AuthCheck(pParse, SQLITE_REINDEX, pIndex->zName, 0, @@ -2002,16 +1986,21 @@ sqlite3VdbeAddOp(v, OP_Integer, pIndex->iDb, 0); sqlite3VdbeOp3(v, OP_OpenWrite, iIdx, tnum, (char*)&pIndex->keyInfo, P3_KEYINFO); - sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0); - sqlite3VdbeAddOp(v, OP_OpenRead, iTab, pTab->tnum); - sqlite3VdbeAddOp(v, OP_SetNumColumns, iTab, pTab->nCol); + sqlite3OpenTableForReading(v, iTab, pTab); addr1 = sqlite3VdbeAddOp(v, OP_Rewind, iTab, 0); sqlite3GenerateIndexKey(v, pIndex, iTab); - isUnique = pIndex->onError!=OE_None; - sqlite3VdbeAddOp(v, OP_IdxInsert, iIdx, isUnique); - if( isUnique ){ - sqlite3VdbeChangeP3(v, -1, "indexed columns are not unique", P3_STATIC); + if( pIndex->onError!=OE_None ){ + int curaddr = sqlite3VdbeCurrentAddr(v); + int addr2 = curaddr+4; + sqlite3VdbeChangeP2(v, curaddr-1, addr2); + sqlite3VdbeAddOp(v, OP_Rowid, iTab, 0); + sqlite3VdbeAddOp(v, OP_AddImm, 1, 0); + sqlite3VdbeAddOp(v, OP_IsUnique, iIdx, addr2); + sqlite3VdbeOp3(v, OP_Halt, SQLITE_CONSTRAINT, OE_Abort, + "indexed columns are not unique", P3_STATIC); + assert( addr2==sqlite3VdbeCurrentAddr(v) ); } + sqlite3VdbeAddOp(v, OP_IdxInsert, iIdx, 0); sqlite3VdbeAddOp(v, OP_Next, iTab, addr1+1); sqlite3VdbeChangeP2(v, addr1, sqlite3VdbeCurrentAddr(v)); sqlite3VdbeAddOp(v, OP_Close, iTab, 0); @@ -2079,7 +2068,9 @@ if( sqlite3FixInit(&sFix, pParse, iDb, "index", pName) && sqlite3FixSrcList(&sFix, pTblName) ){ - goto exit_create_index; + /* Because the parser constructs pTblName from a single identifier, + ** sqlite3FixSrcList can never fail. */ + assert(0); } pTab = sqlite3LocateTable(pParse, pTblName->a[0].zName, pTblName->a[0].zDatabase); @@ -2124,14 +2115,12 @@ goto exit_create_index; } if( !db->init.busy ){ - Index *pISameName; /* Another index with the same name */ - Table *pTSameName; /* A table with same name as the index */ if( SQLITE_OK!=sqlite3ReadSchema(pParse) ) goto exit_create_index; - if( (pISameName = sqlite3FindIndex(db, zName, db->aDb[iDb].zName))!=0 ){ + if( sqlite3FindIndex(db, zName, db->aDb[iDb].zName)!=0 ){ sqlite3ErrorMsg(pParse, "index %s already exists", zName); goto exit_create_index; } - if( (pTSameName = sqlite3FindTable(db, zName, 0))!=0 ){ + if( sqlite3FindTable(db, zName, 0)!=0 ){ sqlite3ErrorMsg(pParse, "there is already a table named %s", zName); goto exit_create_index; } @@ -2177,11 +2166,12 @@ /* ** Allocate the index structure. */ - pIndex = sqliteMalloc( sizeof(Index) + strlen(zName) + 1 + - (sizeof(int) + sizeof(CollSeq*))*pList->nExpr ); + pIndex = sqliteMalloc( sizeof(Index) + strlen(zName) + 1 + sizeof(int) + + (sizeof(int)*2 + sizeof(CollSeq*))*pList->nExpr ); if( sqlite3_malloc_failed ) goto exit_create_index; pIndex->aiColumn = (int*)&pIndex->keyInfo.aColl[pList->nExpr]; - pIndex->zName = (char*)&pIndex->aiColumn[pList->nExpr]; + pIndex->aiRowEst = (unsigned*)&pIndex->aiColumn[pList->nExpr]; + pIndex->zName = (char*)&pIndex->aiRowEst[pList->nExpr+1]; strcpy(pIndex->zName, zName); pIndex->pTable = pTab; pIndex->nColumn = pList->nExpr; @@ -2217,6 +2207,7 @@ } } pIndex->keyInfo.nField = pList->nExpr; + sqlite3DefaultRowEst(pIndex); if( pTab==pParse->pNewTable ){ /* This routine has been called to create an automatic index as a @@ -2384,6 +2375,37 @@ } /* +** Fill the Index.aiRowEst[] array with default information - information +** to be used when we have not run the ANALYZE command. +** +** aiRowEst[0] is suppose to contain the number of elements in the index. +** Since we do not know, guess 1 million. aiRowEst[1] is an estimate of the +** number of rows in the table that match any particular value of the +** first column of the index. aiRowEst[2] is an estimate of the number +** of rows that match any particular combiniation of the first 2 columns +** of the index. And so forth. It must always be the case that +* +** aiRowEst[N]<=aiRowEst[N-1] +** aiRowEst[N]>=1 +** +** Apart from that, we have little to go on besides intuition as to +** how aiRowEst[] should be initialized. The numbers generated here +** are based on typical values found in actual indices. +*/ +void sqlite3DefaultRowEst(Index *pIdx){ + unsigned *a = pIdx->aiRowEst; + int i; + assert( a!=0 ); + a[0] = 1000000; + for(i=pIdx->nColumn; i>=1; i--){ + a[i] = 10; + } + if( pIdx->onError!=OE_None ){ + a[pIdx->nColumn] = 1; + } +} + +/* ** This routine will drop an existing named index. This routine ** implements the DROP INDEX statement. */ @@ -2445,34 +2467,95 @@ } /* +** ppArray points into a structure where there is an array pointer +** followed by two integers. The first integer is the +** number of elements in the structure array. The second integer +** is the number of allocated slots in the array. +** +** In other words, the structure looks something like this: +** +** struct Example1 { +** struct subElem *aEntry; +** int nEntry; +** int nAlloc; +** } +** +** The pnEntry parameter points to the equivalent of Example1.nEntry. +** +** This routine allocates a new slot in the array, zeros it out, +** and returns its index. If malloc fails a negative number is returned. +** +** szEntry is the sizeof of a single array entry. initSize is the +** number of array entries allocated on the initial allocation. +*/ +int sqlite3ArrayAllocate(void **ppArray, int szEntry, int initSize){ + char *p; + int *an = (int*)&ppArray[1]; + if( an[0]>=an[1] ){ + void *pNew; + int newSize; + newSize = an[1]*2 + initSize; + pNew = sqliteRealloc(*ppArray, newSize*szEntry); + if( pNew==0 ){ + return -1; + } + an[1] = newSize; + *ppArray = pNew; + } + p = *ppArray; + memset(&p[an[0]*szEntry], 0, szEntry); + return an[0]++; +} + +/* ** Append a new element to the given IdList. Create a new IdList if ** need be. ** ** A new IdList is returned, or NULL if malloc() fails. */ IdList *sqlite3IdListAppend(IdList *pList, Token *pToken){ + int i; if( pList==0 ){ pList = sqliteMalloc( sizeof(IdList) ); if( pList==0 ) return 0; pList->nAlloc = 0; } - if( pList->nId>=pList->nAlloc ){ - struct IdList_item *a; - pList->nAlloc = pList->nAlloc*2 + 5; - a = sqliteRealloc(pList->a, pList->nAlloc*sizeof(pList->a[0]) ); - if( a==0 ){ - sqlite3IdListDelete(pList); - return 0; - } - pList->a = a; + i = sqlite3ArrayAllocate((void**)&pList->a, sizeof(pList->a[0]), 5); + if( i<0 ){ + sqlite3IdListDelete(pList); + return 0; } - memset(&pList->a[pList->nId], 0, sizeof(pList->a[0])); - pList->a[pList->nId].zName = sqlite3NameFromToken(pToken); - pList->nId++; + pList->a[i].zName = sqlite3NameFromToken(pToken); return pList; } /* +** Delete an IdList. +*/ +void sqlite3IdListDelete(IdList *pList){ + int i; + if( pList==0 ) return; + for(i=0; inId; i++){ + sqliteFree(pList->a[i].zName); + } + sqliteFree(pList->a); + sqliteFree(pList); +} + +/* +** Return the index in pList of the identifier named zId. Return -1 +** if not found. +*/ +int sqlite3IdListIndex(IdList *pList, const char *zName){ + int i; + if( pList==0 ) return -1; + for(i=0; inId; i++){ + if( sqlite3StrICmp(pList->a[i].zName, zName)==0 ) return i; + } + return -1; +} + +/* ** Append a new table name to the given SrcList. Create a new SrcList if ** need be. A new entry is created in the SrcList even if pToken is NULL. ** @@ -2557,32 +2640,6 @@ } /* -** Delete an IdList. -*/ -void sqlite3IdListDelete(IdList *pList){ - int i; - if( pList==0 ) return; - for(i=0; inId; i++){ - sqliteFree(pList->a[i].zName); - } - sqliteFree(pList->a); - sqliteFree(pList); -} - -/* -** Return the index in pList of the identifier named zId. Return -1 -** if not found. -*/ -int sqlite3IdListIndex(IdList *pList, const char *zName){ - int i; - if( pList==0 ) return -1; - for(i=0; inId; i++){ - if( sqlite3StrICmp(pList->a[i].zName, zName)==0 ) return i; - } - return -1; -} - -/* ** Delete an entire SrcList including all its substructure. */ void sqlite3SrcListDelete(SrcList *pList){ @@ -2784,7 +2841,7 @@ ** If pColl==0 then recompute all indices of pTab. */ #ifndef SQLITE_OMIT_REINDEX -void reindexTable(Parse *pParse, Table *pTab, CollSeq *pColl){ +static void reindexTable(Parse *pParse, Table *pTab, CollSeq *pColl){ Index *pIndex; /* An index associated with pTab */ for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){ @@ -2802,7 +2859,7 @@ ** all indices everywhere. */ #ifndef SQLITE_OMIT_REINDEX -void reindexDatabases(Parse *pParse, CollSeq *pColl){ +static void reindexDatabases(Parse *pParse, CollSeq *pColl){ Db *pDb; /* A single database */ int iDb; /* The database index number */ sqlite3 *db = pParse->db; /* The database connection */ @@ -2811,7 +2868,7 @@ for(iDb=0, pDb=db->aDb; iDbnDb; iDb++, pDb++){ if( pDb==0 ) continue; - for(k=sqliteHashFirst(&pDb->tblHash); k; k=sqliteHashNext(k)){ + for(k=sqliteHashFirst(&pDb->tblHash); k; k=sqliteHashNext(k)){ pTab = (Table*)sqliteHashData(k); reindexTable(pParse, pTab, pColl); } ======================================================================== --- sqlite/callback.c 0910b611e0c158f107ee3ff86f8a371654971e2b +++ sqlite/callback.c 9a1162c8f9dae9fad6d548339669aacb5f6cf76b @@ -13,7 +13,7 @@ ** This file contains functions used to access the internal hash tables ** of user defined functions and collation sequences. ** -** $Id: callback.c,v 1.2 2005/05/25 10:45:10 danielk1977 Exp $ +** $Id: callback.c,v 1.3 2005/08/14 01:20:38 drh Exp $ */ #include "sqliteInt.h" @@ -147,7 +147,7 @@ ** the collation sequence name. A pointer to this string is stored in ** each collation sequence structure. */ -static CollSeq * findCollSeqEntry( +static CollSeq *findCollSeqEntry( sqlite3 *db, const char *zName, int nName, @@ -286,10 +286,9 @@ ** new entry to the hash table and return it. */ if( createFlag && bestmatch<6 && - (pBest = sqliteMalloc(sizeof(*pBest)+nName+1)) ){ + (pBest = sqliteMalloc(sizeof(*pBest)+nName)) ){ pBest->nArg = nArg; pBest->pNext = pFirst; - pBest->zName = (char*)&pBest[1]; pBest->iPrefEnc = enc; memcpy(pBest->zName, zName, nName); pBest->zName[nName] = 0; ======================================================================== --- sqlite/complete.c +++ sqlite/complete.c 641713ef01657f74037840abb9c0a4552c07b0d0 @@ -0,0 +1,272 @@ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** An tokenizer for SQL +** +** This file contains C code that implements the sqlite3_complete() API. +** This code used to be part of the tokenizer.c source file. But by +** separating it out, the code will be automatically omitted from +** static links that do not use it. +** +** $Id: complete.c,v 1.1 2005/08/14 17:53:21 drh Exp $ +*/ +#include "sqliteInt.h" +#ifndef SQLITE_OMIT_COMPLETE + +/* +** This is defined in tokenize.c. We just have to import the definition. +*/ +extern const char sqlite3IsIdChar[]; +#define IdChar(C) (((c=C)&0x80)!=0 || (c>0x1f && sqlite3IsIdChar[c-0x20])) + + +/* +** Token types used by the sqlite3_complete() routine. See the header +** comments on that procedure for additional information. +*/ +#define tkSEMI 0 +#define tkWS 1 +#define tkOTHER 2 +#define tkEXPLAIN 3 +#define tkCREATE 4 +#define tkTEMP 5 +#define tkTRIGGER 6 +#define tkEND 7 + +/* +** Return TRUE if the given SQL string ends in a semicolon. +** +** Special handling is require for CREATE TRIGGER statements. +** Whenever the CREATE TRIGGER keywords are seen, the statement +** must end with ";END;". +** +** This implementation uses a state machine with 7 states: +** +** (0) START At the beginning or end of an SQL statement. This routine +** returns 1 if it ends in the START state and 0 if it ends +** in any other state. +** +** (1) NORMAL We are in the middle of statement which ends with a single +** semicolon. +** +** (2) EXPLAIN The keyword EXPLAIN has been seen at the beginning of +** a statement. +** +** (3) CREATE The keyword CREATE has been seen at the beginning of a +** statement, possibly preceeded by EXPLAIN and/or followed by +** TEMP or TEMPORARY +** +** (4) TRIGGER We are in the middle of a trigger definition that must be +** ended by a semicolon, the keyword END, and another semicolon. +** +** (5) SEMI We've seen the first semicolon in the ";END;" that occurs at +** the end of a trigger definition. +** +** (6) END We've seen the ";END" of the ";END;" that occurs at the end +** of a trigger difinition. +** +** Transitions between states above are determined by tokens extracted +** from the input. The following tokens are significant: +** +** (0) tkSEMI A semicolon. +** (1) tkWS Whitespace +** (2) tkOTHER Any other SQL token. +** (3) tkEXPLAIN The "explain" keyword. +** (4) tkCREATE The "create" keyword. +** (5) tkTEMP The "temp" or "temporary" keyword. +** (6) tkTRIGGER The "trigger" keyword. +** (7) tkEND The "end" keyword. +** +** Whitespace never causes a state transition and is always ignored. +** +** If we compile with SQLITE_OMIT_TRIGGER, all of the computation needed +** to recognize the end of a trigger can be omitted. All we have to do +** is look for a semicolon that is not part of an string or comment. +*/ +int sqlite3_complete(const char *zSql){ + const char *tmp; + return sqlite3_complete_last(zSql, &tmp); +} + +int sqlite3_complete_last(const char *zSql, const char **last){ + u8 state = 0; /* Current state, using numbers defined in header comment */ + u8 token; /* Value of the next token */ + const char* lastseen = 0; + +#ifndef SQLITE_OMIT_TRIGGER + /* A complex statement machine used to detect the end of a CREATE TRIGGER + ** statement. This is the normal case. + */ + static const u8 trans[7][8] = { + /* Token: */ + /* State: ** SEMI WS OTHER EXPLAIN CREATE TEMP TRIGGER END */ + /* 0 START: */ { 0, 0, 1, 2, 3, 1, 1, 1, }, + /* 1 NORMAL: */ { 0, 1, 1, 1, 1, 1, 1, 1, }, + /* 2 EXPLAIN: */ { 0, 2, 1, 1, 3, 1, 1, 1, }, + /* 3 CREATE: */ { 0, 3, 1, 1, 1, 3, 4, 1, }, + /* 4 TRIGGER: */ { 5, 4, 4, 4, 4, 4, 4, 4, }, + /* 5 SEMI: */ { 5, 5, 4, 4, 4, 4, 4, 6, }, + /* 6 END: */ { 0, 6, 4, 4, 4, 4, 4, 4, }, + }; +#else + /* If triggers are not suppored by this compile then the statement machine + ** used to detect the end of a statement is much simplier + */ + static const u8 trans[2][3] = { + /* Token: */ + /* State: ** SEMI WS OTHER */ + /* 0 START: */ { 0, 0, 1, }, + /* 1 NORMAL: */ { 0, 1, 1, }, + }; +#endif /* SQLITE_OMIT_TRIGGER */ + + while( *zSql ){ + switch( *zSql ){ + case ';': { /* A semicolon */ + token = tkSEMI; + break; + } + case ' ': + case '\r': + case '\t': + case '\n': + case '\f': { /* White space is ignored */ + token = tkWS; + break; + } + case '/': { /* C-style comments */ + if( zSql[1]!='*' ){ + token = tkOTHER; + break; + } + zSql += 2; + while( zSql[0] && (zSql[0]!='*' || zSql[1]!='/') ){ zSql++; } + if( zSql[0]==0 ) { *last = lastseen; return 0; } + zSql++; + token = tkWS; + break; + } + case '-': { /* SQL-style comments from "--" to end of line */ + if( zSql[1]!='-' ){ + token = tkOTHER; + break; + } + while( *zSql && *zSql!='\n' ){ zSql++; } + if( *zSql==0 ) { *last = lastseen; return state==0; } + token = tkWS; + break; + } + case '[': { /* Microsoft-style identifiers in [...] */ + zSql++; + while( *zSql && *zSql!=']' ){ zSql++; } + if( *zSql==0 ) { *last = lastseen; return 0; } + token = tkOTHER; + break; + } + case '`': /* Grave-accent quoted symbols used by MySQL */ + case '"': /* single- and double-quoted strings */ + case '\'': { + int c = *zSql; + zSql++; + while( *zSql && *zSql!=c ){ zSql++; } + if( *zSql==0 ) {*last = lastseen; return 0; } + token = tkOTHER; + break; + } + default: { + int c; + if( IdChar((u8)*zSql) ){ + /* Keywords and unquoted identifiers */ + int nId; + for(nId=1; IdChar(zSql[nId]); nId++){} +#ifdef SQLITE_OMIT_TRIGGER + token = tkOTHER; +#else + switch( *zSql ){ + case 'c': case 'C': { + if( nId==6 && sqlite3StrNICmp(zSql, "create", 6)==0 ){ + token = tkCREATE; + }else{ + token = tkOTHER; + } + break; + } + case 't': case 'T': { + if( nId==7 && sqlite3StrNICmp(zSql, "trigger", 7)==0 ){ + token = tkTRIGGER; + }else if( nId==4 && sqlite3StrNICmp(zSql, "temp", 4)==0 ){ + token = tkTEMP; + }else if( nId==9 && sqlite3StrNICmp(zSql, "temporary", 9)==0 ){ + token = tkTEMP; + }else{ + token = tkOTHER; + } + break; + } + case 'e': case 'E': { + if( nId==3 && sqlite3StrNICmp(zSql, "end", 3)==0 ){ + token = tkEND; + }else +#ifndef SQLITE_OMIT_EXPLAIN + if( nId==7 && sqlite3StrNICmp(zSql, "explain", 7)==0 ){ + token = tkEXPLAIN; + }else +#endif + { + token = tkOTHER; + } + break; + } + default: { + token = tkOTHER; + break; + } + } +#endif /* SQLITE_OMIT_TRIGGER */ + zSql += nId-1; + }else{ + /* Operators and special symbols */ + token = tkOTHER; + } + break; + } + } + state = trans[state][token]; + if (state == 0) + lastseen = zSql; + zSql++; + } + *last = lastseen; + return state==0; +} + +#ifndef SQLITE_OMIT_UTF16 +/* +** This routine is the same as the sqlite3_complete() routine described +** above, except that the parameter is required to be UTF-16 encoded, not +** UTF-8. +*/ +int sqlite3_complete16(const void *zSql){ + sqlite3_value *pVal; + char const *zSql8; + int rc = 0; + + pVal = sqlite3ValueNew(); + sqlite3ValueSetStr(pVal, -1, zSql, SQLITE_UTF16NATIVE, SQLITE_STATIC); + zSql8 = sqlite3ValueText(pVal, SQLITE_UTF8); + if( zSql8 ){ + rc = sqlite3_complete(zSql8); + } + sqlite3ValueFree(pVal); + return rc; +} +#endif /* SQLITE_OMIT_UTF16 */ +#endif /* SQLITE_OMIT_COMPLETE */ ======================================================================== --- sqlite/date.c 2134ef4388256e8247405178df8a61bd60dc180a +++ sqlite/date.c 7444b0900a28da77e57e3337a636873cff0ae940 @@ -16,7 +16,7 @@ ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: date.c,v 1.44 2005/03/21 00:43:44 drh Exp $ +** $Id: date.c,v 1.45 2005/06/25 18:42:14 drh Exp $ ** ** NOTES: ** @@ -124,11 +124,7 @@ ** Read text from z[] and convert into a floating point number. Return ** the number of digits converted. */ -static int getValue(const char *z, double *pR){ - const char *zEnd; - *pR = sqlite3AtoF(z, &zEnd); - return zEnd - z; -} +#define getValue sqlite3AtoF /* ** Parse a timezone extension on the end of a date-time. @@ -320,7 +316,7 @@ p->validJD = 1; return 0; }else if( sqlite3IsNumber(zDate, 0, SQLITE_UTF8) ){ - p->rJD = sqlite3AtoF(zDate, 0); + getValue(zDate, &p->rJD); p->validJD = 1; return 0; } ======================================================================== --- sqlite/delete.c 4b68127f55971c7fb459146e0b6cf3bd70cfffe9 +++ sqlite/delete.c 16a0e19460b14d219f39ff5c7a9eef808aa1969c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** in order to generate code for DELETE FROM statements. ** -** $Id: delete.c,v 1.106 2005/06/12 21:35:52 drh Exp $ +** $Id: delete.c,v 1.110 2005/09/08 01:58:43 drh Exp $ */ #include "sqliteInt.h" @@ -65,8 +65,8 @@ Table *pTab /* The table to be opened */ ){ sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0); - sqlite3VdbeAddOp(v, OP_OpenRead, iCur, pTab->tnum); VdbeComment((v, "# %s", pTab->zName)); + sqlite3VdbeAddOp(v, OP_OpenRead, iCur, pTab->tnum); sqlite3VdbeAddOp(v, OP_SetNumColumns, iCur, pTab->nCol); } @@ -178,12 +178,12 @@ if( pParse->nested==0 ) sqlite3VdbeCountChanges(v); sqlite3BeginWriteOperation(pParse, triggers_exist, pTab->iDb); - /* If we are trying to delete from a view, construct that view into - ** a temporary table. + /* If we are trying to delete from a view, realize that view into + ** a ephemeral table. */ if( isView ){ Select *pView = sqlite3SelectDup(pTab->pSelect); - sqlite3Select(pParse, pView, SRT_TempTable, iCur, 0, 0, 0, 0); + sqlite3Select(pParse, pView, SRT_VirtualTab, iCur, 0, 0, 0, 0); sqlite3SelectDelete(pView); } @@ -240,7 +240,7 @@ /* Remember the rowid of every item to be deleted. */ sqlite3VdbeAddOp(v, OP_Rowid, iCur, 0); - sqlite3VdbeAddOp(v, OP_ListWrite, 0, 0); + sqlite3VdbeAddOp(v, OP_FifoWrite, 0, 0); if( db->flags & SQLITE_CountRows ){ sqlite3VdbeAddOp(v, OP_AddImm, 1, 0); } @@ -260,14 +260,13 @@ ** database scan. We have to delete items after the scan is complete ** because deleting an item can change the scan order. */ - sqlite3VdbeAddOp(v, OP_ListRewind, 0, 0); end = sqlite3VdbeMakeLabel(v); /* This is the beginning of the delete loop when there are ** row triggers. */ if( triggers_exist ){ - addr = sqlite3VdbeAddOp(v, OP_ListRead, 0, end); + addr = sqlite3VdbeAddOp(v, OP_FifoRead, 0, end); if( !isView ){ sqlite3VdbeAddOp(v, OP_Dup, 0, 0); sqlite3OpenTableForReading(v, iCur, pTab); @@ -288,7 +287,7 @@ if( !isView ){ /* Open cursors for the table we are deleting from and all its ** indices. If there are row triggers, this happens inside the - ** OP_ListRead loop because the cursor have to all be closed + ** OP_FifoRead loop because the cursor have to all be closed ** before the trigger fires. If there are no row triggers, the ** cursors are opened only once on the outside the loop. */ @@ -297,7 +296,7 @@ /* This is the beginning of the delete loop when there are no ** row triggers */ if( !triggers_exist ){ - addr = sqlite3VdbeAddOp(v, OP_ListRead, 0, end); + addr = sqlite3VdbeAddOp(v, OP_FifoRead, 0, end); } /* Delete the row */ @@ -322,7 +321,6 @@ /* End of the delete loop */ sqlite3VdbeAddOp(v, OP_Goto, 0, addr); sqlite3VdbeResolveLabel(v, end); - sqlite3VdbeAddOp(v, OP_ListReset, 0, 0); /* Close the cursors after the loop if there are no row triggers */ if( !triggers_exist ){ @@ -442,6 +440,6 @@ sqlite3ColumnDefault(v, pTab, idx); } } - sqlite3VdbeAddOp(v, OP_MakeRecord, pIdx->nColumn, (1<<24)); + sqlite3VdbeAddOp(v, OP_MakeIdxRec, pIdx->nColumn, 0); sqlite3IndexAffinityStr(v, pIdx); } ======================================================================== --- sqlite/expr.c 6d7058944c5f4b7e4304be3fe63ada91dac221a1 +++ sqlite/expr.c b8dbd5a30e80b83b0c1e137dcfcd687bd5d2b76c @@ -12,7 +12,7 @@ ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. ** -** $Id: expr.c,v 1.206 2005/06/12 21:35:52 drh Exp $ +** $Id: expr.c,v 1.228 2005/09/16 02:38:10 drh Exp $ */ #include "sqliteInt.h" #include @@ -34,12 +34,18 @@ ** SELECT * FROM t1 WHERE (select a from t1); */ char sqlite3ExprAffinity(Expr *pExpr){ - if( pExpr->op==TK_AS ){ + int op = pExpr->op; + if( op==TK_AS ){ return sqlite3ExprAffinity(pExpr->pLeft); } - if( pExpr->op==TK_SELECT ){ + if( op==TK_SELECT ){ return sqlite3ExprAffinity(pExpr->pSelect->pEList->a[0].pExpr); } +#ifndef SQLITE_OMIT_CAST + if( op==TK_CAST ){ + return sqlite3AffinityType(&pExpr->token); + } +#endif return pExpr->affinity; } @@ -51,7 +57,7 @@ CollSeq *pColl = 0; if( pExpr ){ pColl = pExpr->pColl; - if( pExpr->op==TK_AS && !pColl ){ + if( (pExpr->op==TK_AS || pExpr->op==TK_CAST) && !pColl ){ return sqlite3ExprCollSeq(pParse, pExpr->pLeft); } } @@ -87,6 +93,7 @@ return SQLITE_AFF_NONE; }else{ /* One side is a column, the other is not. Use the columns affinity. */ + assert( aff1==0 || aff2==0 ); return (aff1 + aff2); } } @@ -207,9 +214,8 @@ /* ** When doing a nested parse, you can include terms in an expression ** that look like this: #0 #1 #2 ... These terms refer to elements -** on the stack. "#0" (or just "#") means the top of the stack. -** "#1" means the next down on the stack. And so forth. #-1 means -** memory location 0. #-2 means memory location 1. And so forth. +** on the stack. "#0" means the top of the stack. +** "#1" means the next down on the stack. And so forth. ** ** This routine is called by the parser to deal with on of those terms. ** It immediately generates code to store the value in a memory location. @@ -220,23 +226,19 @@ Vdbe *v = pParse->pVdbe; Expr *p; int depth; - if( v==0 ) return 0; if( pParse->nested==0 ){ sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", pToken); return 0; } + if( v==0 ) return 0; p = sqlite3Expr(TK_REGISTER, 0, 0, pToken); if( p==0 ){ return 0; /* Malloc failed */ } depth = atoi(&pToken->z[1]); - if( depth>=0 ){ - p->iTable = pParse->nMem++; - sqlite3VdbeAddOp(v, OP_Dup, depth, 0); - sqlite3VdbeAddOp(v, OP_MemStore, p->iTable, 1); - }else{ - p->iTable = -1-depth; - } + p->iTable = pParse->nMem++; + sqlite3VdbeAddOp(v, OP_Dup, depth, 0); + sqlite3VdbeAddOp(v, OP_MemStore, p->iTable, 1); return p; } @@ -353,7 +355,7 @@ pExpr->iTable = ++pParse->nVar; if( pParse->nVarExpr>=pParse->nVarExprAlloc-1 ){ pParse->nVarExprAlloc += pParse->nVarExprAlloc + 10; - pParse->apVarExpr = sqliteRealloc(pParse->apVarExpr, + sqlite3ReallocOrFree((void**)&pParse->apVarExpr, pParse->nVarExprAlloc*sizeof(pParse->apVarExpr[0]) ); } if( !sqlite3_malloc_failed ){ @@ -378,7 +380,22 @@ sqliteFree(p); } +/* +** The Expr.token field might be a string literal that is quoted. +** If so, remove the quotation marks. +*/ +void sqlite3DequoteExpr(Expr *p){ + if( ExprHasAnyProperty(p, EP_Dequoted) ){ + return; + } + ExprSetProperty(p, EP_Dequoted); + if( p->token.dyn==0 ){ + sqlite3TokenCopy(&p->token, &p->token); + } + sqlite3Dequote((char*)p->token.z); +} + /* ** The following group of routines make deep copies of expressions, ** expression lists, ID lists, and select statements. The copies can @@ -529,9 +546,12 @@ pNew->pOffset = sqlite3ExprDup(p->pOffset); pNew->iLimit = -1; pNew->iOffset = -1; - pNew->ppOpenTemp = 0; pNew->isResolved = p->isResolved; pNew->isAgg = p->isAgg; + pNew->pRightmost = 0; + pNew->addrOpenVirt[0] = -1; + pNew->addrOpenVirt[1] = -1; + pNew->addrOpenVirt[2] = -1; return pNew; } #else @@ -607,6 +627,8 @@ ** ** The return value from this routine is 1 to abandon the tree walk ** and 0 to continue. +** +** NOTICE: This routine does *not* descend into subqueries. */ static int walkExprList(ExprList *, int (*)(void *, Expr*), void *); static int walkExprTree(Expr *pExpr, int (*xFunc)(void*,Expr*), void *pArg){ @@ -664,17 +686,27 @@ */ static int exprNodeIsConstant(void *pArg, Expr *pExpr){ switch( pExpr->op ){ + /* Consider functions to be constant if all their arguments are constant + ** and *pArg==2 */ + case TK_FUNCTION: + if( *((int*)pArg)==2 ) return 0; + /* Fall through */ case TK_ID: case TK_COLUMN: case TK_DOT: case TK_AGG_FUNCTION: - case TK_FUNCTION: + case TK_AGG_COLUMN: #ifndef SQLITE_OMIT_SUBQUERY case TK_SELECT: case TK_EXISTS: #endif *((int*)pArg) = 0; return 2; + case TK_IN: + if( pExpr->pSelect ){ + *((int*)pArg) = 0; + return 2; + } default: return 0; } @@ -682,7 +714,7 @@ /* ** Walk an expression tree. Return 1 if the expression is constant -** and 0 if it involves variables. +** and 0 if it involves variables or function calls. ** ** For the purposes of this function, a double-quoted string (ex: "abc") ** is considered a variable but a single-quoted string (ex: 'abc') is @@ -695,6 +727,21 @@ } /* +** Walk an expression tree. Return 1 if the expression is constant +** or a function call with constant arguments. Return and 0 if there +** are any variables. +** +** For the purposes of this function, a double-quoted string (ex: "abc") +** is considered a variable but a single-quoted string (ex: 'abc') is +** a constant. +*/ +int sqlite3ExprIsConstantOrFunction(Expr *p){ + int isConst = 2; + walkExprTree(p, exprNodeIsConstant, &isConst); + return isConst!=0; +} + +/* ** If the expression p codes a constant integer that is small enough ** to fit in a 32-bit integer, return 1 and put the value of the integer ** in *pValue. If the expression is not an integer or if it is too big @@ -1184,11 +1231,19 @@ NameContext *pNC, /* Namespace to resolve expressions in. */ Expr *pExpr /* The expression to be analyzed. */ ){ + int savedHasAgg; if( pExpr==0 ) return 0; + savedHasAgg = pNC->hasAgg; + pNC->hasAgg = 0; walkExprTree(pExpr, nameResolverStep, pNC); if( pNC->nErr>0 ){ ExprSetProperty(pExpr, EP_Error); } + if( pNC->hasAgg ){ + ExprSetProperty(pExpr, EP_Agg); + }else if( savedHasAgg ){ + pNC->hasAgg = 1; + } return ExprHasProperty(pExpr, EP_Error); } @@ -1218,37 +1273,39 @@ */ #ifndef SQLITE_OMIT_SUBQUERY void sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){ - int label = 0; /* Address after sub-select code */ + int testAddr = 0; /* One-time test address */ Vdbe *v = sqlite3GetVdbe(pParse); if( v==0 ) return; - /* If this is not a variable (correlated) select, then execute - ** it only once. Unless this is part of a trigger program. In - ** that case re-execute every time (this could be optimized). + /* This code must be run in its entirety every time it is encountered + ** if any of the following is true: + ** + ** * The right-hand side is a correlated subquery + ** * The right-hand side is an expression list containing variables + ** * We are inside a trigger + ** + ** If all of the above are false, then we can run this code just once + ** save the results, and reuse the same result on subsequent invocations. */ if( !ExprHasAnyProperty(pExpr, EP_VarSelect) && !pParse->trigStack ){ int mem = pParse->nMem++; sqlite3VdbeAddOp(v, OP_MemLoad, mem, 0); - label = sqlite3VdbeMakeLabel(v); - sqlite3VdbeAddOp(v, OP_If, 0, label); + testAddr = sqlite3VdbeAddOp(v, OP_If, 0, 0); + assert( testAddr>0 || sqlite3_malloc_failed ); sqlite3VdbeAddOp(v, OP_Integer, 1, 0); sqlite3VdbeAddOp(v, OP_MemStore, mem, 1); } - if( pExpr->pSelect ){ - sqlite3VdbeAddOp(v, OP_AggContextPush, 0, 0); - } - switch( pExpr->op ){ case TK_IN: { char affinity; KeyInfo keyInfo; - int addr; /* Address of OP_OpenTemp instruction */ + int addr; /* Address of OP_OpenVirtual instruction */ affinity = sqlite3ExprAffinity(pExpr->pLeft); /* Whether this is an 'x IN(SELECT...)' or an 'x IN()' - ** expression it is handled the same way. A temporary table is + ** expression it is handled the same way. A virtual table is ** filled with single-field index keys representing the results ** from the SELECT or the . ** @@ -1261,7 +1318,7 @@ ** is used. */ pExpr->iTable = pParse->nTab++; - addr = sqlite3VdbeAddOp(v, OP_OpenTemp, pExpr->iTable, 0); + addr = sqlite3VdbeAddOp(v, OP_OpenVirtual, pExpr->iTable, 0); memset(&keyInfo, 0, sizeof(keyInfo)); keyInfo.nField = 1; sqlite3VdbeAddOp(v, OP_SetNumColumns, pExpr->iTable, 1); @@ -1290,20 +1347,30 @@ ** a column, use numeric affinity. */ int i; + ExprList *pList = pExpr->pList; + struct ExprList_item *pItem; + if( !affinity ){ affinity = SQLITE_AFF_NUMERIC; } keyInfo.aColl[0] = pExpr->pLeft->pColl; /* Loop through each expression in . */ - for(i=0; ipList->nExpr; i++){ - Expr *pE2 = pExpr->pList->a[i].pExpr; + for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){ + Expr *pE2 = pItem->pExpr; - /* Check that the expression is constant and valid. */ - if( !sqlite3ExprIsConstant(pE2) ){ - sqlite3ErrorMsg(pParse, - "right-hand side of IN operator must be constant"); - return; + /* If the expression is not constant then we will need to + ** disable the test that was generated above that makes sure + ** this code only executes once. Because for a non-constant + ** expression we need to rerun this code each time. + */ + if( testAddr>0 && !sqlite3ExprIsConstant(pE2) ){ + VdbeOp *aOp = sqlite3VdbeGetOp(v, testAddr-1); + int i; + for(i=0; i<4; i++){ + aOp[i].opcode = OP_Noop; + } + testAddr = 0; } /* Evaluate the expression and insert it into the temp table */ @@ -1341,12 +1408,9 @@ } } - if( pExpr->pSelect ){ - sqlite3VdbeAddOp(v, OP_AggContextPop, 0, 0); + if( testAddr ){ + sqlite3VdbeChangeP2(v, testAddr, sqlite3VdbeCurrentAddr(v)); } - if( label<0 ){ - sqlite3VdbeResolveLabel(v, label); - } return; } #endif /* SQLITE_OMIT_SUBQUERY */ @@ -1360,7 +1424,7 @@ if( sqlite3GetInt32(z, &i) ){ sqlite3VdbeAddOp(v, OP_Integer, i, 0); }else if( sqlite3FitsIn64Bits(z) ){ - sqlite3VdbeOp3(v, OP_Integer, 0, 0, z, n); + sqlite3VdbeOp3(v, OP_Int64, 0, 0, z, n); }else{ sqlite3VdbeOp3(v, OP_Real, 0, 0, z, n); } @@ -1386,10 +1450,21 @@ } op = pExpr->op; switch( op ){ + case TK_AGG_COLUMN: { + AggInfo *pAggInfo = pExpr->pAggInfo; + struct AggInfo_col *pCol = &pAggInfo->aCol[pExpr->iAgg]; + if( !pAggInfo->directMode ){ + sqlite3VdbeAddOp(v, OP_MemLoad, pCol->iMem, 0); + break; + }else if( pAggInfo->useSortingIdx ){ + sqlite3VdbeAddOp(v, OP_Column, pAggInfo->sortingIdx, + pCol->iSorterColumn); + break; + } + /* Otherwise, fall thru into the TK_COLUMN case */ + } case TK_COLUMN: { - if( !pParse->fillAgg && pExpr->iAgg>=0 ){ - sqlite3VdbeAddOp(v, OP_AggGet, pExpr->iAggCtx, pExpr->iAgg); - }else if( pExpr->iColumn>=0 ){ + if( pExpr->iColumn>=0 ){ sqlite3VdbeAddOp(v, OP_Column, pExpr->iTable, pExpr->iColumn); sqlite3ColumnDefault(v, pExpr->pTab, pExpr->iColumn); }else{ @@ -1405,8 +1480,8 @@ case TK_STRING: { assert( TK_FLOAT==OP_Real ); assert( TK_STRING==OP_String8 ); + sqlite3DequoteExpr(pExpr); sqlite3VdbeOp3(v, op, 0, 0, pExpr->token.z, pExpr->token.n); - sqlite3VdbeDequoteP3(v, -1); break; } case TK_NULL: { @@ -1415,9 +1490,16 @@ } #ifndef SQLITE_OMIT_BLOB_LITERAL case TK_BLOB: { + int n; + const char *z; assert( TK_BLOB==OP_HexBlob ); - sqlite3VdbeOp3(v, op, 0, 0, pExpr->token.z+1, pExpr->token.n-1); - sqlite3VdbeDequoteP3(v, -1); + n = pExpr->token.n - 3; + z = pExpr->token.z + 2; + assert( n>=0 ); + if( n==0 ){ + z = ""; + } + sqlite3VdbeOp3(v, op, 0, 0, z, n); break; } #endif @@ -1432,6 +1514,22 @@ sqlite3VdbeAddOp(v, OP_MemLoad, pExpr->iTable, 0); break; } +#ifndef SQLITE_OMIT_CAST + case TK_CAST: { + /* Expressions of the form: CAST(pLeft AS token) */ + int aff, op; + sqlite3ExprCode(pParse, pExpr->pLeft); + aff = sqlite3AffinityType(&pExpr->token); + switch( aff ){ + case SQLITE_AFF_INTEGER: op = OP_ToInt; break; + case SQLITE_AFF_NUMERIC: op = OP_ToNumeric; break; + case SQLITE_AFF_TEXT: op = OP_ToText; break; + case SQLITE_AFF_NONE: op = OP_ToBlob; break; + } + sqlite3VdbeAddOp(v, op, 0, 0); + break; + } +#endif /* SQLITE_OMIT_CAST */ case TK_LT: case TK_LE: case TK_GT: @@ -1515,7 +1613,8 @@ break; } case TK_AGG_FUNCTION: { - sqlite3VdbeAddOp(v, OP_AggGet, 0, pExpr->iAgg); + AggInfo *pInfo = pExpr->pAggInfo; + sqlite3VdbeAddOp(v, OP_MemLoad, pInfo->aFunc[pExpr->iAgg].iMem, 0); break; } case TK_CONST_FUNC: @@ -1525,7 +1624,7 @@ FuncDef *pDef; int nId; const char *zId; - int p2 = 0; + int constMask = 0; int i; u8 enc = pParse->db->enc; CollSeq *pColl = 0; @@ -1536,7 +1635,7 @@ nExpr = sqlite3ExprCodeExprList(pParse, pList); for(i=0; ia[i].pExpr) ){ - p2 |= (1<needCollSeq && !pColl ){ pColl = sqlite3ExprCollSeq(pParse, pList->a[i].pExpr); @@ -1546,7 +1645,7 @@ if( !pColl ) pColl = pParse->db->pDfltColl; sqlite3VdbeOp3(v, OP_CollSeq, 0, 0, (char *)pColl, P3_COLLSEQ); } - sqlite3VdbeOp3(v, OP_Function, nExpr, p2, (char*)pDef, P3_FUNCDEF); + sqlite3VdbeOp3(v, OP_Function, constMask, nExpr, (char*)pDef, P3_FUNCDEF); break; } #ifndef SQLITE_OMIT_SUBQUERY @@ -1663,9 +1762,9 @@ assert( pExpr->iColumn==OE_Rollback || pExpr->iColumn == OE_Abort || pExpr->iColumn == OE_Fail ); + sqlite3DequoteExpr(pExpr); sqlite3VdbeOp3(v, OP_Halt, SQLITE_CONSTRAINT, pExpr->iColumn, pExpr->token.z, pExpr->token.n); - sqlite3VdbeDequoteP3(v, -1); } else { assert( pExpr->iColumn == OE_Ignore ); sqlite3VdbeAddOp(v, OP_ContextPop, 0, 0); @@ -1717,11 +1816,9 @@ ){ struct ExprList_item *pItem; int i, n; - Vdbe *v; if( pList==0 ) return 0; - v = sqlite3GetVdbe(pParse); n = pList->nExpr; - for(pItem=pList->a, i=0; ia, i=n; i>0; i--, pItem++){ sqlite3ExprCode(pParse, pItem->pExpr); } return n; @@ -1941,6 +2038,7 @@ return 0; } if( pA->op!=pB->op ) return 0; + if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 0; if( !sqlite3ExprCompare(pA->pLeft, pB->pLeft) ) return 0; if( !sqlite3ExprCompare(pA->pRight, pB->pRight) ) return 0; if( pA->pList ){ @@ -1964,25 +2062,34 @@ return 1; } + /* -** Add a new element to the pParse->aAgg[] array and return its index. -** The new element is initialized to zero. The calling function is -** expected to fill it in. +** Add a new element to the pAggInfo->aCol[] array. Return the index of +** the new element. Return a negative number if malloc fails. */ -static int appendAggInfo(Parse *pParse){ - if( (pParse->nAgg & 0x7)==0 ){ - int amt = pParse->nAgg + 8; - AggExpr *aAgg = sqliteRealloc(pParse->aAgg, amt*sizeof(pParse->aAgg[0])); - if( aAgg==0 ){ - return -1; - } - pParse->aAgg = aAgg; +static int addAggInfoColumn(AggInfo *pInfo){ + int i; + i = sqlite3ArrayAllocate((void**)&pInfo->aCol, sizeof(pInfo->aCol[0]), 3); + if( i<0 ){ + return -1; } - memset(&pParse->aAgg[pParse->nAgg], 0, sizeof(pParse->aAgg[0])); - return pParse->nAgg++; -} + return i; +} /* +** Add a new element to the pAggInfo->aFunc[] array. Return the index of +** the new element. Return a negative number if malloc fails. +*/ +static int addAggInfoFunc(AggInfo *pInfo){ + int i; + i = sqlite3ArrayAllocate((void**)&pInfo->aFunc, sizeof(pInfo->aFunc[0]), 2); + if( i<0 ){ + return -1; + } + return i; +} + +/* ** This is an xFunc for walkExprTree() used to implement ** sqlite3ExprAnalyzeAggregates(). See sqlite3ExprAnalyzeAggregates ** for additional information. @@ -1991,60 +2098,118 @@ */ static int analyzeAggregate(void *pArg, Expr *pExpr){ int i; - AggExpr *aAgg; NameContext *pNC = (NameContext *)pArg; Parse *pParse = pNC->pParse; SrcList *pSrcList = pNC->pSrcList; + AggInfo *pAggInfo = pNC->pAggInfo; + switch( pExpr->op ){ case TK_COLUMN: { - for(i=0; pSrcList && inSrc; i++){ - if( pExpr->iTable==pSrcList->a[i].iCursor ){ - aAgg = pParse->aAgg; - for(i=0; inAgg; i++){ - if( aAgg[i].isAgg ) continue; - if( aAgg[i].pExpr->iTable==pExpr->iTable - && aAgg[i].pExpr->iColumn==pExpr->iColumn ){ - break; + /* Check to see if the column is in one of the tables in the FROM + ** clause of the aggregate query */ + if( pSrcList ){ + struct SrcList_item *pItem = pSrcList->a; + for(i=0; inSrc; i++, pItem++){ + struct AggInfo_col *pCol; + if( pExpr->iTable==pItem->iCursor ){ + /* If we reach this point, it means that pExpr refers to a table + ** that is in the FROM clause of the aggregate query. + ** + ** Make an entry for the column in pAggInfo->aCol[] if there + ** is not an entry there already. + */ + pCol = pAggInfo->aCol; + for(i=0; inColumn; i++, pCol++){ + if( pCol->iTable==pExpr->iTable && + pCol->iColumn==pExpr->iColumn ){ + break; + } } - } - if( i>=pParse->nAgg ){ - i = appendAggInfo(pParse); - if( i<0 ) return 1; - pParse->aAgg[i].isAgg = 0; - pParse->aAgg[i].pExpr = pExpr; - } - pExpr->iAgg = i; - pExpr->iAggCtx = pNC->nDepth; - return 1; - } + if( i>=pAggInfo->nColumn && (i = addAggInfoColumn(pAggInfo))>=0 ){ + pCol = &pAggInfo->aCol[i]; + pCol->iTable = pExpr->iTable; + pCol->iColumn = pExpr->iColumn; + pCol->iMem = pParse->nMem++; + pCol->iSorterColumn = -1; + pCol->pExpr = pExpr; + if( pAggInfo->pGroupBy ){ + int j, n; + ExprList *pGB = pAggInfo->pGroupBy; + struct ExprList_item *pTerm = pGB->a; + n = pGB->nExpr; + for(j=0; jpExpr; + if( pE->op==TK_COLUMN && pE->iTable==pExpr->iTable && + pE->iColumn==pExpr->iColumn ){ + pCol->iSorterColumn = j; + break; + } + } + } + if( pCol->iSorterColumn<0 ){ + pCol->iSorterColumn = pAggInfo->nSortingColumn++; + } + } + /* There is now an entry for pExpr in pAggInfo->aCol[] (either + ** because it was there before or because we just created it). + ** Convert the pExpr to be a TK_AGG_COLUMN referring to that + ** pAggInfo->aCol[] entry. + */ + pExpr->pAggInfo = pAggInfo; + pExpr->op = TK_AGG_COLUMN; + pExpr->iAgg = i; + break; + } /* endif pExpr->iTable==pItem->iCursor */ + } /* end loop over pSrcList */ } return 1; } case TK_AGG_FUNCTION: { + /* The pNC->nDepth==0 test causes aggregate functions in subqueries + ** to be ignored */ if( pNC->nDepth==0 ){ - aAgg = pParse->aAgg; - for(i=0; inAgg; i++){ - if( !aAgg[i].isAgg ) continue; - if( sqlite3ExprCompare(aAgg[i].pExpr, pExpr) ){ + /* Check to see if pExpr is a duplicate of another aggregate + ** function that is already in the pAggInfo structure + */ + struct AggInfo_func *pItem = pAggInfo->aFunc; + for(i=0; inFunc; i++, pItem++){ + if( sqlite3ExprCompare(pItem->pExpr, pExpr) ){ break; } } - if( i>=pParse->nAgg ){ + if( i>=pAggInfo->nFunc ){ + /* pExpr is original. Make a new entry in pAggInfo->aFunc[] + */ u8 enc = pParse->db->enc; - i = appendAggInfo(pParse); - if( i<0 ) return 1; - pParse->aAgg[i].isAgg = 1; - pParse->aAgg[i].pExpr = pExpr; - pParse->aAgg[i].pFunc = sqlite3FindFunction(pParse->db, - pExpr->token.z, pExpr->token.n, - pExpr->pList ? pExpr->pList->nExpr : 0, enc, 0); + i = addAggInfoFunc(pAggInfo); + if( i>=0 ){ + pItem = &pAggInfo->aFunc[i]; + pItem->pExpr = pExpr; + pItem->iMem = pParse->nMem++; + pItem->pFunc = sqlite3FindFunction(pParse->db, + pExpr->token.z, pExpr->token.n, + pExpr->pList ? pExpr->pList->nExpr : 0, enc, 0); + if( pExpr->flags & EP_Distinct ){ + pItem->iDistinct = pParse->nTab++; + }else{ + pItem->iDistinct = -1; + } + } } + /* Make pExpr point to the appropriate pAggInfo->aFunc[] entry + */ pExpr->iAgg = i; + pExpr->pAggInfo = pAggInfo; return 1; } } } + + /* Recursively walk subqueries looking for TK_COLUMN nodes that need + ** to be changed to TK_AGG_COLUMN. But increment nDepth so that + ** TK_AGG_FUNCTION nodes in subqueries will be unchanged. + */ if( pExpr->pSelect ){ pNC->nDepth++; walkSelectExpr(pExpr->pSelect, analyzeAggregate, pNC); @@ -2069,3 +2234,21 @@ walkExprTree(pExpr, analyzeAggregate, pNC); return pNC->pParse->nErr - nErr; } + +/* +** Call sqlite3ExprAnalyzeAggregates() for every expression in an +** expression list. Return the number of errors. +** +** If an error is found, the analysis is cut short. +*/ +int sqlite3ExprAnalyzeAggList(NameContext *pNC, ExprList *pList){ + struct ExprList_item *pItem; + int i; + int nErr = 0; + if( pList ){ + for(pItem=pList->a, i=0; nErr==0 && inExpr; i++, pItem++){ + nErr += sqlite3ExprAnalyzeAggregates(pNC, pItem->pExpr); + } + } + return nErr; +} ======================================================================== --- sqlite/func.c f208d71f741d47b63277530939f552815af8ce35 +++ sqlite/func.c f63d417248808ff2632a3b576536abffcc21d858 @@ -16,7 +16,7 @@ ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: func.c,v 1.98 2005/05/24 12:01:02 danielk1977 Exp $ +** $Id: func.c,v 1.110 2005/09/08 20:37:43 drh Exp $ */ #include "sqliteInt.h" #include @@ -26,6 +26,9 @@ #include "vdbeInt.h" #include "os.h" +/* +** Return the collating function associated with a function. +*/ static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){ return context->pColl; } @@ -78,6 +81,7 @@ sqlite3_result_text(context, z, -1, SQLITE_STATIC); } + /* ** Implementation of the length() function */ @@ -183,7 +187,7 @@ static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ int n = 0; double r; - char zBuf[100]; + char zBuf[500]; /* larger than the %f representation of the largest double */ assert( argc==1 || argc==2 ); if( argc==2 ){ if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return; @@ -193,7 +197,7 @@ } if( SQLITE_NULL==sqlite3_value_type(argv[0]) ) return; r = sqlite3_value_double(argv[0]); - sprintf(zBuf,"%.*f",n,r); + sqlite3_snprintf(sizeof(zBuf),zBuf,"%.*f",n,r); sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); } @@ -307,8 +311,14 @@ u8 matchSet; u8 noCase; }; + static const struct compareInfo globInfo = { '*', '?', '[', 0 }; -static const struct compareInfo likeInfo = { '%', '_', 0, 1 }; +/* The correct SQL-92 behavior is for the LIKE operator to ignore +** case. Thus 'a' LIKE 'A' would be true. */ +static const struct compareInfo likeInfoNorm = { '%', '_', 0, 1 }; +/* If SQLITE_CASE_SENSITIVE_LIKE is defined, then the LIKE operator +** is case sensitive causing 'a' LIKE 'A' to be false */ +static const struct compareInfo likeInfoAlt = { '%', '_', 0, 0 }; /* ** X is a pointer to the first byte of a UTF-8 character. Increment @@ -450,7 +460,16 @@ return *zString==0; } +/* +** Count the number of times that the LIKE operator (or GLOB which is +** just a variation of LIKE) gets called. This is used for testing +** only. +*/ +#ifdef SQLITE_TEST +int sqlite3_like_count = 0; +#endif + /* ** Implementation of the like() SQL function. This function implements ** the build-in LIKE operator. The first argument to the function is the @@ -460,8 +479,8 @@ ** ** is implemented as like(B,A). ** -** If the pointer retrieved by via a call to sqlite3_user_data() is -** not NULL, then this function uses UTF-16. Otherwise UTF-8. +** This same function (with a different compareInfo structure) computes +** the GLOB operator. */ static void likeFunc( sqlite3_context *context, @@ -484,28 +503,15 @@ escape = sqlite3ReadUtf8(zEsc); } if( zA && zB ){ - sqlite3_result_int(context, patternCompare(zA, zB, &likeInfo, escape)); + struct compareInfo *pInfo = sqlite3_user_data(context); +#ifdef SQLITE_TEST + sqlite3_like_count++; +#endif + sqlite3_result_int(context, patternCompare(zA, zB, pInfo, escape)); } } /* -** Implementation of the glob() SQL function. This function implements -** the build-in GLOB operator. The first argument to the function is the -** string and the second argument is the pattern. So, the SQL statements: -** -** A GLOB B -** -** is implemented as glob(B,A). -*/ -static void globFunc(sqlite3_context *context, int arg, sqlite3_value **argv){ - const unsigned char *zA = sqlite3_value_text(argv[0]); - const unsigned char *zB = sqlite3_value_text(argv[1]); - if( zA && zB ){ - sqlite3_result_int(context, patternCompare(zA, zB, &globInfo, 0)); - } -} - -/* ** Implementation of the NULLIF(x,y) function. The result is the first ** argument if the arguments are different. The result is NULL if the ** arguments are equal to each other. @@ -813,6 +819,7 @@ struct SumCtx { double sum; /* Sum of terms */ int cnt; /* Number of elements summed */ + u8 seenFloat; /* True if there has been any floating point value */ }; /* @@ -820,21 +827,32 @@ */ static void sumStep(sqlite3_context *context, int argc, sqlite3_value **argv){ SumCtx *p; - if( argc<1 ) return; + int type; + assert( argc==1 ); p = sqlite3_aggregate_context(context, sizeof(*p)); - if( p && SQLITE_NULL!=sqlite3_value_type(argv[0]) ){ + type = sqlite3_value_type(argv[0]); + if( p && type!=SQLITE_NULL ){ p->sum += sqlite3_value_double(argv[0]); p->cnt++; + if( type==SQLITE_FLOAT ){ + p->seenFloat = 1; + } } } static void sumFinalize(sqlite3_context *context){ SumCtx *p; - p = sqlite3_aggregate_context(context, sizeof(*p)); - sqlite3_result_double(context, p ? p->sum : 0.0); + p = sqlite3_aggregate_context(context, 0); + if( p && p->cnt>0 ){ + if( p->seenFloat ){ + sqlite3_result_double(context, p->sum); + }else{ + sqlite3_result_int64(context, (i64)p->sum); + } + } } static void avgFinalize(sqlite3_context *context){ SumCtx *p; - p = sqlite3_aggregate_context(context, sizeof(*p)); + p = sqlite3_aggregate_context(context, 0); if( p && p->cnt>0 ){ sqlite3_result_double(context, p->sum/(double)p->cnt); } @@ -872,21 +890,11 @@ } static void countFinalize(sqlite3_context *context){ CountCtx *p; - p = sqlite3_aggregate_context(context, sizeof(*p)); + p = sqlite3_aggregate_context(context, 0); sqlite3_result_int(context, p ? p->n : 0); } /* -** This function tracks state information for the min() and max() -** aggregate functions. -*/ -typedef struct MinMaxCtx MinMaxCtx; -struct MinMaxCtx { - char *z; /* The best so far */ - char zBuf[28]; /* Space that can be used for storage */ -}; - -/* ** Routines to implement min() and max() aggregate functions. */ static void minmaxStep(sqlite3_context *context, int argc, sqlite3_value **argv){ @@ -920,11 +928,13 @@ } static void minMaxFinalize(sqlite3_context *context){ sqlite3_value *pRes; - pRes = (sqlite3_value *)sqlite3_aggregate_context(context, sizeof(Mem)); - if( pRes->flags ){ - sqlite3_result_value(context, pRes); + pRes = (sqlite3_value *)sqlite3_aggregate_context(context, 0); + if( pRes ){ + if( pRes->flags ){ + sqlite3_result_value(context, pRes); + } + sqlite3VdbeMemRelease(pRes); } - sqlite3VdbeMemRelease(pRes); } @@ -962,9 +972,6 @@ { "coalesce", 1, 0, SQLITE_UTF8, 0, 0 }, { "ifnull", 2, 0, SQLITE_UTF8, 1, ifnullFunc }, { "random", -1, 0, SQLITE_UTF8, 0, randomFunc }, - { "like", 2, 0, SQLITE_UTF8, 0, likeFunc }, - { "like", 3, 0, SQLITE_UTF8, 0, likeFunc }, - { "glob", 2, 0, SQLITE_UTF8, 0, globFunc }, { "nullif", 2, 0, SQLITE_UTF8, 1, nullifFunc }, { "sqlite_version", 0, 0, SQLITE_UTF8, 0, versionFunc}, { "quote", 1, 0, SQLITE_UTF8, 0, quoteFunc }, @@ -1036,8 +1043,76 @@ } sqlite3RegisterDateTimeFunctions(db); #ifdef SQLITE_SSE - { - sqlite3SseFunctions(db); + sqlite3SseFunctions(db); +#endif +#ifdef SQLITE_CASE_SENSITIVE_LIKE + sqlite3RegisterLikeFunctions(db, 1); +#else + sqlite3RegisterLikeFunctions(db, 0); +#endif +} + +/* +** Set the LIKEOPT flag on the 2-argument function with the given name. +*/ +static void setLikeOptFlag(sqlite3 *db, const char *zName, int flagVal){ + FuncDef *pDef; + pDef = sqlite3FindFunction(db, zName, strlen(zName), 2, SQLITE_UTF8, 0); + if( pDef ){ + pDef->flags = flagVal; } -#endif } + +/* +** Register the built-in LIKE and GLOB functions. The caseSensitive +** parameter determines whether or not the LIKE operator is case +** sensitive. GLOB is always case sensitive. +*/ +void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive){ + struct compareInfo *pInfo; + if( caseSensitive ){ + pInfo = (struct compareInfo*)&likeInfoAlt; + }else{ + pInfo = (struct compareInfo*)&likeInfoNorm; + } + sqlite3_create_function(db, "like", 2, SQLITE_UTF8, pInfo, likeFunc, 0, 0); + sqlite3_create_function(db, "like", 3, SQLITE_UTF8, pInfo, likeFunc, 0, 0); + sqlite3_create_function(db, "glob", 2, SQLITE_UTF8, + (struct compareInfo*)&globInfo, likeFunc, 0,0); + setLikeOptFlag(db, "glob", SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE); + setLikeOptFlag(db, "like", + caseSensitive ? (SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE) : SQLITE_FUNC_LIKE); +} + +/* +** pExpr points to an expression which implements a function. If +** it is appropriate to apply the LIKE optimization to that function +** then set aWc[0] through aWc[2] to the wildcard characters and +** return TRUE. If the function is not a LIKE-style function then +** return FALSE. +*/ +int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){ + FuncDef *pDef; + if( pExpr->op!=TK_FUNCTION ){ + return 0; + } + if( pExpr->pList->nExpr!=2 ){ + return 0; + } + pDef = sqlite3FindFunction(db, pExpr->token.z, pExpr->token.n, 2, + SQLITE_UTF8, 0); + if( pDef==0 || (pDef->flags & SQLITE_FUNC_LIKE)==0 ){ + return 0; + } + + /* The memcpy() statement assumes that the wildcard characters are + ** the first three statements in the compareInfo structure. The + ** asserts() that follow verify that assumption + */ + memcpy(aWc, pDef->pUserData, 3); + assert( (char*)&likeInfoAlt == (char*)&likeInfoAlt.matchAll ); + assert( &((char*)&likeInfoAlt)[1] == (char*)&likeInfoAlt.matchOne ); + assert( &((char*)&likeInfoAlt)[2] == (char*)&likeInfoAlt.matchSet ); + *pIsNocase = (pDef->flags & SQLITE_FUNC_CASE)==0; + return 1; +} ======================================================================== --- sqlite/insert.c 8c0868a975fe37366ed92e1b976853be96284607 +++ sqlite/insert.c 484c73bc1309f283a31baa0e114f3ee980536397 @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** -** $Id: insert.c,v 1.139 2005/06/12 21:35:52 drh Exp $ +** $Id: insert.c,v 1.142 2005/07/21 18:23:20 drh Exp $ */ #include "sqliteInt.h" @@ -373,7 +373,7 @@ ** back up and execute the SELECT code above. */ sqlite3VdbeChangeP2(v, iInitCode, sqlite3VdbeCurrentAddr(v)); - sqlite3VdbeAddOp(v, OP_OpenTemp, srcTab, 0); + sqlite3VdbeAddOp(v, OP_OpenVirtual, srcTab, 0); sqlite3VdbeAddOp(v, OP_SetNumColumns, srcTab, nColumn); sqlite3VdbeAddOp(v, OP_Goto, 0, iSelectLoop); sqlite3VdbeResolveLabel(v, iCleanup); @@ -949,7 +949,7 @@ sqlite3VdbeAddOp(v, OP_Dup, i+extra+nCol-idx, 1); } } - jumpInst1 = sqlite3VdbeAddOp(v, OP_MakeRecord, pIdx->nColumn, (1<<24)); + jumpInst1 = sqlite3VdbeAddOp(v, OP_MakeIdxRec, pIdx->nColumn, 0); sqlite3IndexAffinityStr(v, pIdx); /* Find out what action to take in case there is an indexing conflict */ @@ -1019,9 +1019,8 @@ } } contAddr = sqlite3VdbeCurrentAddr(v); - assert( contAddr<(1<<24) ); #if NULL_DISTINCT_FOR_UNIQUE - sqlite3VdbeChangeP2(v, jumpInst1, contAddr | (1<<24)); + sqlite3VdbeChangeP2(v, jumpInst1, contAddr); #endif sqlite3VdbeChangeP2(v, jumpInst2, contAddr); } @@ -1097,11 +1096,12 @@ Vdbe *v = sqlite3GetVdbe(pParse); assert( v!=0 ); sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0); + VdbeComment((v, "# %s", pTab->zName)); sqlite3VdbeAddOp(v, op, base, pTab->tnum); - VdbeComment((v, "# %s", pTab->zName)); sqlite3VdbeAddOp(v, OP_SetNumColumns, base, pTab->nCol); for(i=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){ sqlite3VdbeAddOp(v, OP_Integer, pIdx->iDb, 0); + VdbeComment((v, "# %s", pIdx->zName)); sqlite3VdbeOp3(v, op, i+base, pIdx->tnum, (char*)&pIdx->keyInfo, P3_KEYINFO); } ======================================================================== --- sqlite/keywordhash.h 9f753ca12591e9ac7d627850e28217bf1fb96c26 +++ sqlite/keywordhash.h 32380a4bfe997d18e3ecd5b85fd948cf7b52aec8 @@ -1,83 +1,84 @@ -/* Hash score: 153 */ +/* Hash score: 158 */ static int keywordCode(const char *z, int n){ - static const char zText[515] = + static const char zText[535] = "ABORTABLEFTEMPORARYADDATABASELECTHENDEFAULTRANSACTIONATURALTER" - "AISEACHECKEYAFTEREFERENCESCAPELSEXCEPTRIGGEREGEXPLAINITIALLYAND" - "EFERRABLEXCLUSIVEXISTSTATEMENTATTACHAVINGLOBEFOREIGNOREINDEXAUTOINCREMENT" - "BEGINNERENAMEBETWEENOTNULLIKEBYCASCADEFERREDELETECASECOLLATECOLUMN" - "COMMITCONFLICTCONSTRAINTERSECTCREATECROSSCURRENT_DATECURRENT_TIMESTAMP" - "RAGMATCHDESCDETACHDISTINCTDROPRIMARYFAILIMITFROMFULLGROUPDATE" - "IMMEDIATEINSERTINSTEADINTOFFSETISNULLJOINORDEREPLACEOUTERESTRICT" - "RIGHTROLLBACKROWHENUNIONUNIQUEUSINGVACUUMVALUESVIEWHERE"; + "AISEACHECKEYAFTEREFERENCESCAPELSEXCEPTRIGGEREGEXPLAINITIALLYANALYZE" + "XCLUSIVEXISTSTATEMENTANDEFERRABLEATTACHAVINGLOBEFOREIGNOREINDEX" + "AUTOINCREMENTBEGINNERENAMEBETWEENOTNULLIKEBYCASCADEFERREDELETE" + "CASECASTCOLLATECOLUMNCOMMITCONFLICTCONSTRAINTERSECTCREATECROSS" + "CURRENT_DATECURRENT_TIMESTAMPLANDESCDETACHDISTINCTDROPRAGMATCH" + "FAILIMITFROMFULLGROUPDATEIMMEDIATEINSERTINSTEADINTOFFSETISNULL" + "JOINORDEREPLACEOUTERESTRICTPRIMARYQUERYRIGHTROLLBACKROWHENUNION" + "UNIQUEUSINGVACUUMVALUESVIEWHERE"; static const unsigned char aHash[127] = { - 89, 79, 102, 88, 0, 4, 0, 0, 109, 0, 75, 0, 0, - 92, 43, 0, 90, 0, 101, 104, 94, 0, 0, 10, 0, 0, - 108, 0, 105, 100, 0, 28, 47, 0, 40, 0, 0, 63, 69, - 0, 62, 19, 0, 0, 32, 81, 0, 103, 72, 0, 0, 34, - 0, 60, 33, 0, 8, 0, 110, 37, 12, 0, 76, 39, 25, - 64, 0, 0, 31, 80, 52, 30, 49, 20, 86, 0, 35, 0, - 73, 26, 0, 70, 0, 0, 0, 0, 46, 65, 22, 85, 29, - 67, 84, 0, 1, 0, 9, 98, 57, 18, 0, 107, 74, 96, - 53, 6, 83, 0, 0, 48, 91, 0, 99, 0, 68, 0, 0, - 15, 0, 111, 50, 55, 0, 2, 54, 0, 106, + 91, 80, 106, 90, 0, 4, 0, 0, 113, 0, 83, 0, 0, + 94, 44, 76, 92, 0, 105, 108, 96, 0, 0, 10, 0, 0, + 112, 0, 109, 102, 0, 28, 48, 0, 41, 0, 0, 65, 71, + 0, 63, 19, 0, 104, 36, 103, 0, 107, 74, 0, 0, 33, + 0, 61, 37, 0, 8, 0, 114, 38, 12, 0, 77, 40, 25, + 66, 0, 0, 31, 81, 53, 30, 50, 20, 88, 0, 34, 0, + 75, 26, 0, 72, 0, 0, 0, 64, 47, 67, 22, 87, 29, + 69, 86, 0, 1, 0, 9, 100, 58, 18, 0, 111, 82, 98, + 54, 6, 85, 0, 0, 49, 93, 0, 101, 0, 70, 0, 0, + 15, 0, 115, 51, 56, 0, 2, 55, 0, 110, }; - static const unsigned char aNext[111] = { + static const unsigned char aNext[115] = { 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, - 0, 11, 0, 0, 0, 7, 0, 5, 13, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, - 0, 16, 0, 23, 51, 0, 0, 0, 0, 44, 58, 0, 0, - 0, 0, 0, 0, 0, 0, 71, 41, 0, 0, 24, 59, 21, - 0, 78, 0, 66, 0, 0, 82, 45, 0, 0, 0, 0, 0, - 0, 0, 38, 93, 95, 0, 0, 97, 0, 14, 27, 77, 0, - 56, 87, 0, 36, 0, 61, 0, + 0, 11, 0, 0, 0, 0, 5, 13, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 23, 52, 0, 0, 0, 0, 45, 0, 59, + 0, 0, 0, 0, 0, 0, 0, 0, 73, 42, 0, 24, 60, + 21, 0, 79, 0, 0, 68, 0, 0, 84, 46, 0, 0, 0, + 0, 0, 0, 0, 39, 95, 97, 0, 0, 99, 0, 32, 0, + 14, 27, 78, 0, 57, 89, 0, 35, 0, 62, 0, }; - static const unsigned char aLen[111] = { + static const unsigned char aLen[115] = { 5, 5, 4, 4, 9, 2, 3, 8, 2, 6, 4, 3, 7, 11, 2, 7, 5, 5, 4, 5, 3, 5, 10, 6, 4, 6, - 7, 6, 7, 9, 3, 3, 10, 9, 6, 9, 6, 6, 4, - 6, 3, 7, 6, 7, 5, 13, 2, 2, 5, 5, 6, 7, - 3, 7, 4, 4, 2, 7, 3, 8, 6, 4, 7, 6, 6, - 8, 10, 9, 6, 5, 12, 12, 17, 6, 5, 4, 6, 8, - 2, 4, 7, 4, 5, 4, 4, 5, 6, 9, 6, 7, 4, - 2, 6, 3, 6, 4, 5, 7, 5, 8, 5, 8, 3, 4, - 5, 6, 5, 6, 6, 4, 5, + 7, 6, 7, 9, 3, 7, 9, 6, 9, 3, 10, 6, 6, + 4, 6, 3, 7, 6, 7, 5, 13, 2, 2, 5, 5, 6, + 7, 3, 7, 4, 4, 2, 7, 3, 8, 6, 4, 4, 7, + 6, 6, 8, 10, 9, 6, 5, 12, 12, 17, 4, 4, 6, + 8, 2, 4, 6, 5, 4, 5, 4, 4, 5, 6, 9, 6, + 7, 4, 2, 6, 3, 6, 4, 5, 7, 5, 8, 7, 5, + 5, 8, 3, 4, 5, 6, 5, 6, 6, 4, 5, }; - static const unsigned short int aOffset[111] = { + static const unsigned short int aOffset[115] = { 0, 4, 7, 10, 10, 14, 19, 21, 26, 27, 32, 34, 36, 42, 51, 52, 57, 61, 65, 67, 71, 74, 78, 86, 91, 94, - 99, 105, 108, 113, 118, 122, 124, 133, 141, 146, 155, 160, 165, - 168, 170, 170, 174, 178, 180, 185, 187, 189, 198, 201, 205, 211, - 217, 217, 220, 223, 227, 229, 230, 234, 241, 247, 251, 258, 264, - 270, 278, 285, 294, 300, 305, 317, 317, 333, 337, 342, 346, 352, - 353, 360, 363, 370, 373, 378, 382, 386, 389, 395, 404, 410, 417, - 420, 420, 423, 426, 432, 436, 440, 447, 451, 459, 464, 472, 474, - 478, 483, 489, 494, 500, 506, 509, + 99, 105, 108, 113, 118, 122, 128, 136, 141, 150, 152, 162, 167, + 172, 175, 177, 177, 181, 185, 187, 192, 194, 196, 205, 208, 212, + 218, 224, 224, 227, 230, 234, 236, 237, 241, 248, 254, 258, 262, + 269, 275, 281, 289, 296, 305, 311, 316, 328, 328, 344, 348, 352, + 358, 359, 366, 369, 373, 378, 381, 386, 390, 394, 397, 403, 412, + 418, 425, 428, 428, 431, 434, 440, 444, 448, 455, 459, 467, 474, + 479, 484, 492, 494, 498, 503, 509, 514, 520, 526, 529, }; - static const unsigned char aCode[111] = { + static const unsigned char aCode[115] = { TK_ABORT, TK_TABLE, TK_JOIN_KW, TK_TEMP, TK_TEMP, TK_OR, TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_THEN, TK_END, TK_DEFAULT, TK_TRANSACTION,TK_ON, TK_JOIN_KW, TK_ALTER, TK_RAISE, TK_EACH, TK_CHECK, TK_KEY, TK_AFTER, TK_REFERENCES, TK_ESCAPE, TK_ELSE, TK_EXCEPT, TK_TRIGGER, TK_LIKE_KW, TK_EXPLAIN, TK_INITIALLY, - TK_ALL, TK_AND, TK_DEFERRABLE, TK_EXCLUSIVE, TK_EXISTS, - TK_STATEMENT, TK_ATTACH, TK_HAVING, TK_LIKE_KW, TK_BEFORE, - TK_FOR, TK_FOREIGN, TK_IGNORE, TK_REINDEX, TK_INDEX, - TK_AUTOINCR, TK_TO, TK_IN, TK_BEGIN, TK_JOIN_KW, - TK_RENAME, TK_BETWEEN, TK_NOT, TK_NOTNULL, TK_NULL, - TK_LIKE_KW, TK_BY, TK_CASCADE, TK_ASC, TK_DEFERRED, - TK_DELETE, TK_CASE, TK_COLLATE, TK_COLUMNKW, TK_COMMIT, - TK_CONFLICT, TK_CONSTRAINT, TK_INTERSECT, TK_CREATE, TK_JOIN_KW, - TK_CTIME_KW, TK_CTIME_KW, TK_CTIME_KW, TK_PRAGMA, TK_MATCH, - TK_DESC, TK_DETACH, TK_DISTINCT, TK_IS, TK_DROP, - TK_PRIMARY, TK_FAIL, TK_LIMIT, TK_FROM, TK_JOIN_KW, - TK_GROUP, TK_UPDATE, TK_IMMEDIATE, TK_INSERT, TK_INSTEAD, - TK_INTO, TK_OF, TK_OFFSET, TK_SET, TK_ISNULL, - TK_JOIN, TK_ORDER, TK_REPLACE, TK_JOIN_KW, TK_RESTRICT, - TK_JOIN_KW, TK_ROLLBACK, TK_ROW, TK_WHEN, TK_UNION, - TK_UNIQUE, TK_USING, TK_VACUUM, TK_VALUES, TK_VIEW, - TK_WHERE, + TK_ALL, TK_ANALYZE, TK_EXCLUSIVE, TK_EXISTS, TK_STATEMENT, + TK_AND, TK_DEFERRABLE, TK_ATTACH, TK_HAVING, TK_LIKE_KW, + TK_BEFORE, TK_FOR, TK_FOREIGN, TK_IGNORE, TK_REINDEX, + TK_INDEX, TK_AUTOINCR, TK_TO, TK_IN, TK_BEGIN, + TK_JOIN_KW, TK_RENAME, TK_BETWEEN, TK_NOT, TK_NOTNULL, + TK_NULL, TK_LIKE_KW, TK_BY, TK_CASCADE, TK_ASC, + TK_DEFERRED, TK_DELETE, TK_CASE, TK_CAST, TK_COLLATE, + TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_CONSTRAINT, TK_INTERSECT, + TK_CREATE, TK_JOIN_KW, TK_CTIME_KW, TK_CTIME_KW, TK_CTIME_KW, + TK_PLAN, TK_DESC, TK_DETACH, TK_DISTINCT, TK_IS, + TK_DROP, TK_PRAGMA, TK_MATCH, TK_FAIL, TK_LIMIT, + TK_FROM, TK_JOIN_KW, TK_GROUP, TK_UPDATE, TK_IMMEDIATE, + TK_INSERT, TK_INSTEAD, TK_INTO, TK_OF, TK_OFFSET, + TK_SET, TK_ISNULL, TK_JOIN, TK_ORDER, TK_REPLACE, + TK_JOIN_KW, TK_RESTRICT, TK_PRIMARY, TK_QUERY, TK_JOIN_KW, + TK_ROLLBACK, TK_ROW, TK_WHEN, TK_UNION, TK_UNIQUE, + TK_USING, TK_VACUUM, TK_VALUES, TK_VIEW, TK_WHERE, }; int h, i; if( n<2 ) return TK_ID; ======================================================================== --- sqlite/main.c 16ab37b7b3aa57bcfb6b687474b2553c67b1a7fe +++ sqlite/main.c 422014201f22aa17b96c76650163178a91a825af @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.293 2005/05/26 16:23:34 drh Exp $ +** $Id: main.c,v 1.302 2005/09/17 15:20:27 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -234,7 +234,6 @@ case SQLITE_DONE: case SQLITE_OK: z = "not an error"; break; case SQLITE_ERROR: z = "SQL logic error or missing database"; break; - case SQLITE_INTERNAL: z = "internal SQLite implementation flaw"; break; case SQLITE_PERM: z = "access permission denied"; break; case SQLITE_ABORT: z = "callback requested query abort"; break; case SQLITE_BUSY: z = "database is locked"; break; @@ -244,13 +243,11 @@ case SQLITE_INTERRUPT: z = "interrupted"; break; case SQLITE_IOERR: z = "disk I/O error"; break; case SQLITE_CORRUPT: z = "database disk image is malformed"; break; - case SQLITE_NOTFOUND: z = "table or record not found"; break; - case SQLITE_FULL: z = "database is full"; break; + case SQLITE_FULL: z = "database or disk is full"; break; case SQLITE_CANTOPEN: z = "unable to open database file"; break; case SQLITE_PROTOCOL: z = "database locking protocol failure"; break; case SQLITE_EMPTY: z = "table contains no data"; break; case SQLITE_SCHEMA: z = "database schema has changed"; break; - case SQLITE_TOOBIG: z = "too much data for one table row"; break; case SQLITE_CONSTRAINT: z = "constraint failed"; break; case SQLITE_MISMATCH: z = "datatype mismatch"; break; case SQLITE_MISUSE: z = "library routine called out of sequence";break; @@ -308,6 +305,25 @@ } /* +** Invoke the given busy handler. +** +** This routine is called when an operation failed with a lock. +** If this routine returns non-zero, the lock is retried. If it +** returns 0, the operation aborts with an SQLITE_BUSY error. +*/ +int sqlite3InvokeBusyHandler(BusyHandler *p){ + int rc; + if( p==0 || p->xFunc==0 || p->nBusy<0 ) return 0; + rc = p->xFunc(p->pArg, p->nBusy); + if( rc==0 ){ + p->nBusy = -1; + }else{ + p->nBusy++; + } + return rc; +} + +/* ** This routine sets the busy callback for an Sqlite database to the ** given callback function with the given argument. */ @@ -321,6 +337,7 @@ } db->busyHandler.xFunc = xBusy; db->busyHandler.pArg = pArg; + db->busyHandler.nBusy = 0; return SQLITE_OK; } @@ -454,6 +471,7 @@ p = sqlite3FindFunction(db, zFunctionName, nName, nArg, enc, 1); if( p==0 ) return SQLITE_NOMEM; + p->flags = 0; p->xFunc = xFunc; p->xStep = xStep; p->xFinalize = xFinal; @@ -491,13 +509,14 @@ } #endif +#ifndef SQLITE_OMIT_TRACE /* ** Register a trace function. The pArg from the previously registered trace ** is returned. ** ** A NULL trace function means that no tracing is executes. A non-NULL ** trace is a pointer to a function that is invoked at the start of each -** sqlite3_exec(). +** SQL statement. */ void *sqlite3_trace(sqlite3 *db, void (*xTrace)(void*,const char*), void *pArg){ void *pOld = db->pTraceArg; @@ -505,6 +524,25 @@ db->pTraceArg = pArg; return pOld; } +/* +** Register a profile function. The pArg from the previously registered +** profile function is returned. +** +** A NULL profile function means that no profiling is executes. A non-NULL +** profile is a pointer to a function that is invoked at the conclusion of +** each SQL statement that is run. +*/ +void *sqlite3_profile( + sqlite3 *db, + void (*xProfile)(void*,const char*,sqlite_uint64), + void *pArg +){ + void *pOld = db->pProfileArg; + db->xProfile = xProfile; + db->pProfileArg = pArg; + return pOld; +} +#endif /* SQLITE_OMIT_TRACE */ /*** EXPERIMENTAL *** ** @@ -530,11 +568,11 @@ ** opened and used. If zFilename is the magic name ":memory:" then ** the database is stored in memory (and is thus forgotten as soon as ** the connection is closed.) If zFilename is NULL then the database -** is for temporary use only and is deleted as soon as the connection -** is closed. +** is a "virtual" database for transient use only and is deleted as +** soon as the connection is closed. ** -** A temporary database can be either a disk file (that is automatically -** deleted when the file is closed) or a set of red-black trees held in memory, +** A virtual database can be either a disk file (that is automatically +** deleted when the file is closed) or it an be held entirely in memory, ** depending on the values of the TEMP_STORE compile-time macro and the ** db->temp_store variable, according to the following chart: ** @@ -676,6 +714,7 @@ ){ sqlite3 *db; int rc, i; + CollSeq *pColl; /* Allocate the sqlite data structure */ db = sqliteMalloc( sizeof(sqlite3) ); @@ -712,6 +751,13 @@ /* Also add a UTF-8 case-insensitive collation sequence. */ sqlite3_create_collation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc); + /* Set flags on the built-in collating sequences */ + db->pDfltColl->type = SQLITE_COLL_BINARY; + pColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "NOCASE", 6, 0); + if( pColl ){ + pColl->type = SQLITE_COLL_NOCASE; + } + /* Open the backend database driver */ rc = sqlite3BtreeFactory(db, zFilename, 0, MAX_PAGES, &db->aDb[0].pBt); if( rc!=SQLITE_OK ){ @@ -829,7 +875,7 @@ rc = SQLITE_OK; }else{ rc = sqlite3VdbeReset((Vdbe*)pStmt); - sqlite3VdbeMakeReady((Vdbe*)pStmt, -1, 0, 0, 0, 0); + sqlite3VdbeMakeReady((Vdbe*)pStmt, -1, 0, 0, 0); } return rc; } @@ -883,7 +929,7 @@ pColl = sqlite3FindCollSeq(db, (u8)enc, zName, strlen(zName), 1); if( 0==pColl ){ - rc = SQLITE_NOMEM; + rc = SQLITE_NOMEM; }else{ pColl->xCmp = xCompare; pColl->pUser = pCtx; @@ -1001,3 +1047,14 @@ int sqlite3_get_autocommit(sqlite3 *db){ return db->autoCommit; } + +#ifdef SQLITE_DEBUG +/* +** The following routine is subtituted for constant SQLITE_CORRUPT in +** debugging builds. This provides a way to set a breakpoint for when +** corruption is first detected. +*/ +int sqlite3Corrupt(void){ + return SQLITE_CORRUPT; +} +#endif ======================================================================== --- sqlite/opcodes.c 09ba45fa2716974a205f0514fda43e0d52c50ecc +++ sqlite/opcodes.c 8b23c96979492cba740a2e3c67f6646e8b323b12 @@ -6,130 +6,135 @@ /* 2 */ "Column", /* 3 */ "SetCookie", /* 4 */ "IfMemPos", - /* 5 */ "MoveGt", - /* 6 */ "AggFocus", + /* 5 */ "Sequence", + /* 6 */ "MoveGt", /* 7 */ "RowKey", - /* 8 */ "AggNext", - /* 9 */ "OpenWrite", - /* 10 */ "If", + /* 8 */ "OpenWrite", + /* 9 */ "If", + /* 10 */ "ToInt", /* 11 */ "Pop", - /* 12 */ "AggContextPush", - /* 13 */ "CollSeq", - /* 14 */ "OpenRead", - /* 15 */ "Expire", - /* 16 */ "SortReset", - /* 17 */ "AutoCommit", - /* 18 */ "Sort", - /* 19 */ "ListRewind", - /* 20 */ "IntegrityCk", - /* 21 */ "SortInsert", - /* 22 */ "Function", - /* 23 */ "Noop", - /* 24 */ "Return", - /* 25 */ "NewRowid", - /* 26 */ "Variable", - /* 27 */ "String", - /* 28 */ "ParseSchema", - /* 29 */ "AggFunc", - /* 30 */ "Close", - /* 31 */ "ListWrite", - /* 32 */ "CreateIndex", - /* 33 */ "IsUnique", - /* 34 */ "IdxIsNull", - /* 35 */ "NotFound", - /* 36 */ "MustBeInt", - /* 37 */ "Halt", - /* 38 */ "Rowid", - /* 39 */ "IdxLT", - /* 40 */ "AddImm", - /* 41 */ "Statement", - /* 42 */ "RowData", - /* 43 */ "MemMax", - /* 44 */ "Push", - /* 45 */ "NotExists", - /* 46 */ "OpenTemp", - /* 47 */ "MemIncr", - /* 48 */ "Gosub", - /* 49 */ "AggSet", - /* 50 */ "Integer", - /* 51 */ "SortNext", - /* 52 */ "Prev", - /* 53 */ "CreateTable", - /* 54 */ "Last", - /* 55 */ "IdxRowid", - /* 56 */ "ResetCount", - /* 57 */ "Callback", - /* 58 */ "ContextPush", - /* 59 */ "DropTrigger", - /* 60 */ "DropIndex", - /* 61 */ "IdxGE", - /* 62 */ "Or", - /* 63 */ "And", - /* 64 */ "Not", - /* 65 */ "IdxDelete", - /* 66 */ "Vacuum", - /* 67 */ "MoveLe", - /* 68 */ "IsNull", - /* 69 */ "NotNull", - /* 70 */ "Ne", - /* 71 */ "Eq", - /* 72 */ "Gt", - /* 73 */ "Le", - /* 74 */ "Lt", - /* 75 */ "Ge", - /* 76 */ "IfNot", - /* 77 */ "BitAnd", - /* 78 */ "BitOr", - /* 79 */ "ShiftLeft", - /* 80 */ "ShiftRight", - /* 81 */ "Add", - /* 82 */ "Subtract", - /* 83 */ "Multiply", - /* 84 */ "Divide", - /* 85 */ "Remainder", - /* 86 */ "Concat", - /* 87 */ "Negative", - /* 88 */ "DropTable", - /* 89 */ "BitNot", - /* 90 */ "String8", - /* 91 */ "MakeRecord", - /* 92 */ "Delete", - /* 93 */ "AggContextPop", - /* 94 */ "ListRead", - /* 95 */ "ListReset", - /* 96 */ "Dup", - /* 97 */ "Goto", - /* 98 */ "Clear", - /* 99 */ "IdxGT", - /* 100 */ "MoveLt", - /* 101 */ "VerifyCookie", - /* 102 */ "Pull", - /* 103 */ "SetNumColumns", - /* 104 */ "AbsValue", - /* 105 */ "Transaction", - /* 106 */ "AggGet", - /* 107 */ "ContextPop", - /* 108 */ "Next", - /* 109 */ "AggInit", - /* 110 */ "IdxInsert", - /* 111 */ "Distinct", - /* 112 */ "AggReset", - /* 113 */ "Insert", - /* 114 */ "Destroy", - /* 115 */ "ReadCookie", - /* 116 */ "ForceInt", - /* 117 */ "OpenPseudo", - /* 118 */ "Null", - /* 119 */ "Blob", - /* 120 */ "MemStore", - /* 121 */ "Rewind", - /* 122 */ "MoveGe", - /* 123 */ "Found", - /* 124 */ "NullRow", + /* 12 */ "CollSeq", + /* 13 */ "OpenRead", + /* 14 */ "Expire", + /* 15 */ "AutoCommit", + /* 16 */ "IntegrityCk", + /* 17 */ "Sort", + /* 18 */ "Function", + /* 19 */ "Noop", + /* 20 */ "Return", + /* 21 */ "NewRowid", + /* 22 */ "Variable", + /* 23 */ "String", + /* 24 */ "ParseSchema", + /* 25 */ "Close", + /* 26 */ "CreateIndex", + /* 27 */ "IsUnique", + /* 28 */ "IdxIsNull", + /* 29 */ "NotFound", + /* 30 */ "Int64", + /* 31 */ "MustBeInt", + /* 32 */ "Halt", + /* 33 */ "Rowid", + /* 34 */ "IdxLT", + /* 35 */ "AddImm", + /* 36 */ "Statement", + /* 37 */ "RowData", + /* 38 */ "MemMax", + /* 39 */ "Push", + /* 40 */ "NotExists", + /* 41 */ "MemIncr", + /* 42 */ "Gosub", + /* 43 */ "Integer", + /* 44 */ "ToNumeric", + /* 45 */ "Prev", + /* 46 */ "CreateTable", + /* 47 */ "Last", + /* 48 */ "IdxRowid", + /* 49 */ "MakeIdxRec", + /* 50 */ "ResetCount", + /* 51 */ "FifoWrite", + /* 52 */ "Callback", + /* 53 */ "ContextPush", + /* 54 */ "DropTrigger", + /* 55 */ "DropIndex", + /* 56 */ "IdxGE", + /* 57 */ "IdxDelete", + /* 58 */ "Vacuum", + /* 59 */ "MoveLe", + /* 60 */ "IfNot", + /* 61 */ "DropTable", + /* 62 */ "MakeRecord", + /* 63 */ "ToBlob", + /* 64 */ "Delete", + /* 65 */ "AggFinal", + /* 66 */ "Dup", + /* 67 */ "Or", + /* 68 */ "And", + /* 69 */ "Not", + /* 70 */ "Goto", + /* 71 */ "FifoRead", + /* 72 */ "Clear", + /* 73 */ "IsNull", + /* 74 */ "NotNull", + /* 75 */ "Ne", + /* 76 */ "Eq", + /* 77 */ "Gt", + /* 78 */ "Le", + /* 79 */ "Lt", + /* 80 */ "Ge", + /* 81 */ "IdxGT", + /* 82 */ "BitAnd", + /* 83 */ "BitOr", + /* 84 */ "ShiftLeft", + /* 85 */ "ShiftRight", + /* 86 */ "Add", + /* 87 */ "Subtract", + /* 88 */ "Multiply", + /* 89 */ "Divide", + /* 90 */ "Remainder", + /* 91 */ "Concat", + /* 92 */ "Negative", + /* 93 */ "MoveLt", + /* 94 */ "BitNot", + /* 95 */ "String8", + /* 96 */ "VerifyCookie", + /* 97 */ "AggStep", + /* 98 */ "Pull", + /* 99 */ "ToText", + /* 100 */ "SetNumColumns", + /* 101 */ "AbsValue", + /* 102 */ "Transaction", + /* 103 */ "ContextPop", + /* 104 */ "Next", + /* 105 */ "IdxInsert", + /* 106 */ "Distinct", + /* 107 */ "Insert", + /* 108 */ "Destroy", + /* 109 */ "ReadCookie", + /* 110 */ "ForceInt", + /* 111 */ "LoadAnalysis", + /* 112 */ "OpenVirtual", + /* 113 */ "Explain", + /* 114 */ "OpenPseudo", + /* 115 */ "Null", + /* 116 */ "Blob", + /* 117 */ "MemStore", + /* 118 */ "Rewind", + /* 119 */ "MoveGe", + /* 120 */ "Found", + /* 121 */ "NullRow", + /* 122 */ "NotUsed_122", + /* 123 */ "NotUsed_123", + /* 124 */ "NotUsed_124", /* 125 */ "NotUsed_125", /* 126 */ "NotUsed_126", /* 127 */ "NotUsed_127", - /* 128 */ "Real", - /* 129 */ "HexBlob", + /* 128 */ "NotUsed_128", + /* 129 */ "NotUsed_129", + /* 130 */ "NotUsed_130", + /* 131 */ "NotUsed_131", + /* 132 */ "NotUsed_132", + /* 133 */ "Real", + /* 134 */ "HexBlob", }; #endif ======================================================================== --- sqlite/opcodes.h c350694b63ef80daafa7d04f71a6d921aa4935e2 +++ sqlite/opcodes.h 1848e78f249e09e0b773754679d6584412f8900f @@ -1,144 +1,149 @@ /* Automatically generated. Do not edit */ /* See the mkopcodeh.awk script for details */ #define OP_MemLoad 1 -#define OP_HexBlob 129 /* same as TK_BLOB */ +#define OP_HexBlob 134 /* same as TK_BLOB */ #define OP_Column 2 #define OP_SetCookie 3 #define OP_IfMemPos 4 -#define OP_Real 128 /* same as TK_FLOAT */ -#define OP_MoveGt 5 -#define OP_Ge 75 /* same as TK_GE */ -#define OP_AggFocus 6 +#define OP_Real 133 /* same as TK_FLOAT */ +#define OP_Sequence 5 +#define OP_MoveGt 6 +#define OP_Ge 80 /* same as TK_GE */ #define OP_RowKey 7 -#define OP_AggNext 8 -#define OP_Eq 71 /* same as TK_EQ */ -#define OP_OpenWrite 9 -#define OP_NotNull 69 /* same as TK_NOTNULL */ -#define OP_If 10 -#define OP_String8 90 /* same as TK_STRING */ +#define OP_Eq 76 /* same as TK_EQ */ +#define OP_OpenWrite 8 +#define OP_NotNull 74 /* same as TK_NOTNULL */ +#define OP_If 9 +#define OP_ToInt 10 +#define OP_String8 95 /* same as TK_STRING */ #define OP_Pop 11 -#define OP_AggContextPush 12 -#define OP_CollSeq 13 -#define OP_OpenRead 14 -#define OP_Expire 15 -#define OP_SortReset 16 -#define OP_AutoCommit 17 -#define OP_Gt 72 /* same as TK_GT */ -#define OP_Sort 18 -#define OP_ListRewind 19 -#define OP_IntegrityCk 20 -#define OP_SortInsert 21 -#define OP_Function 22 -#define OP_And 63 /* same as TK_AND */ -#define OP_Subtract 82 /* same as TK_MINUS */ -#define OP_Noop 23 -#define OP_Return 24 -#define OP_Remainder 85 /* same as TK_REM */ -#define OP_NewRowid 25 -#define OP_Multiply 83 /* same as TK_STAR */ -#define OP_Variable 26 -#define OP_String 27 -#define OP_ParseSchema 28 -#define OP_AggFunc 29 -#define OP_Close 30 -#define OP_ListWrite 31 -#define OP_CreateIndex 32 -#define OP_IsUnique 33 -#define OP_IdxIsNull 34 -#define OP_NotFound 35 -#define OP_MustBeInt 36 -#define OP_Halt 37 -#define OP_Rowid 38 -#define OP_IdxLT 39 -#define OP_AddImm 40 -#define OP_Statement 41 -#define OP_RowData 42 -#define OP_MemMax 43 -#define OP_Push 44 -#define OP_Or 62 /* same as TK_OR */ -#define OP_NotExists 45 -#define OP_OpenTemp 46 -#define OP_MemIncr 47 -#define OP_Gosub 48 -#define OP_Divide 84 /* same as TK_SLASH */ -#define OP_AggSet 49 -#define OP_Integer 50 -#define OP_SortNext 51 -#define OP_Prev 52 -#define OP_Concat 86 /* same as TK_CONCAT */ -#define OP_BitAnd 77 /* same as TK_BITAND */ -#define OP_CreateTable 53 -#define OP_Last 54 -#define OP_IsNull 68 /* same as TK_ISNULL */ -#define OP_IdxRowid 55 -#define OP_ShiftRight 80 /* same as TK_RSHIFT */ -#define OP_ResetCount 56 -#define OP_Callback 57 -#define OP_ContextPush 58 -#define OP_DropTrigger 59 -#define OP_DropIndex 60 -#define OP_IdxGE 61 -#define OP_IdxDelete 65 -#define OP_Vacuum 66 -#define OP_MoveLe 67 -#define OP_IfNot 76 -#define OP_DropTable 88 -#define OP_MakeRecord 91 -#define OP_Delete 92 -#define OP_AggContextPop 93 -#define OP_ListRead 94 -#define OP_ListReset 95 -#define OP_ShiftLeft 79 /* same as TK_LSHIFT */ -#define OP_Dup 96 -#define OP_Goto 97 -#define OP_Clear 98 -#define OP_IdxGT 99 -#define OP_MoveLt 100 -#define OP_Le 73 /* same as TK_LE */ -#define OP_VerifyCookie 101 -#define OP_Pull 102 -#define OP_Not 64 /* same as TK_NOT */ -#define OP_SetNumColumns 103 -#define OP_AbsValue 104 -#define OP_Transaction 105 -#define OP_Negative 87 /* same as TK_UMINUS */ -#define OP_Ne 70 /* same as TK_NE */ -#define OP_AggGet 106 -#define OP_ContextPop 107 -#define OP_BitOr 78 /* same as TK_BITOR */ -#define OP_Next 108 -#define OP_AggInit 109 -#define OP_IdxInsert 110 -#define OP_Distinct 111 -#define OP_Lt 74 /* same as TK_LT */ -#define OP_AggReset 112 -#define OP_Insert 113 -#define OP_Destroy 114 -#define OP_ReadCookie 115 -#define OP_ForceInt 116 -#define OP_OpenPseudo 117 -#define OP_Null 118 -#define OP_Blob 119 -#define OP_Add 81 /* same as TK_PLUS */ -#define OP_MemStore 120 -#define OP_Rewind 121 -#define OP_MoveGe 122 -#define OP_BitNot 89 /* same as TK_BITNOT */ -#define OP_Found 123 -#define OP_NullRow 124 +#define OP_CollSeq 12 +#define OP_OpenRead 13 +#define OP_Expire 14 +#define OP_AutoCommit 15 +#define OP_Gt 77 /* same as TK_GT */ +#define OP_IntegrityCk 16 +#define OP_Sort 17 +#define OP_Function 18 +#define OP_And 68 /* same as TK_AND */ +#define OP_Subtract 87 /* same as TK_MINUS */ +#define OP_Noop 19 +#define OP_Return 20 +#define OP_Remainder 90 /* same as TK_REM */ +#define OP_NewRowid 21 +#define OP_Multiply 88 /* same as TK_STAR */ +#define OP_Variable 22 +#define OP_String 23 +#define OP_ParseSchema 24 +#define OP_Close 25 +#define OP_CreateIndex 26 +#define OP_IsUnique 27 +#define OP_IdxIsNull 28 +#define OP_NotFound 29 +#define OP_Int64 30 +#define OP_MustBeInt 31 +#define OP_Halt 32 +#define OP_Rowid 33 +#define OP_IdxLT 34 +#define OP_AddImm 35 +#define OP_Statement 36 +#define OP_RowData 37 +#define OP_MemMax 38 +#define OP_Push 39 +#define OP_Or 67 /* same as TK_OR */ +#define OP_NotExists 40 +#define OP_MemIncr 41 +#define OP_Gosub 42 +#define OP_Divide 89 /* same as TK_SLASH */ +#define OP_Integer 43 +#define OP_ToNumeric 44 +#define OP_Prev 45 +#define OP_Concat 91 /* same as TK_CONCAT */ +#define OP_BitAnd 82 /* same as TK_BITAND */ +#define OP_CreateTable 46 +#define OP_Last 47 +#define OP_IsNull 73 /* same as TK_ISNULL */ +#define OP_IdxRowid 48 +#define OP_MakeIdxRec 49 +#define OP_ShiftRight 85 /* same as TK_RSHIFT */ +#define OP_ResetCount 50 +#define OP_FifoWrite 51 +#define OP_Callback 52 +#define OP_ContextPush 53 +#define OP_DropTrigger 54 +#define OP_DropIndex 55 +#define OP_IdxGE 56 +#define OP_IdxDelete 57 +#define OP_Vacuum 58 +#define OP_MoveLe 59 +#define OP_IfNot 60 +#define OP_DropTable 61 +#define OP_MakeRecord 62 +#define OP_ToBlob 63 +#define OP_Delete 64 +#define OP_AggFinal 65 +#define OP_ShiftLeft 84 /* same as TK_LSHIFT */ +#define OP_Dup 66 +#define OP_Goto 70 +#define OP_FifoRead 71 +#define OP_Clear 72 +#define OP_IdxGT 81 +#define OP_MoveLt 93 +#define OP_Le 78 /* same as TK_LE */ +#define OP_VerifyCookie 96 +#define OP_AggStep 97 +#define OP_Pull 98 +#define OP_ToText 99 +#define OP_Not 69 /* same as TK_NOT */ +#define OP_SetNumColumns 100 +#define OP_AbsValue 101 +#define OP_Transaction 102 +#define OP_Negative 92 /* same as TK_UMINUS */ +#define OP_Ne 75 /* same as TK_NE */ +#define OP_ContextPop 103 +#define OP_BitOr 83 /* same as TK_BITOR */ +#define OP_Next 104 +#define OP_IdxInsert 105 +#define OP_Distinct 106 +#define OP_Lt 79 /* same as TK_LT */ +#define OP_Insert 107 +#define OP_Destroy 108 +#define OP_ReadCookie 109 +#define OP_ForceInt 110 +#define OP_LoadAnalysis 111 +#define OP_OpenVirtual 112 +#define OP_Explain 113 +#define OP_OpenPseudo 114 +#define OP_Null 115 +#define OP_Blob 116 +#define OP_Add 86 /* same as TK_PLUS */ +#define OP_MemStore 117 +#define OP_Rewind 118 +#define OP_MoveGe 119 +#define OP_BitNot 94 /* same as TK_BITNOT */ +#define OP_Found 120 +#define OP_NullRow 121 /* The following opcode values are never used */ +#define OP_NotUsed_122 122 +#define OP_NotUsed_123 123 +#define OP_NotUsed_124 124 #define OP_NotUsed_125 125 #define OP_NotUsed_126 126 #define OP_NotUsed_127 127 +#define OP_NotUsed_128 128 +#define OP_NotUsed_129 129 +#define OP_NotUsed_130 130 +#define OP_NotUsed_131 131 +#define OP_NotUsed_132 132 -#define NOPUSH_MASK_0 65400 -#define NOPUSH_MASK_1 61871 -#define NOPUSH_MASK_2 64446 -#define NOPUSH_MASK_3 65363 -#define NOPUSH_MASK_4 65535 -#define NOPUSH_MASK_5 46015 -#define NOPUSH_MASK_6 64254 -#define NOPUSH_MASK_7 7987 +#define NOPUSH_MASK_0 65368 +#define NOPUSH_MASK_1 47898 +#define NOPUSH_MASK_2 47069 +#define NOPUSH_MASK_3 49148 +#define NOPUSH_MASK_4 65403 +#define NOPUSH_MASK_5 30719 +#define NOPUSH_MASK_6 53215 +#define NOPUSH_MASK_7 997 #define NOPUSH_MASK_8 0 #define NOPUSH_MASK_9 0 ======================================================================== --- sqlite/os.h c4b34bd4d6fea51a420f337468b907f4edecb161 +++ sqlite/os.h c51f2747f7bd1840447e2c7d26db749604626814 @@ -161,8 +161,13 @@ ** 1GB boundary. ** */ +#ifndef SQLITE_TEST #define PENDING_BYTE 0x40000000 /* First byte past the 1GB boundary */ -/* #define PENDING_BYTE 0x5400 // Page 22 - for testing */ +#else +extern unsigned int sqlite3_pending_byte; +#define PENDING_BYTE sqlite3_pending_byte +#endif + #define RESERVED_BYTE (PENDING_BYTE+1) #define SHARED_FIRST (PENDING_BYTE+2) #define SHARED_SIZE 510 @@ -181,7 +186,7 @@ int sqlite3OsRead(OsFile*, void*, int amt); int sqlite3OsWrite(OsFile*, const void*, int amt); int sqlite3OsSeek(OsFile*, i64 offset); -int sqlite3OsSync(OsFile*); +int sqlite3OsSync(OsFile*, int); int sqlite3OsTruncate(OsFile*, i64 size); int sqlite3OsFileSize(OsFile*, i64 *pSize); char *sqlite3OsFullPathname(const char*); ======================================================================== --- sqlite/os_common.h 0e7f428ba0a6c40a61bc56c4e96f493231301b73 +++ sqlite/os_common.h 1ff88c7e7e6bd3e5f85443106c91cc26a4f8600b @@ -28,6 +28,14 @@ #endif +/* + * When testing, this global variable stores the location of the + * pending-byte in the database file. + */ +#ifdef SQLITE_TEST +unsigned int sqlite3_pending_byte = 0x40000000; +#endif + int sqlite3_os_trace = 0; #ifdef SQLITE_DEBUG static int last_page = 0; @@ -82,6 +90,7 @@ #ifdef SQLITE_TEST int sqlite3_io_error_pending = 0; int sqlite3_diskfull_pending = 0; +int sqlite3_diskfull = 0; #define SimulateIOError(A) \ if( sqlite3_io_error_pending ) \ if( sqlite3_io_error_pending-- == 1 ){ local_ioerr(); return A; } @@ -89,8 +98,15 @@ sqlite3_io_error_pending = 0; /* Really just a place to set a breakpoint */ } #define SimulateDiskfullError \ - if( sqlite3_diskfull_pending ) \ - if( sqlite3_diskfull_pending-- == 1 ){ local_ioerr(); return SQLITE_FULL; } + if( sqlite3_diskfull_pending ){ \ + if( sqlite3_diskfull_pending == 1 ){ \ + local_ioerr(); \ + sqlite3_diskfull = 1; \ + return SQLITE_FULL; \ + }else{ \ + sqlite3_diskfull_pending--; \ + } \ + } #else #define SimulateIOError(A) #define SimulateDiskfullError ======================================================================== --- sqlite/os_unix.c 45540d7ee5095566da6685d584598edee5be857c +++ sqlite/os_unix.c c86cf43b7ca9200e6fb7bc202ad2cc7da2f69367 @@ -18,6 +18,7 @@ #include +#include #include #include @@ -57,24 +58,35 @@ #endif /* -** Macros used to determine whether or not to use threads. The -** SQLITE_UNIX_THREADS macro is defined if we are synchronizing for -** Posix threads and SQLITE_W32_THREADS is defined if we are -** synchronizing using Win32 threads. +** Include code that is common to all os_*.c files */ -#if defined(THREADSAFE) && THREADSAFE -# include -# define SQLITE_UNIX_THREADS 1 +#include "os_common.h" + +/* +** The threadid macro resolves to the thread-id or to 0. Used for +** testing and debugging only. +*/ +#ifdef SQLITE_UNIX_THREADS +#define threadid pthread_self() +#else +#define threadid 0 #endif - /* -** Include code that is common to all os_*.c files +** Set or check the OsFile.tid field. This field is set when an OsFile +** is first opened. All subsequent uses of the OsFile verify that the +** same thread is operating on the OsFile. Some operating systems do +** not allow locks to be overridden by other threads and that restriction +** means that sqlite3* database handles cannot be moved from one thread +** to another. This logic makes sure a user does not try to do that +** by mistake. */ -#include "os_common.h" - -#if defined(THREADSAFE) && THREADSAFE && defined(__linux__) -#define getpid pthread_self +#ifdef SQLITE_UNIX_THREADS +# define SET_THREADID(X) X->tid = pthread_self() +# define CHECK_THREADID(X) (!pthread_equal(X->tid, pthread_self())) +#else +# define SET_THREADID(X) +# define CHECK_THREADID(X) 0 #endif /* @@ -264,7 +276,66 @@ int result; /* Result of the locking operation */ }; +#ifdef SQLITE_LOCK_TRACE /* +** Print out information about all locking operations. +** +** This routine is used for troubleshooting locks on multithreaded +** platforms. Enable by compiling with the -DSQLITE_LOCK_TRACE +** command-line option on the compiler. This code is normally +** turnned off. +*/ +static int lockTrace(int fd, int op, struct flock *p){ + char *zOpName, *zType; + int s; + int savedErrno; + if( op==F_GETLK ){ + zOpName = "GETLK"; + }else if( op==F_SETLK ){ + zOpName = "SETLK"; + }else{ + s = fcntl(fd, op, p); + sqlite3DebugPrintf("fcntl unknown %d %d %d\n", fd, op, s); + return s; + } + if( p->l_type==F_RDLCK ){ + zType = "RDLCK"; + }else if( p->l_type==F_WRLCK ){ + zType = "WRLCK"; + }else if( p->l_type==F_UNLCK ){ + zType = "UNLCK"; + }else{ + assert( 0 ); + } + assert( p->l_whence==SEEK_SET ); + s = fcntl(fd, op, p); + savedErrno = errno; + sqlite3DebugPrintf("fcntl %d %d %s %s %d %d %d %d\n", + threadid, fd, zOpName, zType, (int)p->l_start, (int)p->l_len, + (int)p->l_pid, s); + if( s && op==F_SETLK && (p->l_type==F_RDLCK || p->l_type==F_WRLCK) ){ + struct flock l2; + l2 = *p; + fcntl(fd, F_GETLK, &l2); + if( l2.l_type==F_RDLCK ){ + zType = "RDLCK"; + }else if( l2.l_type==F_WRLCK ){ + zType = "WRLCK"; + }else if( l2.l_type==F_UNLCK ){ + zType = "UNLCK"; + }else{ + assert( 0 ); + } + sqlite3DebugPrintf("fcntl-failure-reason: %s %d %d %d\n", + zType, (int)l2.l_start, (int)l2.l_len, (int)l2.l_pid); + } + errno = savedErrno; + return s; +} +#define fcntl lockTrace +#endif /* SQLITE_LOCK_TRACE */ + +/* ** The testThreadLockingBehavior() routine launches two separate ** threads on this routine. This routine attempts to lock a file ** descriptor then returns. The success or failure of that attempt @@ -443,6 +514,7 @@ int rc; assert( !id->isOpen ); id->dirfd = -1; + SET_THREADID(id); id->h = open(zFilename, O_RDWR|O_CREAT|O_LARGEFILE|O_BINARY, SQLITE_DEFAULT_FILE_PERMISSIONS); if( id->h<0 ){ @@ -494,9 +566,11 @@ if( access(zFilename, 0)==0 ){ return SQLITE_CANTOPEN; } + SET_THREADID(id); id->dirfd = -1; id->h = open(zFilename, - O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW|O_LARGEFILE|O_BINARY, 0600); + O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW|O_LARGEFILE|O_BINARY, + SQLITE_DEFAULT_FILE_PERMISSIONS); if( id->h<0 ){ return SQLITE_CANTOPEN; } @@ -528,6 +602,7 @@ int sqlite3OsOpenReadOnly(const char *zFilename, OsFile *id){ int rc; assert( !id->isOpen ); + SET_THREADID(id); id->dirfd = -1; id->h = open(zFilename, O_RDONLY|O_LARGEFILE|O_BINARY); if( id->h<0 ){ @@ -572,6 +647,7 @@ ** open. */ return SQLITE_CANTOPEN; } + SET_THREADID(id); assert( id->dirfd<0 ); id->dirfd = open(zDirname, O_RDONLY|O_BINARY, 0); if( id->dirfd<0 ){ @@ -696,6 +772,9 @@ int sqlite3OsSeek(OsFile *id, i64 offset){ assert( id->isOpen ); SEEK(offset/1024 + 1); +#ifdef SQLITE_TEST + if( offset ) SimulateDiskfullError +#endif lseek(id->h, offset, SEEK_SET); return SQLITE_OK; } @@ -721,7 +800,7 @@ ** enabled, however, since with SQLITE_NO_SYNC enabled, an OS crash ** or power failure will likely corrupt the database file. */ -static int full_fsync(int fd, int fullSync){ +static int full_fsync(int fd, int fullSync, int dataOnly){ int rc; /* Record the number of times that we do a normal fsync() and @@ -750,7 +829,11 @@ if( rc ) rc = fsync(fd); #else - rc = fsync(fd); + if( dataOnly ){ + rc = fdatasync(fd); + }else{ + rc = fsync(fd); + } #endif /* defined(F_FULLFSYNC) */ #endif /* defined(SQLITE_NO_SYNC) */ @@ -760,6 +843,10 @@ /* ** Make sure all writes to a particular file are committed to disk. ** +** If dataOnly==0 then both the file itself and its metadata (file +** size, access time, etc) are synced. If dataOnly!=0 then only the +** file data is synced. +** ** Under Unix, also make sure that the directory entry for the file ** has been created by fsync-ing the directory that contains the file. ** If we do not do this and we encounter a power failure, the directory @@ -768,16 +855,16 @@ ** the directory entry for the journal was never created) and the transaction ** will not roll back - possibly leading to database corruption. */ -int sqlite3OsSync(OsFile *id){ +int sqlite3OsSync(OsFile *id, int dataOnly){ assert( id->isOpen ); SimulateIOError(SQLITE_IOERR); TRACE2("SYNC %-3d\n", id->h); - if( full_fsync(id->h, id->fullSync) ){ + if( full_fsync(id->h, id->fullSync, dataOnly) ){ return SQLITE_IOERR; } if( id->dirfd>=0 ){ TRACE2("DIRSYNC %-3d\n", id->dirfd); - full_fsync(id->dirfd, id->fullSync); + full_fsync(id->dirfd, id->fullSync, 0); close(id->dirfd); /* Only need to sync once, so close the directory */ id->dirfd = -1; /* when we are done. */ } @@ -839,6 +926,7 @@ int r = 0; assert( id->isOpen ); + if( CHECK_THREADID(id) ) return SQLITE_MISUSE; sqlite3OsEnterMutex(); /* Needed because id->pLock is shared across threads */ /* Check if a thread in this process holds such a lock */ @@ -956,6 +1044,7 @@ TRACE7("LOCK %d %s was %s(%s,%d) pid=%d\n", id->h, locktypeName(locktype), locktypeName(id->locktype), locktypeName(pLock->locktype), pLock->cnt ,getpid() ); + if( CHECK_THREADID(id) ) return SQLITE_MISUSE; /* If there is already a lock of this type or more restrictive on the ** OsFile, do nothing. Don't use the end_lock: exit path, as @@ -1002,6 +1091,7 @@ } lock.l_len = 1L; + lock.l_whence = SEEK_SET; /* A PENDING lock is needed before acquiring a SHARED lock and before @@ -1037,7 +1127,10 @@ lock.l_start = PENDING_BYTE; lock.l_len = 1L; lock.l_type = F_UNLCK; - fcntl(id->h, F_SETLK, &lock); + if( fcntl(id->h, F_SETLK, &lock)!=0 ){ + rc = SQLITE_IOERR; /* This should never happen */ + goto end_lock; + } if( s ){ rc = (errno==EINVAL) ? SQLITE_NOLFS : SQLITE_BUSY; }else{ @@ -1107,6 +1200,7 @@ assert( id->isOpen ); TRACE7("UNLOCK %d %d was %d(%d,%d) pid=%d\n", id->h, locktype, id->locktype, id->pLock->locktype, id->pLock->cnt, getpid()); + if( CHECK_THREADID(id) ) return SQLITE_MISUSE; assert( locktype<=SHARED_LOCK ); if( id->locktype<=locktype ){ @@ -1131,8 +1225,11 @@ lock.l_whence = SEEK_SET; lock.l_start = PENDING_BYTE; lock.l_len = 2L; assert( PENDING_BYTE+1==RESERVED_BYTE ); - fcntl(id->h, F_SETLK, &lock); - pLock->locktype = SHARED_LOCK; + if( fcntl(id->h, F_SETLK, &lock)==0 ){ + pLock->locktype = SHARED_LOCK; + }else{ + rc = SQLITE_IOERR; /* This should never happen */ + } } if( locktype==NO_LOCK ){ struct openCnt *pOpen; @@ -1146,8 +1243,11 @@ lock.l_type = F_UNLCK; lock.l_whence = SEEK_SET; lock.l_start = lock.l_len = 0L; - fcntl(id->h, F_SETLK, &lock); - pLock->locktype = NO_LOCK; + if( fcntl(id->h, F_SETLK, &lock)==0 ){ + pLock->locktype = NO_LOCK; + }else{ + rc = SQLITE_IOERR; /* This should never happen */ + } } /* Decrement the count of locks against this same file. When the @@ -1177,6 +1277,7 @@ */ int sqlite3OsClose(OsFile *id){ if( !id->isOpen ) return SQLITE_OK; + if( CHECK_THREADID(id) ) return SQLITE_MISUSE; sqlite3OsUnlock(id, NO_LOCK); if( id->dirfd>=0 ) close(id->dirfd); id->dirfd = -1; @@ -1189,13 +1290,13 @@ */ int *aNew; struct openCnt *pOpen = id->pOpen; - pOpen->nPending++; - aNew = sqliteRealloc( pOpen->aPending, pOpen->nPending*sizeof(int) ); + aNew = sqliteRealloc( pOpen->aPending, (pOpen->nPending+1)*sizeof(int) ); if( aNew==0 ){ /* If a malloc fails, just leak the file descriptor */ }else{ pOpen->aPending = aNew; - pOpen->aPending[pOpen->nPending-1] = id->h; + pOpen->aPending[pOpen->nPending] = id->h; + pOpen->nPending++; } }else{ /* There are no outstanding locks so we can close the file immediately */ @@ -1221,10 +1322,14 @@ if( zRelative[0]=='/' ){ sqlite3SetString(&zFull, zRelative, (char*)0); }else{ - char zBuf[5000]; + char *zBuf = sqliteMalloc(5000); + if( zBuf==0 ){ + return 0; + } zBuf[0] = 0; - sqlite3SetString(&zFull, getcwd(zBuf, sizeof(zBuf)), "/", zRelative, + sqlite3SetString(&zFull, getcwd(zBuf, 5000), "/", zRelative, (char*)0); + sqliteFree(zBuf); } return zFull; } @@ -1331,9 +1436,16 @@ ** return 0. Return 1 if the time and date cannot be found. */ int sqlite3OsCurrentTime(double *prNow){ +#ifdef NO_GETTOD time_t t; time(&t); *prNow = t/86400.0 + 2440587.5; +#else + struct timeval sNow; + struct timezone sTz; /* Not used */ + gettimeofday(&sNow, &sTz); + *prNow = 2440587.5 + sNow.tv_sec/86400.0 + sNow.tv_usec/86400000000.0; +#endif #ifdef SQLITE_TEST if( sqlite3_current_time ){ *prNow = sqlite3_current_time/86400.0 + 2440587.5; ======================================================================== --- sqlite/os_unix.h 39a393252e69e72b06715c9958df05ddbc4aa971 +++ sqlite/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e @@ -52,6 +52,17 @@ #include /* +** Macros used to determine whether or not to use threads. The +** SQLITE_UNIX_THREADS macro is defined if we are synchronizing for +** Posix threads and SQLITE_W32_THREADS is defined if we are +** synchronizing using Win32 threads. +*/ +#if defined(THREADSAFE) && THREADSAFE +# include +# define SQLITE_UNIX_THREADS 1 +#endif + +/* ** The OsFile structure is a operating-system independing representation ** of an open file handle. It is defined differently for each architecture. ** @@ -70,6 +81,9 @@ unsigned char isOpen; /* True if needs to be closed */ unsigned char fullSync; /* Use F_FULLSYNC if available */ int dirfd; /* File descriptor for the directory */ +#ifdef SQLITE_UNIX_THREADS + pthread_t tid; /* The thread authorized to use this OsFile */ +#endif }; /* ======================================================================== --- sqlite/os_win.c fe7b99cfcfb61d9bf54493ddf5857885a657fb89 +++ sqlite/os_win.c ed03a35b2894f9b99840415f941a9f8594dea756 @@ -42,10 +42,98 @@ #ifndef SQLITE_OMIT_DISKIO /* +** The following variable is (normally) set once and never changes +** thereafter. It records whether the operating system is Win95 +** or WinNT. +** +** 0: Operating system unknown. +** 1: Operating system is Win95. +** 2: Operating system is WinNT. +** +** In order to facilitate testing on a WinNT system, the test fixture +** can manually set this value to 1 to emulate Win98 behavior. +*/ +int sqlite3_os_type = 0; + +/* +** Return true (non-zero) if we are running under WinNT, Win2K or WinXP. +** Return false (zero) for Win95, Win98, or WinME. +** +** Here is an interesting observation: Win95, Win98, and WinME lack +** the LockFileEx() API. But we can still statically link against that +** API as long as we don't call it win running Win95/98/ME. A call to +** this routine is used to determine if the host is Win95/98/ME or +** WinNT/2K/XP so that we will know whether or not we can safely call +** the LockFileEx() API. +*/ +static int isNT(void){ + if( sqlite3_os_type==0 ){ + OSVERSIONINFO sInfo; + sInfo.dwOSVersionInfoSize = sizeof(sInfo); + GetVersionEx(&sInfo); + sqlite3_os_type = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1; + } + return sqlite3_os_type==2; +} + +/* +** Convert a UTF-8 string to UTF-32. Space to hold the returned string +** is obtained from sqliteMalloc. +*/ +static WCHAR *utf8ToUnicode(const char *zFilename){ + int nByte; + WCHAR *zWideFilename; + + if( !isNT() ){ + return 0; + } + nByte = MultiByteToWideChar(CP_UTF8, 0, zFilename, -1, NULL, 0)*sizeof(WCHAR); + zWideFilename = sqliteMalloc( nByte*sizeof(zWideFilename[0]) ); + if( zWideFilename==0 ){ + return 0; + } + nByte = MultiByteToWideChar(CP_UTF8, 0, zFilename, -1, zWideFilename, nByte); + if( nByte==0 ){ + sqliteFree(zWideFilename); + zWideFilename = 0; + } + return zWideFilename; +} + +/* +** Convert UTF-32 to UTF-8. Space to hold the returned string is +** obtained from sqliteMalloc(). +*/ +static char *unicodeToUtf8(const WCHAR *zWideFilename){ + int nByte; + char *zFilename; + + nByte = WideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, 0, 0, 0, 0); + zFilename = sqliteMalloc( nByte ); + if( zFilename==0 ){ + return 0; + } + nByte = WideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, zFilename, nByte, + 0, 0); + if( nByte == 0 ){ + sqliteFree(zFilename); + zFilename = 0; + } + return zFilename; +} + + +/* ** Delete the named file */ int sqlite3OsDelete(const char *zFilename){ - DeleteFileA(zFilename); + WCHAR *zWide = utf8ToUnicode(zFilename); + if( zWide ){ + DeleteFileW(zWide); + sqliteFree(zWide); + }else{ + DeleteFileA(zFilename); + } TRACE2("DELETE \"%s\"\n", zFilename); return SQLITE_OK; } @@ -54,7 +142,15 @@ ** Return TRUE if the named file exists. */ int sqlite3OsFileExists(const char *zFilename){ - return GetFileAttributesA(zFilename) != 0xffffffff; + int exists = 0; + WCHAR *zWide = utf8ToUnicode(zFilename); + if( zWide ){ + exists = GetFileAttributesW(zWide) != 0xffffffff; + sqliteFree(zWide); + }else{ + exists = GetFileAttributesA(zFilename) != 0xffffffff; + } + return exists; } /* @@ -76,30 +172,60 @@ int *pReadonly ){ HANDLE h; + WCHAR *zWide = utf8ToUnicode(zFilename); assert( !id->isOpen ); - h = CreateFileA(zFilename, - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, - NULL - ); - if( h==INVALID_HANDLE_VALUE ){ + if( zWide ){ + h = CreateFileW(zWide, + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, + NULL + ); + if( h==INVALID_HANDLE_VALUE ){ + h = CreateFileW(zWide, + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, + NULL + ); + if( h==INVALID_HANDLE_VALUE ){ + sqliteFree(zWide); + return SQLITE_CANTOPEN; + } + *pReadonly = 1; + }else{ + *pReadonly = 0; + } + sqliteFree(zWide); + }else{ h = CreateFileA(zFilename, - GENERIC_READ, - FILE_SHARE_READ, + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL ); if( h==INVALID_HANDLE_VALUE ){ - return SQLITE_CANTOPEN; + h = CreateFileA(zFilename, + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, + NULL + ); + if( h==INVALID_HANDLE_VALUE ){ + return SQLITE_CANTOPEN; + } + *pReadonly = 1; + }else{ + *pReadonly = 0; } - *pReadonly = 1; - }else{ - *pReadonly = 0; } id->h = h; id->locktype = NO_LOCK; @@ -128,6 +254,7 @@ int sqlite3OsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){ HANDLE h; int fileflags; + WCHAR *zWide = utf8ToUnicode(zFilename); assert( !id->isOpen ); if( delFlag ){ fileflags = FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_RANDOM_ACCESS @@ -135,14 +262,26 @@ }else{ fileflags = FILE_FLAG_RANDOM_ACCESS; } - h = CreateFileA(zFilename, - GENERIC_READ | GENERIC_WRITE, - 0, - NULL, - CREATE_ALWAYS, - fileflags, - NULL - ); + if( zWide ){ + h = CreateFileW(zWide, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + CREATE_ALWAYS, + fileflags, + NULL + ); + sqliteFree(zWide); + }else{ + h = CreateFileA(zFilename, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + CREATE_ALWAYS, + fileflags, + NULL + ); + } if( h==INVALID_HANDLE_VALUE ){ return SQLITE_CANTOPEN; } @@ -164,15 +303,28 @@ */ int sqlite3OsOpenReadOnly(const char *zFilename, OsFile *id){ HANDLE h; + WCHAR *zWide = utf8ToUnicode(zFilename); assert( !id->isOpen ); - h = CreateFileA(zFilename, - GENERIC_READ, - 0, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, - NULL - ); + if( zWide ){ + h = CreateFileW(zWide, + GENERIC_READ, + 0, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, + NULL + ); + sqliteFree(zWide); + }else{ + h = CreateFileA(zFilename, + GENERIC_READ, + 0, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, + NULL + ); + } if( h==INVALID_HANDLE_VALUE ){ return SQLITE_CANTOPEN; } @@ -229,6 +381,16 @@ if( sqlite3_temp_directory ){ strncpy(zTempPath, sqlite3_temp_directory, SQLITE_TEMPNAME_SIZE-30); zTempPath[SQLITE_TEMPNAME_SIZE-30] = 0; + }else if( isNT() ){ + char *zMulti; + WCHAR zWidePath[SQLITE_TEMPNAME_SIZE]; + GetTempPathW(SQLITE_TEMPNAME_SIZE-30, zWidePath); + zMulti = unicodeToUtf8(zWidePath); + if( zMulti ){ + strncpy(zTempPath, zMulti, SQLITE_TEMPNAME_SIZE-30); + zTempPath[SQLITE_TEMPNAME_SIZE-30] = 0; + sqliteFree(zMulti); + } }else{ GetTempPathA(SQLITE_TEMPNAME_SIZE-30, zTempPath); } @@ -311,16 +473,22 @@ LONG lowerBits = offset & 0xffffffff; DWORD rc; assert( id->isOpen ); +#ifdef SQLITE_TEST + if( offset ) SimulateDiskfullError +#endif SEEK(offset/1024 + 1); rc = SetFilePointer(id->h, lowerBits, &upperBits, FILE_BEGIN); TRACE3("SEEK %d %lld\n", id->h, offset); + if( rc==INVALID_SET_FILE_POINTER && GetLastError()!=NO_ERROR ){ + return SQLITE_FULL; + } return SQLITE_OK; } /* ** Make sure all writes to a particular file are committed to disk. */ -int sqlite3OsSync(OsFile *id){ +int sqlite3OsSync(OsFile *id, int dataOnly){ assert( id->isOpen ); TRACE3("SYNC %d lock=%d\n", id->h, id->locktype); if( FlushFileBuffers(id->h) ){ @@ -365,28 +533,6 @@ } /* -** Return true (non-zero) if we are running under WinNT, Win2K or WinXP. -** Return false (zero) for Win95, Win98, or WinME. -** -** Here is an interesting observation: Win95, Win98, and WinME lack -** the LockFileEx() API. But we can still statically link against that -** API as long as we don't call it win running Win95/98/ME. A call to -** this routine is used to determine if the host is Win95/98/ME or -** WinNT/2K/XP so that we will know whether or not we can safely call -** the LockFileEx() API. -*/ -static int isNT(void){ - static int osType = 0; /* 0=unknown 1=win95 2=winNT */ - if( osType==0 ){ - OSVERSIONINFO sInfo; - sInfo.dwOSVersionInfoSize = sizeof(sInfo); - GetVersionEx(&sInfo); - osType = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1; - } - return osType==2; -} - -/* ** Acquire a reader lock. ** Different API routines are called depending on whether or not this ** is Win95 or WinNT. @@ -426,11 +572,18 @@ ** Check that a given pathname is a directory and is writable ** */ -int sqlite3OsIsDirWritable(char *zBuf){ +int sqlite3OsIsDirWritable(char *zDirname){ int fileAttr; - if(! zBuf ) return 0; - if(! isNT() && strlen(zBuf) > MAX_PATH ) return 0; - fileAttr = GetFileAttributesA(zBuf); + WCHAR *zWide; + if( zDirname==0 ) return 0; + if( !isNT() && strlen(zDirname)>MAX_PATH ) return 0; + zWide = utf8ToUnicode(zDirname); + if( zWide ){ + fileAttr = GetFileAttributesW(zWide); + sqliteFree(zWide); + }else{ + fileAttr = GetFileAttributesA(zDirname); + } if( fileAttr == 0xffffffff ) return 0; if( (fileAttr & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY ){ return 0; @@ -641,6 +794,7 @@ char *sqlite3OsFullPathname(const char *zRelative){ char *zNotUsed; char *zFull; + WCHAR *zWide; int nByte; #ifdef __CYGWIN__ nByte = strlen(zRelative) + MAX_PATH + 1001; @@ -648,10 +802,22 @@ if( zFull==0 ) return 0; if( cygwin_conv_to_full_win32_path(zRelative, zFull) ) return 0; #else - nByte = GetFullPathNameA(zRelative, 0, 0, &zNotUsed) + 1; - zFull = sqliteMalloc( nByte ); - if( zFull==0 ) return 0; - GetFullPathNameA(zRelative, nByte, zFull, &zNotUsed); + zWide = utf8ToUnicode(zRelative); + if( zWide ){ + WCHAR *zTemp, *zNotUsedW; + nByte = GetFullPathNameW(zWide, 0, 0, &zNotUsedW) + 1; + zTemp = sqliteMalloc( nByte*sizeof(zTemp[0]) ); + if( zTemp==0 ) return 0; + GetFullPathNameW(zWide, nByte, zTemp, &zNotUsedW); + sqliteFree(zWide); + zFull = unicodeToUtf8(zTemp); + sqliteFree(zTemp); + }else{ + nByte = GetFullPathNameA(zRelative, 0, 0, &zNotUsed) + 1; + zFull = sqliteMalloc( nByte*sizeof(zFull[0]) ); + if( zFull==0 ) return 0; + GetFullPathNameA(zRelative, nByte, zFull, &zNotUsed); + } #endif return zFull; } ======================================================================== --- sqlite/pager.c 841a2cdddd4275de36cda26ed9dc54ae942660ce +++ sqlite/pager.c adbb27f13ac75cd5bc29a3d84803e0cab1edfa88 @@ -18,7 +18,7 @@ ** file simultaneously, or one process from reading the database while ** another is writing. ** -** @(#) $Id: pager.c,v 1.207 2005/06/07 02:12:30 drh Exp $ +** @(#) $Id: pager.c,v 1.215 2005/09/17 15:20:27 drh Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" @@ -657,8 +657,10 @@ ** file descriptor to the end of the journal header sector. */ if( rc==SQLITE_OK ){ - sqlite3OsSeek(&pPager->jfd, pPager->journalOff-1); - rc = sqlite3OsWrite(&pPager->jfd, "\000", 1); + rc = sqlite3OsSeek(&pPager->jfd, pPager->journalOff-1); + if( rc==SQLITE_OK ){ + rc = sqlite3OsWrite(&pPager->jfd, "\000", 1); + } } return rc; } @@ -779,7 +781,7 @@ if( rc!=SQLITE_OK ) return rc; rc = sqlite3OsWrite(&pPager->jfd, aJournalMagic, sizeof(aJournalMagic)); - pPager->needSync = 1; + pPager->needSync = !pPager->noSync; return rc; } @@ -1038,8 +1040,10 @@ assert( pPager->state>=PAGER_EXCLUSIVE || pPg!=0 ); TRACE3("PLAYBACK %d page %d\n", PAGERID(pPager), pgno); if( pPager->state>=PAGER_EXCLUSIVE && (pPg==0 || pPg->needSync==0) ){ - sqlite3OsSeek(&pPager->fd, (pgno-1)*(i64)pPager->pageSize); - rc = sqlite3OsWrite(&pPager->fd, aData, pPager->pageSize); + rc = sqlite3OsSeek(&pPager->fd, (pgno-1)*(i64)pPager->pageSize); + if( rc==SQLITE_OK ){ + rc = sqlite3OsWrite(&pPager->fd, aData, pPager->pageSize); + } if( pPg ) pPg->dirty = 0; } if( pPg ){ @@ -1168,8 +1172,10 @@ char zBuf[SQLITE_MAX_PAGE_SIZE]; if( !pPg->dirty ) continue; if( (int)pPg->pgno <= pPager->origDbSize ){ - sqlite3OsSeek(&pPager->fd, pPager->pageSize*(i64)(pPg->pgno-1)); - rc = sqlite3OsRead(&pPager->fd, zBuf, pPager->pageSize); + rc = sqlite3OsSeek(&pPager->fd, pPager->pageSize*(i64)(pPg->pgno-1)); + if( rc==SQLITE_OK ){ + rc = sqlite3OsRead(&pPager->fd, zBuf, pPager->pageSize); + } TRACE3("REFETCH %d page %d\n", PAGERID(pPager), pPg->pgno); if( rc ) break; CODEC(pPager, zBuf, pPg->pgno, 2); @@ -1485,7 +1491,7 @@ end_stmt_playback: if( rc!=SQLITE_OK ){ pPager->errMask |= PAGER_ERR_CORRUPT; - rc = SQLITE_CORRUPT; /* bkpt-CORRUPT */ + rc = SQLITE_CORRUPT; }else{ pPager->journalOff = szJ; /* pager_reload_cache(pPager); */ @@ -1746,25 +1752,35 @@ /* ** Return the total number of pages in the disk file associated with -** pPager. +** pPager. +** +** If the PENDING_BYTE lies on the page directly after the end of the +** file, then consider this page part of the file too. For example, if +** PENDING_BYTE is byte 4096 (the first byte of page 5) and the size of the +** file is 4096 bytes, 5 is returned instead of 4. */ int sqlite3pager_pagecount(Pager *pPager){ i64 n; assert( pPager!=0 ); if( pPager->dbSize>=0 ){ - return pPager->dbSize; + n = pPager->dbSize; + } else { + if( sqlite3OsFileSize(&pPager->fd, &n)!=SQLITE_OK ){ + pPager->errMask |= PAGER_ERR_DISK; + return 0; + } + if( n>0 && npageSize ){ + n = 1; + }else{ + n /= pPager->pageSize; + } + if( pPager->state!=PAGER_UNLOCK ){ + pPager->dbSize = n; + } } - if( sqlite3OsFileSize(&pPager->fd, &n)!=SQLITE_OK ){ - pPager->errMask |= PAGER_ERR_DISK; - return 0; - } - n /= pPager->pageSize; - if( !MEMDB && n==PENDING_BYTE/pPager->pageSize ){ + if( n==(PENDING_BYTE/pPager->pageSize) ){ n++; } - if( pPager->state!=PAGER_UNLOCK ){ - pPager->dbSize = n; - } return n; } @@ -1866,7 +1882,7 @@ /* ** Try to obtain a lock on a file. Invoke the busy callback if the lock -** is currently not available. Repeate until the busy callback returns +** is currently not available. Repeat until the busy callback returns ** false or until the lock succeeds. ** ** Return SQLITE_OK on success and an error code if we cannot obtain @@ -1880,14 +1896,9 @@ if( pPager->state>=locktype ){ rc = SQLITE_OK; }else{ - int busy = 1; - BusyHandler *pH; do { rc = sqlite3OsLock(&pPager->fd, locktype); - }while( rc==SQLITE_BUSY && - (pH = pPager->pBusyHandler)!=0 && - pH->xFunc && pH->xFunc(pH->pArg, busy++) - ); + }while( rc==SQLITE_BUSY && sqlite3InvokeBusyHandler(pPager->pBusyHandler) ); if( rc==SQLITE_OK ){ pPager->state = locktype; } @@ -2122,17 +2133,20 @@ */ if( pPager->fullSync ){ TRACE2("SYNC journal of %d\n", PAGERID(pPager)); - rc = sqlite3OsSync(&pPager->jfd); + rc = sqlite3OsSync(&pPager->jfd, 0); if( rc!=0 ) return rc; } - sqlite3OsSeek(&pPager->jfd, pPager->journalHdr + sizeof(aJournalMagic)); + rc = sqlite3OsSeek(&pPager->jfd, + pPager->journalHdr + sizeof(aJournalMagic)); + if( rc ) return rc; rc = write32bits(&pPager->jfd, pPager->nRec); if( rc ) return rc; - sqlite3OsSeek(&pPager->jfd, pPager->journalOff); + rc = sqlite3OsSeek(&pPager->jfd, pPager->journalOff); + if( rc ) return rc; } TRACE2("SYNC journal of %d\n", PAGERID(pPager)); - rc = sqlite3OsSync(&pPager->jfd); + rc = sqlite3OsSync(&pPager->jfd, pPager->fullSync); if( rc!=0 ) return rc; pPager->journalStarted = 1; } @@ -2197,7 +2211,8 @@ while( pList ){ assert( pList->dirty ); - sqlite3OsSeek(&pPager->fd, (pList->pgno-1)*(i64)pPager->pageSize); + rc = sqlite3OsSeek(&pPager->fd, (pList->pgno-1)*(i64)pPager->pageSize); + if( rc ) return rc; /* If there are dirty pages in the page cache with page numbers greater ** than Pager.dbSize, this means sqlite3pager_truncate() was called to ** make the file smaller (presumably by auto-vacuum code). Do not write @@ -2292,8 +2307,8 @@ /* The maximum page number is 2^31. Return SQLITE_CORRUPT if a page ** number greater than this, or zero, is requested. */ - if( pgno>PAGER_MAX_PGNO || pgno==0 ){ - return SQLITE_CORRUPT; + if( pgno>PAGER_MAX_PGNO || pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){ + return SQLITE_CORRUPT_BKPT; } /* Make sure we have not hit any critical errors. @@ -2507,8 +2522,10 @@ }else{ int rc; assert( MEMDB==0 ); - sqlite3OsSeek(&pPager->fd, (pgno-1)*(i64)pPager->pageSize); - rc = sqlite3OsRead(&pPager->fd, PGHDR_TO_DATA(pPg), pPager->pageSize); + rc = sqlite3OsSeek(&pPager->fd, (pgno-1)*(i64)pPager->pageSize); + if( rc==SQLITE_OK ){ + rc = sqlite3OsRead(&pPager->fd, PGHDR_TO_DATA(pPg), pPager->pageSize); + } TRACE3("FETCH %d page %d\n", PAGERID(pPager), pPg->pgno); CODEC(pPager, PGHDR_TO_DATA(pPg), pPg->pgno, 3); if( rc!=SQLITE_OK ){ @@ -2816,6 +2833,10 @@ } }else{ u32 cksum; + /* We should never write to the journal file the page that + ** contains the database locks. The following assert verifies + ** that we do not. */ + assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) ); CODEC(pPager, pData, pPg->pgno, 7); cksum = pager_cksum(pPager, pPg->pgno, pData); saved = *(u32*)PGHDR_TO_EXTRA(pPg, pPager); @@ -3172,7 +3193,7 @@ rc = pager_playback(pPager); } if( rc!=SQLITE_OK ){ - rc = SQLITE_CORRUPT; /* bkpt-CORRUPT */ + rc = SQLITE_CORRUPT_BKPT; pPager->errMask |= PAGER_ERR_CORRUPT; } pPager->dbSize = -1; @@ -3347,6 +3368,14 @@ } /* +** Return true if fsync() calls are disabled for this pager. Return FALSE +** if fsync()s are executed normally. +*/ +int sqlite3pager_nosync(Pager *pPager){ + return pPager->noSync; +} + +/* ** Set the codec for this pager */ void sqlite3pager_set_codec( @@ -3434,8 +3463,9 @@ */ Pgno i; void *pPage; + int iSkip = PAGER_MJ_PGNO(pPager); for( i=nTrunc+1; i<=pPager->origDbSize; i++ ){ - if( !(pPager->aInJournal[i/8] & (1<<(i&7))) ){ + if( !(pPager->aInJournal[i/8] & (1<<(i&7))) && i!=iSkip ){ rc = sqlite3pager_get(pPager, i, &pPage); if( rc!=SQLITE_OK ) goto sync_exit; rc = sqlite3pager_write(pPage); @@ -3465,7 +3495,7 @@ /* Sync the database file. */ if( !pPager->noSync ){ - rc = sqlite3OsSync(&pPager->fd); + rc = sqlite3OsSync(&pPager->fd, 0); } pPager->state = PAGER_SYNCED; ======================================================================== --- sqlite/pager.h 0d9153d6269d60d04af3dd84a0cc0a96253cf4a4 +++ sqlite/pager.h 17b13225abd93c1e9f470060f40a21b9edb5a164 @@ -13,7 +13,7 @@ ** subsystem. The page cache subsystem reads and writes a file a page ** at a time and provides a journal for rollback. ** -** @(#) $Id: pager.h,v 1.44 2005/05/20 20:01:56 drh Exp $ +** @(#) $Id: pager.h,v 1.45 2005/08/27 16:36:49 drh Exp $ */ /* @@ -100,6 +100,7 @@ const char *sqlite3pager_filename(Pager*); const char *sqlite3pager_dirname(Pager*); const char *sqlite3pager_journalname(Pager*); +int sqlite3pager_nosync(Pager*); int sqlite3pager_rename(Pager*, const char *zNewName); void sqlite3pager_set_codec(Pager*,void(*)(void*,void*,Pgno,int),void*); int sqlite3pager_movepage(Pager*,void*,Pgno); ======================================================================== --- sqlite/parse.c 6671523c392fcf8287c08e5896cc2513987fc5cb +++ sqlite/parse.c 9f03b15f12e12a7952705f50d01e3ac97bb81e34 @@ -1,10 +1,10 @@ /* Driver template for the LEMON parser generator. ** The author disclaims copyright to this source code. */ /* First off, code is include which follows the "include" declaration ** in the input file. */ #include -#line 33 "parse.y" +#line 51 "parse.y" #include "sqliteInt.h" #include "parse.h" @@ -93,35 +93,35 @@ ** defined, then do no error processing. */ #define YYCODETYPE unsigned char -#define YYNOCODE 241 +#define YYNOCODE 247 #define YYACTIONTYPE unsigned short int #define sqlite3ParserTOKENTYPE Token typedef union { sqlite3ParserTOKENTYPE yy0; - Expr* yy2; - struct {int value; int mask;} yy47; - SrcList* yy67; - ExprList* yy82; - struct AttachKey yy132; - struct TrigEvent yy210; + struct TrigEvent yy30; + Expr* yy62; + SrcList* yy151; + Token yy198; + struct LimitVal yy220; + struct LikeOp yy222; IdList* yy240; - struct LimitVal yy244; - Token yy258; - TriggerStep* yy347; - int yy412; - struct LikeOp yy438; - Select* yy459; - int yy481; + int yy280; + struct {int value; int mask;} yy359; + TriggerStep* yy360; + struct AttachKey yy361; + Select* yy375; + ExprList* yy418; + int yy493; } YYMINORTYPE; #define YYSTACKDEPTH 100 #define sqlite3ParserARG_SDECL Parse *pParse; #define sqlite3ParserARG_PDECL ,Parse *pParse #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse #define sqlite3ParserARG_STORE yypParser->pParse = pParse -#define YYNSTATE 565 -#define YYNRULE 305 -#define YYERRORSYMBOL 141 -#define YYERRSYMDT yy481 +#define YYNSTATE 581 +#define YYNRULE 311 +#define YYERRORSYMBOL 146 +#define YYERRSYMDT yy493 #define YYFALLBACK 1 #define YY_NO_ACTION (YYNSTATE+YYNRULE+2) #define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) @@ -175,467 +175,485 @@ ** yy_default[] Default action for each state. */ static const YYACTIONTYPE yy_action[] = { - /* 0 */ 259, 65, 257, 112, 114, 110, 116, 66, 122, 124, - /* 10 */ 126, 128, 130, 132, 134, 136, 138, 140, 568, 142, - /* 20 */ 150, 122, 124, 126, 128, 130, 132, 134, 136, 138, - /* 30 */ 140, 130, 132, 134, 136, 138, 140, 108, 94, 143, - /* 40 */ 153, 158, 163, 152, 157, 118, 120, 112, 114, 110, - /* 50 */ 116, 72, 122, 124, 126, 128, 130, 132, 134, 136, - /* 60 */ 138, 140, 7, 106, 219, 258, 122, 124, 126, 128, - /* 70 */ 130, 132, 134, 136, 138, 140, 367, 13, 9, 369, - /* 80 */ 376, 381, 142, 871, 1, 564, 92, 27, 4, 399, - /* 90 */ 363, 384, 844, 341, 291, 28, 10, 95, 398, 33, - /* 100 */ 108, 94, 143, 153, 158, 163, 152, 157, 118, 120, - /* 110 */ 112, 114, 110, 116, 96, 122, 124, 126, 128, 130, - /* 120 */ 132, 134, 136, 138, 140, 456, 565, 142, 395, 305, - /* 130 */ 101, 102, 103, 288, 75, 394, 3, 563, 231, 275, - /* 140 */ 14, 15, 575, 597, 437, 108, 94, 143, 153, 158, - /* 150 */ 163, 152, 157, 118, 120, 112, 114, 110, 116, 13, - /* 160 */ 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, - /* 170 */ 573, 77, 142, 223, 232, 13, 490, 462, 452, 167, - /* 180 */ 306, 169, 170, 276, 254, 3, 563, 81, 277, 183, - /* 190 */ 108, 94, 143, 153, 158, 163, 152, 157, 118, 120, - /* 200 */ 112, 114, 110, 116, 52, 122, 124, 126, 128, 130, - /* 210 */ 132, 134, 136, 138, 140, 48, 54, 799, 448, 51, - /* 220 */ 797, 77, 14, 15, 49, 363, 134, 136, 138, 140, - /* 230 */ 16, 17, 18, 32, 33, 50, 308, 197, 14, 15, - /* 240 */ 367, 261, 13, 369, 376, 381, 142, 37, 337, 40, - /* 250 */ 59, 67, 69, 301, 332, 384, 364, 397, 259, 807, - /* 260 */ 257, 334, 51, 193, 108, 94, 143, 153, 158, 163, - /* 270 */ 152, 157, 118, 120, 112, 114, 110, 116, 262, 122, - /* 280 */ 124, 126, 128, 130, 132, 134, 136, 138, 140, 13, - /* 290 */ 171, 142, 40, 59, 67, 69, 301, 332, 642, 148, - /* 300 */ 365, 159, 164, 261, 334, 14, 15, 44, 45, 108, - /* 310 */ 94, 143, 153, 158, 163, 152, 157, 118, 120, 112, - /* 320 */ 114, 110, 116, 258, 122, 124, 126, 128, 130, 132, - /* 330 */ 134, 136, 138, 140, 148, 218, 159, 164, 184, 12, - /* 340 */ 284, 417, 48, 360, 358, 293, 290, 347, 352, 353, - /* 350 */ 289, 49, 14, 15, 688, 2, 96, 148, 4, 159, - /* 360 */ 164, 257, 50, 530, 46, 142, 367, 155, 165, 369, - /* 370 */ 376, 381, 13, 576, 47, 167, 75, 169, 170, 554, - /* 380 */ 172, 384, 207, 108, 94, 143, 153, 158, 163, 152, - /* 390 */ 157, 118, 120, 112, 114, 110, 116, 154, 122, 124, - /* 400 */ 126, 128, 130, 132, 134, 136, 138, 140, 299, 354, - /* 410 */ 350, 352, 353, 96, 96, 13, 34, 20, 294, 362, - /* 420 */ 345, 144, 581, 167, 258, 169, 170, 821, 142, 558, - /* 430 */ 213, 244, 254, 75, 75, 14, 15, 172, 186, 167, - /* 440 */ 533, 169, 170, 146, 147, 417, 108, 94, 143, 153, - /* 450 */ 158, 163, 152, 157, 118, 120, 112, 114, 110, 116, - /* 460 */ 96, 122, 124, 126, 128, 130, 132, 134, 136, 138, - /* 470 */ 140, 145, 354, 142, 22, 239, 383, 589, 14, 15, - /* 480 */ 75, 36, 336, 419, 172, 187, 842, 213, 528, 582, - /* 490 */ 331, 108, 94, 143, 153, 158, 163, 152, 157, 118, - /* 500 */ 120, 112, 114, 110, 116, 249, 122, 124, 126, 128, - /* 510 */ 130, 132, 134, 136, 138, 140, 306, 661, 142, 327, - /* 520 */ 574, 849, 148, 11, 159, 164, 309, 316, 318, 168, - /* 530 */ 42, 327, 666, 327, 212, 393, 108, 94, 143, 153, - /* 540 */ 158, 163, 152, 157, 118, 120, 112, 114, 110, 116, - /* 550 */ 96, 122, 124, 126, 128, 130, 132, 134, 136, 138, - /* 560 */ 140, 847, 83, 142, 321, 641, 372, 31, 663, 282, - /* 570 */ 75, 242, 308, 689, 231, 246, 167, 334, 169, 170, - /* 580 */ 269, 108, 94, 143, 153, 158, 163, 152, 157, 118, - /* 590 */ 120, 112, 114, 110, 116, 324, 122, 124, 126, 128, - /* 600 */ 130, 132, 134, 136, 138, 140, 246, 328, 142, 328, - /* 610 */ 225, 434, 24, 39, 433, 210, 167, 211, 169, 170, - /* 620 */ 167, 331, 169, 170, 583, 435, 108, 161, 143, 153, - /* 630 */ 158, 163, 152, 157, 118, 120, 112, 114, 110, 116, - /* 640 */ 248, 122, 124, 126, 128, 130, 132, 134, 136, 138, - /* 650 */ 140, 57, 58, 142, 624, 837, 323, 727, 271, 261, - /* 660 */ 167, 243, 169, 170, 313, 312, 247, 167, 798, 169, - /* 670 */ 170, 248, 94, 143, 153, 158, 163, 152, 157, 118, - /* 680 */ 120, 112, 114, 110, 116, 96, 122, 124, 126, 128, - /* 690 */ 130, 132, 134, 136, 138, 140, 279, 247, 142, 360, - /* 700 */ 358, 6, 5, 363, 346, 75, 274, 25, 257, 489, - /* 710 */ 13, 561, 33, 503, 13, 268, 267, 269, 143, 153, - /* 720 */ 158, 163, 152, 157, 118, 120, 112, 114, 110, 116, - /* 730 */ 64, 122, 124, 126, 128, 130, 132, 134, 136, 138, - /* 740 */ 140, 26, 76, 96, 400, 77, 71, 584, 96, 451, - /* 750 */ 166, 485, 29, 76, 402, 78, 167, 71, 169, 170, - /* 760 */ 295, 451, 211, 75, 30, 257, 314, 172, 75, 195, - /* 770 */ 514, 258, 292, 14, 15, 690, 77, 14, 15, 106, - /* 780 */ 195, 77, 77, 173, 191, 315, 203, 77, 344, 215, - /* 790 */ 106, 690, 327, 77, 173, 495, 338, 588, 529, 403, - /* 800 */ 179, 177, 296, 453, 251, 209, 475, 327, 175, 73, - /* 810 */ 74, 179, 177, 95, 531, 532, 35, 213, 475, 175, - /* 820 */ 73, 74, 457, 38, 95, 378, 438, 459, 258, 501, - /* 830 */ 449, 497, 841, 411, 461, 406, 653, 76, 311, 459, - /* 840 */ 387, 71, 322, 81, 323, 42, 101, 102, 103, 104, - /* 850 */ 105, 181, 185, 96, 356, 357, 96, 101, 102, 103, - /* 860 */ 104, 105, 181, 185, 195, 76, 655, 544, 328, 71, - /* 870 */ 96, 271, 431, 75, 106, 354, 75, 489, 173, 327, - /* 880 */ 298, 215, 410, 328, 428, 430, 429, 426, 427, 96, - /* 890 */ 75, 721, 195, 76, 91, 179, 177, 71, 348, 379, - /* 900 */ 349, 323, 106, 175, 73, 74, 173, 467, 95, 75, - /* 910 */ 271, 499, 445, 93, 77, 388, 446, 323, 323, 521, - /* 920 */ 195, 454, 45, 179, 177, 285, 836, 42, 41, 432, - /* 930 */ 106, 175, 73, 74, 173, 480, 95, 269, 488, 43, - /* 940 */ 486, 101, 102, 103, 104, 105, 181, 185, 800, 721, - /* 950 */ 417, 179, 177, 229, 422, 328, 96, 96, 96, 175, - /* 960 */ 73, 74, 814, 96, 95, 522, 53, 486, 479, 101, - /* 970 */ 102, 103, 104, 105, 181, 185, 75, 75, 75, 13, - /* 980 */ 107, 109, 423, 75, 55, 8, 106, 111, 496, 857, - /* 990 */ 19, 21, 23, 401, 96, 472, 56, 101, 102, 103, - /* 1000 */ 104, 105, 181, 185, 536, 240, 81, 339, 342, 863, - /* 1010 */ 546, 61, 96, 96, 75, 96, 341, 482, 113, 483, - /* 1020 */ 95, 96, 525, 417, 456, 542, 13, 96, 96, 523, - /* 1030 */ 417, 549, 75, 75, 552, 75, 115, 117, 472, 119, - /* 1040 */ 96, 75, 14, 15, 81, 121, 96, 75, 75, 77, - /* 1050 */ 417, 123, 125, 101, 102, 103, 60, 519, 466, 96, - /* 1060 */ 75, 498, 417, 240, 127, 417, 75, 64, 500, 62, - /* 1070 */ 129, 96, 63, 690, 96, 504, 508, 452, 68, 75, - /* 1080 */ 417, 494, 96, 131, 96, 96, 81, 96, 502, 14, - /* 1090 */ 15, 75, 96, 96, 75, 133, 555, 70, 135, 96, - /* 1100 */ 506, 512, 75, 510, 75, 75, 137, 75, 139, 141, - /* 1110 */ 96, 149, 75, 75, 81, 96, 151, 160, 516, 75, - /* 1120 */ 96, 96, 96, 162, 598, 80, 599, 96, 96, 82, - /* 1130 */ 75, 240, 221, 84, 174, 75, 96, 96, 96, 176, - /* 1140 */ 75, 75, 75, 96, 178, 180, 192, 75, 75, 518, - /* 1150 */ 96, 194, 204, 96, 79, 286, 75, 75, 75, 237, - /* 1160 */ 206, 208, 220, 75, 96, 96, 96, 236, 85, 235, - /* 1170 */ 75, 96, 87, 75, 241, 75, 867, 273, 215, 283, - /* 1180 */ 86, 77, 90, 97, 75, 75, 75, 88, 382, 470, - /* 1190 */ 474, 75, 89, 98, 99, 487, 100, 140, 156, 214, - /* 1200 */ 667, 668, 669, 182, 205, 188, 190, 189, 196, 199, - /* 1210 */ 198, 201, 215, 200, 202, 216, 217, 224, 222, 228, - /* 1220 */ 227, 229, 230, 226, 234, 238, 211, 245, 233, 253, - /* 1230 */ 250, 252, 255, 272, 260, 263, 265, 256, 264, 266, - /* 1240 */ 270, 278, 287, 280, 297, 281, 300, 320, 303, 302, - /* 1250 */ 305, 307, 304, 325, 333, 329, 310, 317, 326, 351, - /* 1260 */ 355, 370, 359, 330, 319, 340, 343, 368, 371, 361, - /* 1270 */ 374, 377, 385, 335, 375, 373, 396, 386, 380, 389, - /* 1280 */ 390, 54, 366, 391, 404, 392, 407, 405, 409, 408, - /* 1290 */ 412, 413, 418, 416, 829, 414, 424, 425, 415, 834, - /* 1300 */ 420, 439, 835, 421, 436, 440, 441, 442, 443, 444, - /* 1310 */ 447, 805, 450, 806, 455, 458, 828, 460, 728, 464, - /* 1320 */ 729, 843, 453, 465, 468, 471, 463, 845, 476, 469, - /* 1330 */ 481, 478, 473, 477, 484, 846, 493, 491, 848, 492, - /* 1340 */ 660, 662, 813, 855, 505, 507, 720, 509, 511, 723, - /* 1350 */ 513, 726, 515, 815, 524, 526, 527, 520, 517, 816, - /* 1360 */ 817, 818, 819, 534, 535, 820, 856, 539, 858, 540, - /* 1370 */ 545, 538, 543, 859, 862, 548, 551, 864, 553, 550, - /* 1380 */ 537, 557, 541, 547, 865, 556, 866, 560, 559, 547, - /* 1390 */ 562, + /* 0 */ 286, 584, 113, 140, 142, 138, 144, 581, 150, 152, + /* 10 */ 154, 156, 158, 160, 162, 164, 166, 168, 3, 577, + /* 20 */ 740, 170, 178, 150, 152, 154, 156, 158, 160, 162, + /* 30 */ 164, 166, 168, 158, 160, 162, 164, 166, 168, 135, + /* 40 */ 97, 171, 181, 186, 191, 180, 185, 146, 148, 140, + /* 50 */ 142, 138, 144, 51, 150, 152, 154, 156, 158, 160, + /* 60 */ 162, 164, 166, 168, 16, 17, 18, 114, 7, 248, + /* 70 */ 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, + /* 80 */ 13, 37, 362, 40, 59, 67, 69, 326, 357, 170, + /* 90 */ 6, 5, 331, 95, 364, 359, 25, 374, 258, 893, + /* 100 */ 1, 580, 514, 13, 4, 575, 33, 135, 97, 171, + /* 110 */ 181, 186, 191, 180, 185, 146, 148, 140, 142, 138, + /* 120 */ 144, 9, 150, 152, 154, 156, 158, 160, 162, 164, + /* 130 */ 166, 168, 374, 136, 592, 80, 112, 99, 269, 34, + /* 140 */ 32, 33, 132, 373, 115, 14, 15, 378, 333, 99, + /* 150 */ 380, 387, 392, 13, 367, 370, 194, 170, 78, 500, + /* 160 */ 525, 315, 395, 369, 375, 408, 10, 98, 14, 15, + /* 170 */ 78, 200, 286, 864, 113, 135, 97, 171, 181, 186, + /* 180 */ 191, 180, 185, 146, 148, 140, 142, 138, 144, 80, + /* 190 */ 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, + /* 200 */ 104, 105, 106, 661, 496, 376, 374, 170, 467, 13, + /* 210 */ 2, 28, 237, 4, 409, 33, 3, 577, 14, 15, + /* 220 */ 51, 132, 133, 115, 241, 135, 97, 171, 181, 186, + /* 230 */ 191, 180, 185, 146, 148, 140, 142, 138, 144, 114, + /* 240 */ 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, + /* 250 */ 40, 59, 67, 69, 326, 357, 136, 44, 45, 501, + /* 260 */ 473, 463, 359, 36, 361, 130, 128, 660, 275, 31, + /* 270 */ 84, 99, 356, 378, 14, 15, 380, 387, 392, 52, + /* 280 */ 170, 117, 122, 123, 113, 541, 369, 643, 395, 348, + /* 290 */ 98, 54, 78, 200, 302, 57, 58, 819, 135, 97, + /* 300 */ 171, 181, 186, 191, 180, 185, 146, 148, 140, 142, + /* 310 */ 138, 144, 861, 150, 152, 154, 156, 158, 160, 162, + /* 320 */ 164, 166, 168, 104, 105, 106, 817, 80, 48, 316, + /* 330 */ 162, 164, 166, 168, 319, 277, 12, 49, 99, 303, + /* 340 */ 283, 818, 99, 124, 304, 99, 241, 172, 593, 114, + /* 350 */ 50, 193, 46, 378, 170, 13, 380, 387, 392, 78, + /* 360 */ 260, 276, 47, 78, 200, 64, 78, 260, 395, 174, + /* 370 */ 175, 221, 135, 97, 171, 181, 186, 191, 180, 185, + /* 380 */ 146, 148, 140, 142, 138, 144, 199, 150, 152, 154, + /* 390 */ 156, 158, 160, 162, 164, 166, 168, 173, 252, 261, + /* 400 */ 120, 122, 123, 212, 170, 268, 254, 130, 128, 288, + /* 410 */ 590, 176, 246, 187, 192, 414, 195, 241, 197, 198, + /* 420 */ 14, 15, 135, 97, 171, 181, 186, 191, 180, 185, + /* 430 */ 146, 148, 140, 142, 138, 144, 433, 150, 152, 154, + /* 440 */ 156, 158, 160, 162, 164, 166, 168, 311, 99, 707, + /* 450 */ 99, 422, 708, 417, 275, 81, 318, 598, 99, 219, + /* 460 */ 13, 231, 124, 13, 176, 48, 187, 192, 20, 78, + /* 470 */ 317, 78, 214, 195, 49, 197, 198, 462, 170, 78, + /* 480 */ 200, 116, 27, 13, 410, 113, 591, 50, 80, 225, + /* 490 */ 195, 11, 197, 198, 506, 235, 135, 97, 171, 181, + /* 500 */ 186, 191, 180, 185, 146, 148, 140, 142, 138, 144, + /* 510 */ 80, 150, 152, 154, 156, 158, 160, 162, 164, 166, + /* 520 */ 168, 277, 215, 324, 606, 14, 15, 301, 14, 15, + /* 530 */ 512, 13, 508, 240, 196, 486, 195, 685, 197, 198, + /* 540 */ 22, 834, 445, 331, 462, 170, 444, 276, 14, 15, + /* 550 */ 114, 468, 278, 394, 599, 280, 470, 288, 446, 680, + /* 560 */ 13, 321, 404, 135, 97, 171, 181, 186, 191, 180, + /* 570 */ 185, 146, 148, 140, 142, 138, 144, 80, 150, 152, + /* 580 */ 154, 156, 158, 160, 162, 164, 166, 168, 74, 99, + /* 590 */ 540, 366, 73, 99, 352, 289, 14, 15, 176, 333, + /* 600 */ 187, 192, 486, 869, 359, 273, 283, 542, 543, 867, + /* 610 */ 78, 500, 510, 170, 78, 323, 682, 176, 472, 187, + /* 620 */ 192, 746, 118, 470, 119, 14, 15, 195, 346, 197, + /* 630 */ 198, 135, 97, 171, 181, 186, 191, 180, 185, 146, + /* 640 */ 148, 140, 142, 138, 144, 99, 150, 152, 154, 156, + /* 650 */ 158, 160, 162, 164, 166, 168, 532, 334, 341, 343, + /* 660 */ 841, 39, 195, 170, 197, 198, 78, 94, 124, 356, + /* 670 */ 271, 353, 439, 441, 440, 544, 883, 428, 72, 862, + /* 680 */ 288, 135, 97, 171, 181, 186, 191, 180, 185, 146, + /* 690 */ 148, 140, 142, 138, 144, 13, 150, 152, 154, 156, + /* 700 */ 158, 160, 162, 164, 166, 168, 195, 99, 197, 198, + /* 710 */ 406, 330, 195, 170, 197, 198, 568, 405, 306, 195, + /* 720 */ 42, 197, 198, 65, 195, 539, 197, 198, 78, 96, + /* 730 */ 66, 135, 97, 171, 181, 186, 191, 180, 185, 146, + /* 740 */ 148, 140, 142, 138, 144, 885, 150, 152, 154, 156, + /* 750 */ 158, 160, 162, 164, 166, 168, 99, 740, 99, 298, + /* 760 */ 14, 15, 272, 170, 13, 74, 572, 86, 600, 73, + /* 770 */ 126, 127, 614, 709, 309, 478, 24, 78, 247, 78, + /* 780 */ 111, 135, 97, 171, 181, 186, 191, 180, 185, 146, + /* 790 */ 148, 140, 142, 138, 144, 99, 150, 152, 154, 156, + /* 800 */ 158, 160, 162, 164, 166, 168, 99, 238, 113, 239, + /* 810 */ 295, 26, 296, 170, 338, 337, 78, 137, 294, 320, + /* 820 */ 347, 239, 348, 390, 211, 348, 30, 78, 139, 14, + /* 830 */ 15, 135, 189, 171, 181, 186, 191, 180, 185, 146, + /* 840 */ 148, 140, 142, 138, 144, 99, 150, 152, 154, 156, + /* 850 */ 158, 160, 162, 164, 166, 168, 99, 80, 99, 372, + /* 860 */ 399, 442, 348, 170, 298, 243, 78, 141, 363, 601, + /* 870 */ 428, 437, 438, 114, 411, 269, 605, 78, 143, 78, + /* 880 */ 145, 448, 97, 171, 181, 186, 191, 180, 185, 146, + /* 890 */ 148, 140, 142, 138, 144, 99, 150, 152, 154, 156, + /* 900 */ 158, 160, 162, 164, 166, 168, 99, 80, 99, 430, + /* 910 */ 99, 296, 555, 170, 413, 856, 78, 147, 672, 457, + /* 920 */ 352, 348, 298, 443, 465, 45, 35, 78, 149, 78, + /* 930 */ 151, 78, 153, 171, 181, 186, 191, 180, 185, 146, + /* 940 */ 148, 140, 142, 138, 144, 99, 150, 152, 154, 156, + /* 950 */ 158, 160, 162, 164, 166, 168, 99, 459, 99, 29, + /* 960 */ 79, 464, 183, 483, 71, 339, 78, 155, 709, 421, + /* 970 */ 428, 79, 109, 99, 491, 71, 296, 78, 157, 78, + /* 980 */ 159, 490, 243, 109, 99, 340, 99, 449, 857, 223, + /* 990 */ 99, 460, 182, 709, 78, 161, 99, 349, 827, 136, + /* 1000 */ 223, 99, 80, 201, 99, 78, 163, 78, 165, 507, + /* 1010 */ 136, 78, 167, 42, 201, 38, 493, 78, 169, 569, + /* 1020 */ 207, 205, 78, 177, 674, 78, 179, 477, 203, 76, + /* 1030 */ 77, 207, 205, 98, 99, 84, 99, 42, 336, 203, + /* 1040 */ 76, 77, 99, 43, 98, 41, 428, 79, 494, 80, + /* 1050 */ 428, 71, 84, 99, 352, 78, 188, 78, 190, 109, + /* 1060 */ 499, 428, 497, 78, 202, 60, 104, 105, 106, 107, + /* 1070 */ 108, 209, 213, 99, 78, 204, 223, 104, 105, 106, + /* 1080 */ 107, 108, 209, 213, 820, 509, 136, 53, 383, 511, + /* 1090 */ 201, 99, 56, 61, 78, 206, 55, 428, 428, 889, + /* 1100 */ 513, 99, 243, 99, 352, 99, 79, 207, 205, 312, + /* 1110 */ 71, 99, 78, 208, 483, 203, 76, 77, 109, 533, + /* 1120 */ 98, 497, 78, 220, 78, 222, 78, 232, 84, 99, + /* 1130 */ 428, 353, 78, 234, 352, 223, 517, 521, 389, 99, + /* 1140 */ 62, 530, 99, 64, 63, 136, 68, 529, 70, 201, + /* 1150 */ 78, 236, 352, 104, 105, 106, 107, 108, 209, 213, + /* 1160 */ 78, 249, 99, 78, 265, 877, 207, 205, 398, 527, + /* 1170 */ 99, 615, 616, 313, 203, 76, 77, 99, 523, 98, + /* 1180 */ 80, 353, 8, 78, 270, 99, 456, 19, 21, 23, + /* 1190 */ 412, 78, 300, 75, 78, 310, 82, 84, 78, 365, + /* 1200 */ 563, 83, 547, 99, 87, 553, 78, 393, 85, 557, + /* 1210 */ 99, 353, 104, 105, 106, 107, 108, 209, 213, 99, + /* 1220 */ 269, 536, 99, 467, 78, 434, 88, 266, 534, 353, + /* 1230 */ 560, 78, 481, 566, 264, 89, 250, 90, 93, 91, + /* 1240 */ 78, 485, 101, 78, 498, 92, 100, 102, 103, 110, + /* 1250 */ 131, 121, 134, 125, 129, 168, 184, 242, 686, 687, + /* 1260 */ 688, 210, 233, 218, 224, 216, 227, 226, 217, 229, + /* 1270 */ 228, 230, 243, 251, 515, 519, 463, 245, 253, 244, + /* 1280 */ 505, 257, 255, 256, 258, 84, 259, 262, 263, 239, + /* 1290 */ 267, 279, 274, 281, 282, 299, 285, 292, 284, 287, + /* 1300 */ 290, 293, 297, 305, 314, 291, 307, 322, 308, 325, + /* 1310 */ 327, 345, 329, 328, 332, 350, 354, 330, 358, 335, + /* 1320 */ 342, 379, 381, 382, 344, 351, 368, 385, 355, 371, + /* 1330 */ 388, 360, 396, 397, 400, 401, 415, 54, 416, 386, + /* 1340 */ 384, 391, 418, 402, 407, 419, 377, 420, 423, 424, + /* 1350 */ 403, 426, 425, 427, 429, 435, 431, 849, 436, 854, + /* 1360 */ 432, 855, 450, 447, 451, 452, 454, 453, 825, 455, + /* 1370 */ 458, 826, 469, 461, 466, 747, 748, 848, 471, 464, + /* 1380 */ 863, 480, 474, 475, 476, 482, 865, 479, 487, 484, + /* 1390 */ 489, 488, 492, 866, 495, 868, 504, 679, 502, 681, + /* 1400 */ 833, 875, 518, 503, 516, 739, 520, 524, 522, 742, + /* 1410 */ 745, 531, 526, 835, 535, 528, 538, 537, 836, 837, + /* 1420 */ 838, 839, 545, 546, 840, 550, 876, 556, 551, 878, + /* 1430 */ 548, 549, 554, 879, 559, 882, 884, 562, 886, 561, + /* 1440 */ 552, 558, 564, 567, 570, 565, 571, 887, 576, 574, + /* 1450 */ 573, 888, 578, 559, 559, 579, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 25, 30, 27, 72, 73, 74, 75, 36, 77, 78, - /* 10 */ 79, 80, 81, 82, 83, 84, 85, 86, 10, 44, - /* 20 */ 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - /* 30 */ 86, 81, 82, 83, 84, 85, 86, 62, 63, 64, - /* 40 */ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - /* 50 */ 75, 23, 77, 78, 79, 80, 81, 82, 83, 84, - /* 60 */ 85, 86, 10, 60, 26, 90, 77, 78, 79, 80, - /* 70 */ 81, 82, 83, 84, 85, 86, 92, 27, 148, 95, - /* 80 */ 96, 97, 44, 142, 143, 144, 48, 23, 147, 25, - /* 90 */ 150, 107, 18, 90, 24, 155, 149, 94, 158, 159, - /* 100 */ 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - /* 110 */ 72, 73, 74, 75, 150, 77, 78, 79, 80, 81, - /* 120 */ 82, 83, 84, 85, 86, 51, 0, 44, 177, 178, - /* 130 */ 127, 128, 129, 83, 170, 184, 10, 11, 174, 157, - /* 140 */ 90, 91, 10, 115, 22, 62, 63, 64, 65, 66, - /* 150 */ 67, 68, 69, 70, 71, 72, 73, 74, 75, 27, - /* 160 */ 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - /* 170 */ 10, 189, 44, 209, 210, 27, 102, 103, 104, 109, - /* 180 */ 45, 111, 112, 201, 202, 10, 11, 113, 206, 157, - /* 190 */ 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - /* 200 */ 72, 73, 74, 75, 94, 77, 78, 79, 80, 81, - /* 210 */ 82, 83, 84, 85, 86, 19, 106, 134, 96, 64, - /* 220 */ 18, 189, 90, 91, 28, 150, 83, 84, 85, 86, - /* 230 */ 14, 15, 16, 158, 159, 39, 101, 41, 90, 91, - /* 240 */ 92, 163, 27, 95, 96, 97, 44, 92, 93, 94, - /* 250 */ 95, 96, 97, 98, 99, 107, 181, 182, 25, 137, - /* 260 */ 27, 106, 64, 135, 62, 63, 64, 65, 66, 67, - /* 270 */ 68, 69, 70, 71, 72, 73, 74, 75, 200, 77, - /* 280 */ 78, 79, 80, 81, 82, 83, 84, 85, 86, 27, - /* 290 */ 24, 44, 94, 95, 96, 97, 98, 99, 24, 217, - /* 300 */ 26, 219, 220, 163, 106, 90, 91, 186, 187, 62, - /* 310 */ 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - /* 320 */ 73, 74, 75, 90, 77, 78, 79, 80, 81, 82, - /* 330 */ 83, 84, 85, 86, 217, 218, 219, 220, 24, 150, - /* 340 */ 200, 150, 19, 81, 82, 24, 110, 165, 166, 167, - /* 350 */ 114, 28, 90, 91, 24, 144, 150, 217, 147, 219, - /* 360 */ 220, 27, 39, 101, 41, 44, 92, 64, 23, 95, - /* 370 */ 96, 97, 27, 10, 51, 109, 170, 111, 112, 188, - /* 380 */ 174, 107, 135, 62, 63, 64, 65, 66, 67, 68, - /* 390 */ 69, 70, 71, 72, 73, 74, 75, 94, 77, 78, - /* 400 */ 79, 80, 81, 82, 83, 84, 85, 86, 24, 227, - /* 410 */ 165, 166, 167, 150, 150, 27, 160, 149, 212, 163, - /* 420 */ 164, 44, 10, 109, 90, 111, 112, 10, 44, 238, - /* 430 */ 224, 201, 202, 170, 170, 90, 91, 174, 174, 109, - /* 440 */ 23, 111, 112, 66, 67, 150, 62, 63, 64, 65, - /* 450 */ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - /* 460 */ 150, 77, 78, 79, 80, 81, 82, 83, 84, 85, - /* 470 */ 86, 94, 227, 44, 149, 212, 171, 10, 90, 91, - /* 480 */ 170, 168, 169, 188, 174, 221, 12, 224, 71, 10, - /* 490 */ 177, 62, 63, 64, 65, 66, 67, 68, 69, 70, - /* 500 */ 71, 72, 73, 74, 75, 117, 77, 78, 79, 80, - /* 510 */ 81, 82, 83, 84, 85, 86, 45, 10, 44, 150, - /* 520 */ 10, 10, 217, 13, 219, 220, 102, 103, 104, 110, - /* 530 */ 101, 150, 113, 150, 224, 64, 62, 63, 64, 65, - /* 540 */ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - /* 550 */ 150, 77, 78, 79, 80, 81, 82, 83, 84, 85, - /* 560 */ 86, 10, 192, 44, 183, 24, 183, 26, 10, 199, - /* 570 */ 170, 26, 101, 24, 174, 26, 109, 106, 111, 112, - /* 580 */ 26, 62, 63, 64, 65, 66, 67, 68, 69, 70, - /* 590 */ 71, 72, 73, 74, 75, 226, 77, 78, 79, 80, - /* 600 */ 81, 82, 83, 84, 85, 86, 26, 226, 44, 226, - /* 610 */ 210, 29, 149, 169, 32, 24, 109, 26, 111, 112, - /* 620 */ 109, 177, 111, 112, 10, 43, 62, 63, 64, 65, - /* 630 */ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - /* 640 */ 91, 77, 78, 79, 80, 81, 82, 83, 84, 85, - /* 650 */ 86, 14, 15, 44, 24, 101, 26, 10, 150, 163, - /* 660 */ 109, 116, 111, 112, 93, 94, 117, 109, 18, 111, - /* 670 */ 112, 91, 63, 64, 65, 66, 67, 68, 69, 70, - /* 680 */ 71, 72, 73, 74, 75, 150, 77, 78, 79, 80, - /* 690 */ 81, 82, 83, 84, 85, 86, 200, 117, 44, 81, - /* 700 */ 82, 145, 146, 150, 23, 170, 23, 151, 27, 174, - /* 710 */ 27, 158, 159, 157, 27, 24, 208, 26, 64, 65, - /* 720 */ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - /* 730 */ 100, 77, 78, 79, 80, 81, 82, 83, 84, 85, - /* 740 */ 86, 152, 23, 150, 157, 189, 27, 10, 150, 157, - /* 750 */ 157, 216, 156, 23, 153, 157, 109, 27, 111, 112, - /* 760 */ 24, 157, 26, 170, 24, 27, 33, 174, 170, 50, - /* 770 */ 214, 90, 174, 90, 91, 101, 189, 90, 91, 60, - /* 780 */ 50, 189, 189, 64, 134, 52, 136, 189, 162, 115, - /* 790 */ 60, 25, 150, 189, 64, 21, 170, 10, 150, 21, - /* 800 */ 81, 82, 83, 62, 117, 212, 214, 150, 89, 90, - /* 810 */ 91, 81, 82, 94, 166, 167, 161, 224, 214, 89, - /* 820 */ 90, 91, 230, 150, 94, 183, 225, 235, 90, 55, - /* 830 */ 229, 57, 12, 55, 230, 57, 10, 23, 105, 235, - /* 840 */ 183, 27, 24, 113, 26, 101, 127, 128, 129, 130, - /* 850 */ 131, 132, 133, 150, 127, 128, 150, 127, 128, 129, - /* 860 */ 130, 131, 132, 133, 50, 23, 125, 129, 226, 27, - /* 870 */ 150, 150, 47, 170, 60, 227, 170, 174, 64, 150, - /* 880 */ 174, 115, 157, 226, 102, 103, 104, 53, 54, 150, - /* 890 */ 170, 10, 50, 23, 174, 81, 82, 27, 24, 24, - /* 900 */ 26, 26, 60, 89, 90, 91, 64, 26, 94, 170, - /* 910 */ 150, 137, 183, 174, 189, 24, 24, 26, 26, 216, - /* 920 */ 50, 186, 187, 81, 82, 83, 101, 101, 171, 208, - /* 930 */ 60, 89, 90, 91, 64, 24, 94, 26, 24, 34, - /* 940 */ 26, 127, 128, 129, 130, 131, 132, 133, 134, 10, - /* 950 */ 150, 81, 82, 27, 134, 226, 150, 150, 150, 89, - /* 960 */ 90, 91, 10, 150, 94, 24, 171, 26, 208, 127, - /* 970 */ 128, 129, 130, 131, 132, 133, 170, 170, 170, 27, - /* 980 */ 174, 174, 174, 170, 180, 12, 60, 174, 188, 10, - /* 990 */ 17, 18, 19, 20, 150, 150, 42, 127, 128, 129, - /* 1000 */ 130, 131, 132, 133, 31, 124, 113, 81, 82, 10, - /* 1010 */ 37, 172, 150, 150, 170, 150, 90, 157, 174, 126, - /* 1020 */ 94, 150, 49, 150, 51, 46, 27, 150, 150, 56, - /* 1030 */ 150, 58, 170, 170, 61, 170, 174, 174, 150, 174, - /* 1040 */ 150, 170, 90, 91, 113, 174, 150, 170, 170, 189, - /* 1050 */ 150, 174, 174, 127, 128, 129, 46, 126, 213, 150, - /* 1060 */ 170, 188, 150, 124, 174, 150, 170, 100, 188, 171, - /* 1070 */ 174, 150, 173, 10, 150, 102, 103, 104, 171, 170, - /* 1080 */ 150, 108, 150, 174, 150, 150, 113, 150, 188, 90, - /* 1090 */ 91, 170, 150, 150, 170, 174, 59, 23, 174, 150, - /* 1100 */ 188, 213, 170, 188, 170, 170, 174, 170, 174, 174, - /* 1110 */ 150, 174, 170, 170, 113, 150, 174, 174, 188, 170, - /* 1120 */ 150, 150, 150, 174, 115, 189, 115, 150, 150, 191, - /* 1130 */ 170, 124, 119, 193, 174, 170, 150, 150, 150, 174, - /* 1140 */ 170, 170, 170, 150, 174, 174, 174, 170, 170, 157, - /* 1150 */ 150, 174, 174, 150, 190, 150, 170, 170, 170, 121, - /* 1160 */ 174, 174, 174, 170, 150, 150, 150, 174, 194, 122, - /* 1170 */ 170, 150, 196, 170, 174, 170, 139, 174, 115, 174, - /* 1180 */ 195, 189, 123, 115, 170, 170, 170, 197, 174, 174, - /* 1190 */ 174, 170, 198, 150, 115, 174, 150, 86, 94, 150, - /* 1200 */ 113, 113, 113, 23, 134, 222, 18, 223, 23, 187, - /* 1210 */ 24, 150, 115, 26, 24, 150, 154, 26, 120, 99, - /* 1220 */ 172, 27, 162, 211, 172, 120, 26, 203, 211, 117, - /* 1230 */ 150, 150, 150, 101, 150, 204, 118, 154, 205, 23, - /* 1240 */ 150, 24, 115, 204, 24, 205, 171, 23, 175, 150, - /* 1250 */ 178, 150, 176, 211, 162, 211, 179, 179, 172, 24, - /* 1260 */ 228, 46, 228, 172, 179, 170, 170, 150, 23, 163, - /* 1270 */ 24, 23, 46, 180, 171, 173, 182, 23, 171, 98, - /* 1280 */ 150, 106, 182, 175, 150, 176, 150, 154, 25, 154, - /* 1290 */ 150, 154, 154, 101, 12, 231, 40, 38, 232, 101, - /* 1300 */ 233, 137, 101, 234, 47, 150, 154, 101, 150, 23, - /* 1310 */ 171, 10, 12, 137, 185, 18, 10, 10, 125, 150, - /* 1320 */ 125, 18, 62, 105, 150, 194, 185, 10, 125, 71, - /* 1330 */ 215, 23, 71, 150, 23, 10, 194, 116, 10, 150, - /* 1340 */ 10, 10, 10, 10, 116, 194, 10, 185, 105, 10, - /* 1350 */ 194, 10, 125, 10, 150, 150, 154, 23, 215, 10, - /* 1360 */ 10, 10, 10, 150, 24, 10, 10, 25, 10, 150, - /* 1370 */ 35, 163, 163, 10, 10, 150, 154, 10, 21, 150, - /* 1380 */ 236, 150, 237, 236, 10, 138, 10, 239, 139, 240, - /* 1390 */ 140, + /* 0 */ 28, 11, 30, 77, 78, 79, 80, 0, 82, 83, + /* 10 */ 84, 85, 86, 87, 88, 89, 90, 91, 11, 12, + /* 20 */ 11, 49, 81, 82, 83, 84, 85, 86, 87, 88, + /* 30 */ 89, 90, 91, 86, 87, 88, 89, 90, 91, 67, + /* 40 */ 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + /* 50 */ 78, 79, 80, 69, 82, 83, 84, 85, 86, 87, + /* 60 */ 88, 89, 90, 91, 17, 18, 19, 95, 11, 29, + /* 70 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + /* 80 */ 30, 97, 98, 99, 100, 101, 102, 103, 104, 49, + /* 90 */ 150, 151, 50, 53, 26, 111, 156, 155, 30, 147, + /* 100 */ 148, 149, 162, 30, 152, 163, 164, 67, 68, 69, + /* 110 */ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + /* 120 */ 80, 153, 82, 83, 84, 85, 86, 87, 88, 89, + /* 130 */ 90, 91, 155, 65, 11, 195, 28, 155, 129, 165, + /* 140 */ 163, 164, 168, 169, 170, 95, 96, 97, 106, 155, + /* 150 */ 100, 101, 102, 30, 86, 87, 162, 49, 176, 177, + /* 160 */ 220, 88, 112, 95, 187, 188, 154, 99, 95, 96, + /* 170 */ 176, 177, 28, 21, 30, 67, 68, 69, 70, 71, + /* 180 */ 72, 73, 74, 75, 76, 77, 78, 79, 80, 195, + /* 190 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + /* 200 */ 132, 133, 134, 27, 222, 29, 155, 49, 56, 30, + /* 210 */ 149, 160, 218, 152, 163, 164, 11, 12, 95, 96, + /* 220 */ 69, 168, 169, 170, 230, 67, 68, 69, 70, 71, + /* 230 */ 72, 73, 74, 75, 76, 77, 78, 79, 80, 95, + /* 240 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + /* 250 */ 99, 100, 101, 102, 103, 104, 65, 192, 193, 107, + /* 260 */ 108, 109, 111, 174, 175, 86, 87, 27, 29, 29, + /* 270 */ 118, 155, 183, 97, 95, 96, 100, 101, 102, 99, + /* 280 */ 49, 171, 172, 173, 30, 106, 95, 27, 112, 29, + /* 290 */ 99, 111, 176, 177, 162, 17, 18, 139, 67, 68, + /* 300 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + /* 310 */ 79, 80, 15, 82, 83, 84, 85, 86, 87, 88, + /* 320 */ 89, 90, 91, 132, 133, 134, 21, 195, 22, 27, + /* 330 */ 88, 89, 90, 91, 218, 96, 155, 31, 155, 207, + /* 340 */ 208, 21, 155, 233, 212, 155, 230, 49, 11, 95, + /* 350 */ 44, 26, 46, 97, 49, 30, 100, 101, 102, 176, + /* 360 */ 177, 122, 56, 176, 177, 105, 176, 177, 112, 71, + /* 370 */ 72, 140, 67, 68, 69, 70, 71, 72, 73, 74, + /* 380 */ 75, 76, 77, 78, 79, 80, 27, 82, 83, 84, + /* 390 */ 85, 86, 87, 88, 89, 90, 91, 99, 215, 216, + /* 400 */ 171, 172, 173, 27, 49, 218, 216, 86, 87, 168, + /* 410 */ 11, 223, 224, 225, 226, 24, 114, 230, 116, 117, + /* 420 */ 95, 96, 67, 68, 69, 70, 71, 72, 73, 74, + /* 430 */ 75, 76, 77, 78, 79, 80, 139, 82, 83, 84, + /* 440 */ 85, 86, 87, 88, 89, 90, 91, 206, 155, 27, + /* 450 */ 155, 60, 27, 62, 29, 162, 27, 11, 155, 139, + /* 460 */ 30, 141, 233, 30, 223, 22, 225, 226, 154, 176, + /* 470 */ 177, 176, 177, 114, 31, 116, 117, 162, 49, 176, + /* 480 */ 177, 26, 26, 30, 28, 30, 11, 44, 195, 46, + /* 490 */ 114, 16, 116, 117, 24, 140, 67, 68, 69, 70, + /* 500 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + /* 510 */ 195, 82, 83, 84, 85, 86, 87, 88, 89, 90, + /* 520 */ 91, 96, 227, 27, 11, 95, 96, 26, 95, 96, + /* 530 */ 60, 30, 62, 230, 115, 220, 114, 118, 116, 117, + /* 540 */ 154, 11, 32, 50, 162, 49, 36, 122, 95, 96, + /* 550 */ 95, 236, 122, 178, 11, 122, 241, 168, 48, 11, + /* 560 */ 30, 88, 69, 67, 68, 69, 70, 71, 72, 73, + /* 570 */ 74, 75, 76, 77, 78, 79, 80, 195, 82, 83, + /* 580 */ 84, 85, 86, 87, 88, 89, 90, 91, 115, 155, + /* 590 */ 155, 27, 119, 155, 155, 206, 95, 96, 223, 106, + /* 600 */ 225, 226, 220, 11, 111, 207, 208, 172, 173, 11, + /* 610 */ 176, 177, 142, 49, 176, 177, 11, 223, 236, 225, + /* 620 */ 226, 11, 27, 241, 29, 95, 96, 114, 189, 116, + /* 630 */ 117, 67, 68, 69, 70, 71, 72, 73, 74, 75, + /* 640 */ 76, 77, 78, 79, 80, 155, 82, 83, 84, 85, + /* 650 */ 86, 87, 88, 89, 90, 91, 222, 107, 108, 109, + /* 660 */ 11, 175, 114, 49, 116, 117, 176, 177, 233, 183, + /* 670 */ 29, 232, 107, 108, 109, 26, 11, 155, 26, 15, + /* 680 */ 168, 67, 68, 69, 70, 71, 72, 73, 74, 75, + /* 690 */ 76, 77, 78, 79, 80, 30, 82, 83, 84, 85, + /* 700 */ 86, 87, 88, 89, 90, 91, 114, 155, 116, 117, + /* 710 */ 183, 184, 114, 49, 116, 117, 194, 190, 206, 114, + /* 720 */ 106, 116, 117, 34, 114, 76, 116, 117, 176, 177, + /* 730 */ 41, 67, 68, 69, 70, 71, 72, 73, 74, 75, + /* 740 */ 76, 77, 78, 79, 80, 11, 82, 83, 84, 85, + /* 750 */ 86, 87, 88, 89, 90, 91, 155, 11, 155, 155, + /* 760 */ 95, 96, 121, 49, 30, 115, 244, 198, 11, 119, + /* 770 */ 132, 133, 120, 28, 205, 29, 154, 176, 177, 176, + /* 780 */ 177, 67, 68, 69, 70, 71, 72, 73, 74, 75, + /* 790 */ 76, 77, 78, 79, 80, 155, 82, 83, 84, 85, + /* 800 */ 86, 87, 88, 89, 90, 91, 155, 27, 30, 29, + /* 810 */ 27, 157, 29, 49, 98, 99, 176, 177, 214, 27, + /* 820 */ 27, 29, 29, 27, 162, 29, 27, 176, 177, 95, + /* 830 */ 96, 67, 68, 69, 70, 71, 72, 73, 74, 75, + /* 840 */ 76, 77, 78, 79, 80, 155, 82, 83, 84, 85, + /* 850 */ 86, 87, 88, 89, 90, 91, 155, 195, 155, 167, + /* 860 */ 27, 52, 29, 49, 155, 120, 176, 177, 176, 11, + /* 870 */ 155, 58, 59, 95, 162, 129, 11, 176, 177, 176, + /* 880 */ 177, 25, 68, 69, 70, 71, 72, 73, 74, 75, + /* 890 */ 76, 77, 78, 79, 80, 155, 82, 83, 84, 85, + /* 900 */ 86, 87, 88, 89, 90, 91, 155, 195, 155, 194, + /* 910 */ 155, 29, 134, 49, 158, 106, 176, 177, 11, 27, + /* 920 */ 155, 29, 155, 214, 192, 193, 166, 176, 177, 176, + /* 930 */ 177, 176, 177, 69, 70, 71, 72, 73, 74, 75, + /* 940 */ 76, 77, 78, 79, 80, 155, 82, 83, 84, 85, + /* 950 */ 86, 87, 88, 89, 90, 91, 155, 101, 155, 161, + /* 960 */ 26, 67, 69, 155, 30, 37, 176, 177, 106, 162, + /* 970 */ 155, 26, 38, 155, 27, 30, 29, 176, 177, 176, + /* 980 */ 177, 214, 120, 38, 155, 57, 155, 231, 106, 55, + /* 990 */ 155, 235, 99, 11, 176, 177, 155, 232, 142, 65, + /* 1000 */ 55, 155, 195, 69, 155, 176, 177, 176, 177, 194, + /* 1010 */ 65, 176, 177, 106, 69, 155, 162, 176, 177, 64, + /* 1020 */ 86, 87, 176, 177, 130, 176, 177, 219, 94, 95, + /* 1030 */ 96, 86, 87, 99, 155, 118, 155, 106, 110, 94, + /* 1040 */ 95, 96, 155, 39, 99, 178, 155, 26, 131, 195, + /* 1050 */ 155, 30, 118, 155, 155, 176, 177, 176, 177, 38, + /* 1060 */ 27, 155, 29, 176, 177, 51, 132, 133, 134, 135, + /* 1070 */ 136, 137, 138, 155, 176, 177, 55, 132, 133, 134, + /* 1080 */ 135, 136, 137, 138, 139, 194, 65, 178, 189, 194, + /* 1090 */ 69, 155, 47, 179, 176, 177, 186, 155, 155, 144, + /* 1100 */ 194, 155, 120, 155, 155, 155, 26, 86, 87, 88, + /* 1110 */ 30, 155, 176, 177, 155, 94, 95, 96, 38, 27, + /* 1120 */ 99, 29, 176, 177, 176, 177, 176, 177, 118, 155, + /* 1130 */ 155, 232, 176, 177, 155, 55, 194, 194, 189, 155, + /* 1140 */ 178, 131, 155, 105, 180, 65, 178, 162, 26, 69, + /* 1150 */ 176, 177, 155, 132, 133, 134, 135, 136, 137, 138, + /* 1160 */ 176, 177, 155, 176, 177, 11, 86, 87, 189, 194, + /* 1170 */ 155, 120, 120, 155, 94, 95, 96, 155, 219, 99, + /* 1180 */ 195, 232, 15, 176, 177, 155, 189, 20, 21, 22, + /* 1190 */ 23, 176, 177, 197, 176, 177, 196, 118, 176, 177, + /* 1200 */ 33, 195, 35, 155, 199, 51, 176, 177, 197, 42, + /* 1210 */ 155, 232, 132, 133, 134, 135, 136, 137, 138, 155, + /* 1220 */ 129, 54, 155, 56, 176, 177, 200, 126, 61, 232, + /* 1230 */ 63, 176, 177, 66, 127, 201, 124, 202, 128, 203, + /* 1240 */ 176, 177, 155, 176, 177, 204, 120, 120, 155, 26, + /* 1250 */ 168, 27, 27, 234, 234, 91, 99, 155, 118, 118, + /* 1260 */ 118, 26, 139, 21, 26, 228, 193, 27, 229, 155, + /* 1270 */ 29, 27, 120, 125, 107, 108, 109, 159, 29, 155, + /* 1280 */ 113, 104, 217, 179, 30, 118, 167, 217, 179, 29, + /* 1290 */ 125, 155, 209, 155, 122, 106, 159, 123, 155, 155, + /* 1300 */ 210, 26, 155, 27, 120, 211, 210, 27, 211, 178, + /* 1310 */ 155, 26, 182, 181, 155, 217, 217, 184, 167, 185, + /* 1320 */ 185, 155, 51, 26, 185, 179, 176, 27, 179, 176, + /* 1330 */ 26, 186, 51, 26, 103, 155, 155, 111, 159, 178, + /* 1340 */ 180, 178, 155, 181, 188, 159, 188, 28, 155, 159, + /* 1350 */ 182, 238, 237, 106, 159, 45, 239, 15, 43, 106, + /* 1360 */ 240, 106, 142, 52, 155, 159, 155, 106, 11, 26, + /* 1370 */ 178, 142, 21, 15, 191, 130, 130, 11, 11, 67, + /* 1380 */ 21, 76, 191, 155, 110, 200, 11, 155, 130, 76, + /* 1390 */ 26, 155, 221, 11, 26, 11, 200, 11, 121, 11, + /* 1400 */ 11, 11, 200, 155, 121, 11, 191, 200, 110, 11, + /* 1410 */ 11, 26, 130, 11, 155, 221, 159, 155, 11, 11, + /* 1420 */ 11, 11, 155, 27, 11, 28, 11, 40, 155, 11, + /* 1430 */ 242, 168, 168, 11, 155, 11, 11, 159, 11, 155, + /* 1440 */ 243, 242, 155, 24, 143, 159, 155, 11, 145, 245, + /* 1450 */ 144, 11, 13, 246, 246, 14, }; -#define YY_SHIFT_USE_DFLT (-70) +#define YY_SHIFT_USE_DFLT (-75) static const short yy_shift_ofst[] = { - /* 0 */ 175, 126, -70, -70, 973, 8, 52, -70, 216, 510, - /* 10 */ 160, 132, 363, -70, -70, -70, -70, -70, -70, 510, - /* 20 */ 412, 510, 479, 510, 614, 64, 737, 215, 541, 740, - /* 30 */ 787, 148, -70, 334, -70, 155, -70, 215, 198, -70, - /* 40 */ 744, -70, 905, 323, -70, -70, -70, -70, -70, -70, - /* 50 */ -70, 110, 744, -70, 954, -70, 637, -70, -70, 1010, - /* 60 */ -29, 744, 967, -70, -70, -70, -70, 744, -70, 1074, - /* 70 */ 870, 28, 719, 1009, 1011, -70, 730, -70, 70, 1001, - /* 80 */ -70, 236, -70, 545, 1007, 1038, 1047, 1013, 1059, -70, - /* 90 */ 870, 38, 870, 519, 870, -70, 1068, 215, 1079, 215, - /* 100 */ -70, -70, -70, -70, -70, -70, -70, 654, 870, 609, - /* 110 */ 870, -11, 870, -11, 870, -11, 870, -11, 870, -69, - /* 120 */ 870, -69, 870, -50, 870, -50, 870, -50, 870, -50, - /* 130 */ 870, 143, 870, 143, 870, 1111, 870, 1111, 870, 1111, - /* 140 */ 870, -70, -70, 377, -70, -70, -70, -70, 870, -56, - /* 150 */ 870, -11, -70, 303, -70, 1104, -70, -70, -70, 870, - /* 160 */ 564, 870, -69, -70, 345, 730, 266, 419, 1087, 1088, - /* 170 */ 1089, -70, 519, 870, 654, 870, -70, 870, -70, 870, - /* 180 */ -70, 1180, 1001, 314, -70, 814, 83, 1070, 650, 1188, - /* 190 */ -70, 870, 128, 870, 519, 1185, 196, 1186, -70, 1187, - /* 200 */ 215, 1190, -70, 870, 202, 870, 247, 870, 519, 591, - /* 210 */ -70, 870, -70, -70, 1097, 215, -70, -70, -70, 870, - /* 220 */ 519, 1098, 870, 1191, 870, 1120, -29, -70, 1194, -70, - /* 230 */ -70, 519, 1120, -29, -70, 870, 519, 1105, 870, 1200, - /* 240 */ 870, 519, -70, -70, 580, -70, -70, -70, 388, -70, - /* 250 */ 687, -70, 1112, -70, 683, 1097, 233, -70, -70, 215, - /* 260 */ -70, -70, 1132, 1118, -70, 1216, 215, 691, -70, 215, - /* 270 */ -70, -70, 870, 519, 1001, 330, 549, 1217, 233, 1132, - /* 280 */ 1118, -70, 842, -25, -70, -70, 1127, 50, -70, -70, - /* 290 */ -70, -70, 321, -70, 736, -70, 1220, -70, 384, 744, - /* 300 */ -70, 215, 1224, -70, 135, -70, 215, -70, 424, 733, - /* 310 */ -70, 571, -70, -70, -70, -70, 733, -70, 733, -70, - /* 320 */ 215, 818, -70, 215, 1120, -29, -70, -70, 1120, -29, - /* 330 */ -70, -70, 1194, -70, 954, -70, -70, 926, -70, 3, - /* 340 */ -70, -70, 3, -70, -70, 681, 618, 874, -70, 618, - /* 350 */ 1235, -70, -70, -70, 727, -70, -70, -70, 727, -70, - /* 360 */ -70, -70, -70, -70, 274, -16, -70, 215, -70, 1215, - /* 370 */ 1245, 215, 630, 1246, 744, -70, 1248, 215, 875, 744, - /* 380 */ -70, 870, 429, -70, 1226, 1254, 215, 891, 1181, 215, - /* 390 */ 1224, -70, 471, 1175, -70, -70, -70, -70, -70, 1001, - /* 400 */ 467, 122, 778, 215, 1097, -70, 215, 766, 1263, 1001, - /* 410 */ 507, 215, 1097, 582, 782, 1192, 215, 1097, -70, 1256, - /* 420 */ 820, 1282, 870, 474, 1259, 834, -70, -70, 1198, 1201, - /* 430 */ 825, 215, 554, -70, -70, 1257, -70, -70, 1164, 215, - /* 440 */ 674, 1206, 215, 1286, 215, 892, 826, 1301, 1176, 1300, - /* 450 */ 74, 511, 741, 323, -70, 1193, 1195, 1297, 1306, 1307, - /* 460 */ 74, 1303, 1260, 215, 1218, 215, 881, 215, 1258, 870, - /* 470 */ 519, 1317, 1261, 870, 519, 1203, 215, 1308, 215, 911, - /* 480 */ -70, 893, 551, 1311, 870, 914, 870, 519, 1325, 519, - /* 490 */ 1221, 215, 939, 1328, 774, 215, 1330, 215, 1331, 215, - /* 500 */ 1332, 215, 1333, 558, 1228, 215, 939, 1336, 1260, 215, - /* 510 */ 1243, 215, 881, 1339, 1227, 215, 1308, 931, 647, 1334, - /* 520 */ 870, 941, 1341, 952, 1343, 215, 1097, 417, 262, 1349, - /* 530 */ 1350, 1351, 1352, 215, 1340, 1355, 1335, 334, 1342, 215, - /* 540 */ 979, 1356, 738, 1358, 1363, -70, 1335, 215, 1364, 999, - /* 550 */ 1063, 1367, 1357, 215, 1037, 1247, 215, 1374, 1249, 1250, - /* 560 */ 215, 1376, -70, -70, -70, + /* 0 */ 205, 7, -75, -75, 1167, -10, 57, -75, 47, 475, + /* 10 */ 399, 123, 337, -75, -75, -75, -75, -75, -75, 475, + /* 20 */ 446, 475, 543, 475, 757, 456, 858, 453, 240, 799, + /* 30 */ 865, 50, -75, 254, -75, -16, -75, 453, 151, -75, + /* 40 */ 931, -75, 1004, 306, -75, -75, -75, -75, -75, -75, + /* 50 */ -75, 180, 931, -75, 1045, -75, 278, -75, -75, 1014, + /* 60 */ 689, 931, 1038, -75, -75, -75, -75, 931, -75, 1122, + /* 70 */ 1080, 652, 473, -75, -75, 1080, 1051, 1052, -75, 934, + /* 80 */ -75, 302, 1079, -75, 650, -75, 641, 1091, 1101, 1107, + /* 90 */ 1112, 1110, -75, 1080, 40, 1080, 714, 1080, -75, 1126, + /* 100 */ 453, 1127, 453, -75, -75, -75, -75, -75, -75, 1223, + /* 110 */ 1080, 108, 254, -75, -75, 455, 321, 595, -75, 321, + /* 120 */ 1224, -75, -75, -75, 638, -75, -75, -75, 638, -75, + /* 130 */ -75, -75, -75, 1225, -75, 1080, -75, 814, 1080, -12, + /* 140 */ 1080, -12, 1080, -12, 1080, -12, 1080, -74, 1080, -74, + /* 150 */ 1080, -53, 1080, -53, 1080, -53, 1080, -53, 1080, 242, + /* 160 */ 1080, 242, 1080, 1164, 1080, 1164, 1080, 1164, 1080, -75, + /* 170 */ -75, 298, -75, -75, -75, -75, 1080, -59, 1080, -12, + /* 180 */ -75, 893, -75, 1157, -75, -75, -75, 1080, 764, 1080, + /* 190 */ -74, -75, 325, 934, 359, 419, 1140, 1141, 1142, -75, + /* 200 */ 714, 1080, 864, 1080, -75, 1080, -75, 1080, -75, 1235, + /* 210 */ 1079, 376, -75, 945, 158, 1123, 320, 1242, -75, 1080, + /* 220 */ 231, 1080, 714, 1238, 443, 1240, -75, 1241, 453, 1244, + /* 230 */ -75, 1080, 305, 1080, 355, 1080, 714, 780, -75, 1080, + /* 240 */ -75, -75, 1152, 453, -75, -75, -75, 864, 1080, 714, + /* 250 */ 1148, 1080, 1249, 1080, 1177, 689, -75, 1254, -75, -75, + /* 260 */ 714, 1177, 689, -75, 1080, 714, 1165, 1080, 1260, 1080, + /* 270 */ 714, -75, -75, 239, -75, -75, -75, 430, -75, 433, + /* 280 */ -75, 1172, -75, 501, 1152, 144, 453, -75, -75, 1189, + /* 290 */ 1174, -75, 1275, 453, 783, -75, 453, -75, -75, 1080, + /* 300 */ 714, 1079, 422, 425, 1276, 144, 1189, 1174, -75, 1021, + /* 310 */ -28, -75, -75, 1184, 73, -75, -75, 429, -75, 792, + /* 320 */ -75, 1280, -75, 496, 931, -75, 453, 1285, -75, 42, + /* 330 */ -75, 453, -75, 550, 928, -75, 716, -75, -75, -75, + /* 340 */ -75, 928, -75, 928, -75, 453, 793, -75, 453, 1177, + /* 350 */ 689, -75, -75, 1177, 689, -75, -75, 1254, -75, 1045, + /* 360 */ -75, -75, 68, -75, 1080, 564, -75, 191, -75, -75, + /* 370 */ 191, -75, -75, -75, -75, 176, 256, -75, 453, -75, + /* 380 */ 1271, 1297, 453, 260, 1300, 931, -75, 1304, 453, 796, + /* 390 */ 931, -75, 1080, 614, -75, 1281, 1307, 453, 833, 1231, + /* 400 */ 453, 1285, -75, 493, 1226, -75, -75, -75, -75, -75, + /* 410 */ 1079, 513, 856, 391, 453, 1152, -75, 453, 745, 1319, + /* 420 */ 1079, 548, 453, 1152, 510, 565, 1247, 453, 1152, -75, + /* 430 */ 1310, 297, 1342, 1080, 664, 1315, 813, -75, -75, 1253, + /* 440 */ 1255, 809, 453, 882, -75, -75, 1311, -75, -75, 1220, + /* 450 */ 453, 862, 1261, 453, 1343, 453, 892, 907, 1357, 1229, + /* 460 */ 1358, 152, 592, 894, 306, -75, 1245, 1246, 1351, 1366, + /* 470 */ 1367, 152, 1359, 1312, 453, 1274, 453, 746, 453, 1305, + /* 480 */ 1080, 714, 1375, 1313, 1080, 714, 1258, 453, 1364, 453, + /* 490 */ 947, -75, 917, 598, 1368, 1080, 1033, 1080, 714, 1382, + /* 500 */ 714, 1277, 453, 9, 1384, 470, 453, 1386, 453, 1388, + /* 510 */ 453, 1389, 453, 1390, 605, 1283, 453, 9, 1394, 1312, + /* 520 */ 453, 1298, 453, 746, 1398, 1282, 453, 1364, 1010, 610, + /* 530 */ 1385, 1080, 1092, 1399, 530, 1402, 453, 1152, 649, 179, + /* 540 */ 1407, 1408, 1409, 1410, 453, 1396, 1413, 1387, 254, 1397, + /* 550 */ 453, 1154, 1415, 778, 1418, 1422, -75, 1387, 453, 1424, + /* 560 */ 665, 982, 1425, 734, 982, 1427, 1419, 453, 955, 1301, + /* 570 */ 453, 1436, 1306, 1303, 453, 1440, -75, 1439, 1441, -75, + /* 580 */ -75, }; -#define YY_REDUCE_USE_DFLT (-71) +#define YY_REDUCE_USE_DFLT (-61) static const short yy_reduce_ofst[] = { - /* 0 */ -59, 211, -71, -71, 556, -71, -71, -71, -70, -53, - /* 10 */ -71, 189, -71, -71, -71, -71, -71, -71, -71, 268, - /* 20 */ -71, 325, -71, 463, -71, 589, -71, -60, 596, -71, - /* 30 */ -71, 75, -71, 256, 655, 313, -71, 673, 444, -71, - /* 40 */ 757, -71, -71, 121, -71, -71, -71, -71, -71, -71, - /* 50 */ -71, -71, 795, -71, 804, -71, -71, -71, -71, -71, - /* 60 */ 839, 898, 899, -71, -71, -71, -71, 907, -71, -71, - /* 70 */ 706, -71, 206, -71, -71, -71, 598, -71, 964, 936, - /* 80 */ -71, 938, 370, 940, 974, 985, 976, 990, 994, -71, - /* 90 */ 720, 82, 739, 82, 806, -71, -71, 1043, -71, 1046, - /* 100 */ -71, -71, -71, -71, -71, -71, -71, 82, 807, 82, - /* 110 */ 813, 82, 844, 82, 862, 82, 863, 82, 865, 82, - /* 120 */ 871, 82, 877, 82, 878, 82, 890, 82, 896, 82, - /* 130 */ 909, 82, 921, 82, 924, 82, 932, 82, 934, 82, - /* 140 */ 935, 82, -71, -71, -71, -71, -71, -71, 937, 117, - /* 150 */ 942, 82, -71, -71, -71, -71, -71, -71, -71, 943, - /* 160 */ 82, 949, 82, -71, 1049, 593, 964, -71, -71, -71, - /* 170 */ -71, -71, 82, 960, 82, 965, 82, 970, 82, 971, - /* 180 */ 82, -71, 32, 964, -71, 264, 82, 983, 984, -71, - /* 190 */ -71, 972, 82, 977, 82, -71, 1022, -71, -71, -71, - /* 200 */ 1061, -71, -71, 978, 82, 986, 82, 987, 82, -71, - /* 210 */ -71, 310, -71, -71, 1062, 1065, -71, -71, -71, 988, - /* 220 */ 82, -71, -36, -71, 400, 1012, 1048, -71, 1060, -71, - /* 230 */ -71, 82, 1017, 1052, -71, 993, 82, -71, 263, -71, - /* 240 */ 1000, 82, -71, 230, 1024, -71, -71, -71, 1080, -71, - /* 250 */ 1081, -71, -71, -71, 1082, 1083, 78, -71, -71, 1084, - /* 260 */ -71, -71, 1031, 1033, -71, -71, 508, -71, -71, 1090, - /* 270 */ -71, -71, 1003, 82, -18, 964, 1024, -71, 496, 1039, - /* 280 */ 1040, -71, 1005, 140, -71, -71, -71, 1043, -71, -71, - /* 290 */ -71, -71, 82, -71, -71, -71, -71, -71, 82, 1075, - /* 300 */ -71, 1099, 1073, 1076, 1072, -71, 1101, -71, -71, 1077, - /* 310 */ -71, -71, -71, -71, -71, -71, 1078, -71, 1085, -71, - /* 320 */ 381, -71, -71, 369, 1042, 1086, -71, -71, 1044, 1091, - /* 330 */ -71, -71, 1092, -71, 1093, -71, -71, 626, -71, 1095, - /* 340 */ -71, -71, 1096, -71, -71, 1106, 182, -71, -71, 245, - /* 350 */ -71, -71, -71, -71, 1032, -71, -71, -71, 1034, -71, - /* 360 */ -71, -71, -71, -71, 1094, 1100, -71, 1117, -71, -71, - /* 370 */ -71, 383, 1102, -71, 1103, -71, -71, 642, -71, 1107, - /* 380 */ -71, 1014, 305, -71, -71, -71, 657, -71, -71, 1130, - /* 390 */ 1108, 1109, -49, -71, -71, -71, -71, -71, -71, 587, - /* 400 */ 964, 601, -71, 1134, 1133, -71, 1136, 1135, -71, 725, - /* 410 */ 964, 1140, 1137, 1064, 1066, -71, 295, 1138, -71, 1067, - /* 420 */ 1069, -71, 808, 82, -71, -71, -71, -71, -71, -71, - /* 430 */ -71, 721, -71, -71, -71, -71, -71, -71, -71, 1155, - /* 440 */ 1152, -71, 1158, -71, 729, -71, 1139, -71, -71, -71, - /* 450 */ 592, 964, 1129, 735, -71, -71, -71, -71, -71, -71, - /* 460 */ 604, -71, 1141, 1169, -71, 845, 1131, 1174, -71, 1015, - /* 470 */ 82, -71, -71, 1016, 82, -71, 1183, 1115, 760, -71, - /* 480 */ -71, 860, 964, -71, 535, -71, 1021, 82, -71, 82, - /* 490 */ -71, 1189, 1142, -71, -71, 800, -71, 873, -71, 880, - /* 500 */ -71, 900, -71, 964, -71, 912, 1151, -71, 1162, 915, - /* 510 */ -71, 888, 1156, -71, -71, 930, 1143, 992, 964, -71, - /* 520 */ 703, -71, -71, 1204, -71, 1205, 1202, -71, 648, -71, - /* 530 */ -71, -71, -71, 1213, -71, -71, 1144, 1208, -71, 1219, - /* 540 */ 1145, -71, 1209, -71, -71, -71, 1147, 1225, -71, 1229, - /* 550 */ 1222, -71, -71, 191, -71, -71, 1231, -71, -71, 1148, - /* 560 */ 553, -71, -71, -71, -71, + /* 0 */ -48, 61, -61, -61, -60, -61, -61, -61, -32, 12, + /* 10 */ -61, 181, -61, -61, -61, -61, -61, -61, -61, 314, + /* 20 */ -61, 386, -61, 622, -61, 654, -61, 51, 798, -61, + /* 30 */ -61, -23, -61, -26, 760, 89, -61, 860, 486, -61, + /* 40 */ 867, -61, -61, 65, -61, -61, -61, -61, -61, -61, + /* 50 */ -61, -61, 909, -61, 910, -61, -61, -61, -61, -61, + /* 60 */ 914, 962, 964, -61, -61, -61, -61, 968, -61, -61, + /* 70 */ 438, -61, 996, -61, -61, 116, -61, -61, -61, 293, + /* 80 */ -61, 1000, 1006, -61, 1011, 569, 1005, 1026, 1034, 1035, + /* 90 */ 1036, 1041, -61, 490, 394, 552, 394, 601, -61, -61, + /* 100 */ 1087, -61, 1093, -61, -61, -61, -61, -61, -61, -61, + /* 110 */ 603, 394, 53, -61, -61, 1082, 110, -61, -61, 229, + /* 120 */ -61, -61, -61, -61, 1019, -61, -61, -61, 1020, -61, + /* 130 */ -61, -61, -61, -61, -61, 640, -61, 394, 651, 394, + /* 140 */ 690, 394, 701, 394, 703, 394, 740, 394, 751, 394, + /* 150 */ 753, 394, 755, 394, 790, 394, 801, 394, 803, 394, + /* 160 */ 818, 394, 829, 394, 831, 394, 835, 394, 841, 394, + /* 170 */ -61, -61, -61, -61, -61, -61, 846, 188, 849, 394, + /* 180 */ -61, -61, -61, -61, -61, -61, -61, 879, 394, 881, + /* 190 */ 394, -61, 1102, -6, 1000, -61, -61, -61, -61, -61, + /* 200 */ 394, 887, 394, 898, 394, 918, 394, 936, 394, -61, + /* 210 */ 662, 1000, -61, 295, 394, 1037, 1039, -61, -61, 946, + /* 220 */ 394, 948, 394, -61, 1073, -61, -61, -61, 1114, -61, + /* 230 */ -61, 950, 394, 956, 394, 974, 394, -61, -61, 303, + /* 240 */ -61, -61, 1118, 1124, -61, -61, -61, 394, 984, 394, + /* 250 */ -61, 183, -61, 190, 1065, 1104, -61, 1119, -61, -61, + /* 260 */ 394, 1070, 1109, -61, 987, 394, -61, 187, -61, 1007, + /* 270 */ 394, -61, 398, 1083, -61, -61, -61, 1136, -61, 1138, + /* 280 */ -61, -61, -61, 1143, 1137, 389, 1144, -61, -61, 1090, + /* 290 */ 1094, -61, -61, 604, -61, -61, 1147, -61, -61, 1015, + /* 300 */ 394, 132, 1000, 1083, -61, 512, 1096, 1097, -61, 1018, + /* 310 */ 241, -61, -61, -61, 1087, -61, -61, 394, -61, -61, + /* 320 */ -61, -61, -61, 394, 1131, -61, 1155, 1132, 1130, 1133, + /* 330 */ -61, 1159, -61, -61, 1134, -61, -61, -61, -61, -61, + /* 340 */ -61, 1135, -61, 1139, -61, 439, -61, -61, 765, 1098, + /* 350 */ 1146, -61, -61, 1099, 1149, -61, -61, 1151, -61, 1145, + /* 360 */ -61, -61, 692, -61, 1022, 394, -61, 1150, -61, -61, + /* 370 */ 1153, -61, -61, -61, -61, 1156, 1158, -61, 1166, -61, + /* 380 */ -61, -61, 899, 1160, -61, 1161, -61, -61, 949, -61, + /* 390 */ 1163, -61, 1030, 375, -61, -61, -61, 979, -61, -61, + /* 400 */ 1180, 1162, 1168, 527, -61, -61, -61, -61, -61, -61, + /* 410 */ 712, 1000, 756, -61, 1181, 1179, -61, 1187, 1186, -61, + /* 420 */ 807, 1000, 1193, 1190, 1115, 1113, -61, 715, 1195, -61, + /* 430 */ 1117, 1120, -61, 1048, 394, -61, -61, -61, -61, -61, + /* 440 */ -61, -61, 709, -61, -61, -61, -61, -61, -61, -61, + /* 450 */ 1209, 1206, -61, 1211, -61, 997, -61, 1192, -61, -61, + /* 460 */ -61, 315, 1000, 1183, 732, -61, -61, -61, -61, -61, + /* 470 */ -61, 382, -61, 1191, 1228, -61, 808, 1185, 1232, -61, + /* 480 */ 1055, 394, -61, -61, 1064, 394, -61, 1236, 1171, 767, + /* 490 */ -61, -61, 854, 1000, -61, -18, -61, 1067, 394, -61, + /* 500 */ 394, -61, 1248, 1196, -61, -61, 815, -61, 891, -61, + /* 510 */ 895, -61, 906, -61, 1000, -61, 942, 1202, -61, 1215, + /* 520 */ 943, -61, 959, 1207, -61, -61, 975, 1194, 985, 1000, + /* 530 */ -61, 434, -61, -61, 1259, -61, 1262, 1257, -61, 435, + /* 540 */ -61, -61, -61, -61, 1267, -61, -61, 1188, 1263, -61, + /* 550 */ 1273, 1197, -61, 1264, -61, -61, -61, 1199, 1279, -61, + /* 560 */ 1284, 1278, -61, 1287, 1286, -61, -61, 522, -61, -61, + /* 570 */ 1291, -61, -61, 1204, -58, -61, -61, -61, -61, -61, + /* 580 */ -61, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 571, 571, 566, 569, 870, 870, 870, 570, 577, 870, - /* 10 */ 870, 870, 870, 597, 598, 599, 578, 579, 580, 870, - /* 20 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 30 */ 870, 870, 590, 600, 609, 592, 608, 870, 870, 610, - /* 40 */ 653, 616, 870, 870, 654, 657, 658, 659, 852, 853, - /* 50 */ 854, 870, 653, 617, 638, 636, 870, 639, 640, 870, - /* 60 */ 709, 653, 624, 618, 625, 707, 708, 653, 619, 870, - /* 70 */ 870, 739, 804, 745, 740, 736, 870, 664, 870, 870, - /* 80 */ 665, 673, 675, 682, 721, 712, 714, 702, 716, 670, - /* 90 */ 870, 717, 870, 718, 870, 738, 870, 870, 741, 870, - /* 100 */ 742, 743, 744, 746, 747, 748, 751, 752, 870, 753, - /* 110 */ 870, 754, 870, 755, 870, 756, 870, 757, 870, 758, - /* 120 */ 870, 759, 870, 760, 870, 761, 870, 762, 870, 763, - /* 130 */ 870, 764, 870, 765, 870, 766, 870, 767, 870, 768, - /* 140 */ 870, 769, 770, 870, 771, 778, 785, 788, 870, 773, - /* 150 */ 870, 772, 775, 870, 776, 870, 779, 777, 784, 870, - /* 160 */ 870, 870, 786, 787, 870, 804, 870, 870, 870, 870, - /* 170 */ 870, 791, 803, 870, 780, 870, 781, 870, 782, 870, - /* 180 */ 783, 870, 870, 870, 793, 870, 870, 870, 870, 870, - /* 190 */ 794, 870, 870, 870, 795, 870, 870, 870, 850, 870, - /* 200 */ 870, 870, 851, 870, 870, 870, 870, 870, 796, 870, - /* 210 */ 789, 804, 801, 802, 690, 870, 691, 792, 774, 870, - /* 220 */ 719, 870, 870, 703, 870, 710, 709, 704, 870, 594, - /* 230 */ 711, 706, 710, 709, 705, 870, 715, 870, 804, 713, - /* 240 */ 870, 722, 674, 685, 683, 684, 693, 694, 870, 695, - /* 250 */ 870, 696, 870, 697, 870, 690, 681, 595, 596, 870, - /* 260 */ 679, 680, 699, 701, 686, 870, 870, 870, 700, 870, - /* 270 */ 734, 735, 870, 698, 685, 870, 870, 870, 681, 699, - /* 280 */ 701, 687, 870, 681, 676, 677, 870, 870, 678, 671, - /* 290 */ 672, 790, 870, 737, 870, 749, 870, 750, 870, 653, - /* 300 */ 620, 870, 808, 626, 621, 627, 870, 628, 870, 870, - /* 310 */ 629, 870, 632, 633, 634, 635, 870, 630, 870, 631, - /* 320 */ 870, 870, 809, 870, 710, 709, 810, 812, 710, 709, - /* 330 */ 811, 622, 870, 623, 638, 637, 611, 870, 612, 870, - /* 340 */ 613, 745, 870, 614, 615, 601, 827, 870, 602, 827, - /* 350 */ 870, 603, 606, 607, 870, 822, 824, 825, 870, 823, - /* 360 */ 826, 605, 604, 593, 870, 870, 643, 870, 646, 870, - /* 370 */ 870, 870, 870, 870, 653, 647, 870, 870, 870, 653, - /* 380 */ 648, 870, 653, 649, 870, 870, 870, 870, 870, 870, - /* 390 */ 808, 626, 651, 870, 650, 652, 644, 645, 591, 870, - /* 400 */ 870, 587, 870, 870, 690, 585, 870, 870, 870, 870, - /* 410 */ 870, 870, 690, 833, 870, 870, 870, 690, 692, 838, - /* 420 */ 870, 870, 870, 870, 870, 870, 839, 840, 870, 870, - /* 430 */ 870, 870, 870, 830, 831, 870, 832, 586, 870, 870, - /* 440 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 450 */ 870, 870, 870, 870, 656, 870, 870, 870, 870, 870, - /* 460 */ 870, 870, 655, 870, 870, 870, 870, 870, 870, 870, - /* 470 */ 724, 870, 870, 870, 725, 870, 870, 732, 870, 870, - /* 480 */ 733, 870, 870, 870, 870, 870, 870, 730, 870, 731, - /* 490 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 500 */ 870, 870, 870, 870, 870, 870, 870, 870, 655, 870, - /* 510 */ 870, 870, 870, 870, 870, 870, 732, 870, 870, 870, - /* 520 */ 870, 870, 870, 870, 870, 870, 690, 870, 827, 870, - /* 530 */ 870, 870, 870, 870, 870, 870, 861, 870, 870, 870, - /* 540 */ 870, 870, 870, 870, 870, 860, 861, 870, 870, 870, - /* 550 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 868, - /* 560 */ 870, 870, 869, 572, 567, + /* 0 */ 587, 587, 582, 585, 892, 892, 892, 586, 594, 892, + /* 10 */ 892, 892, 892, 614, 615, 616, 595, 596, 597, 892, + /* 20 */ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892, + /* 30 */ 892, 892, 607, 617, 627, 609, 626, 892, 892, 628, + /* 40 */ 672, 635, 892, 892, 673, 676, 677, 678, 872, 873, + /* 50 */ 874, 892, 672, 636, 657, 655, 892, 658, 659, 892, + /* 60 */ 728, 672, 643, 637, 644, 726, 727, 672, 638, 892, + /* 70 */ 892, 758, 692, 690, 691, 824, 764, 759, 755, 892, + /* 80 */ 683, 892, 892, 684, 692, 694, 701, 740, 731, 733, + /* 90 */ 721, 735, 689, 892, 736, 892, 737, 892, 757, 892, + /* 100 */ 892, 760, 892, 761, 762, 763, 765, 766, 767, 892, + /* 110 */ 892, 892, 892, 612, 613, 619, 847, 892, 620, 847, + /* 120 */ 892, 621, 624, 625, 892, 842, 844, 845, 892, 843, + /* 130 */ 846, 623, 622, 892, 768, 892, 771, 773, 892, 774, + /* 140 */ 892, 775, 892, 776, 892, 777, 892, 778, 892, 779, + /* 150 */ 892, 780, 892, 781, 892, 782, 892, 783, 892, 784, + /* 160 */ 892, 785, 892, 786, 892, 787, 892, 788, 892, 789, + /* 170 */ 790, 892, 791, 798, 805, 808, 892, 793, 892, 792, + /* 180 */ 795, 892, 796, 892, 799, 797, 804, 892, 892, 892, + /* 190 */ 806, 807, 892, 824, 892, 892, 892, 892, 892, 811, + /* 200 */ 823, 892, 800, 892, 801, 892, 802, 892, 803, 892, + /* 210 */ 892, 892, 813, 892, 892, 892, 892, 892, 814, 892, + /* 220 */ 892, 892, 815, 892, 892, 892, 870, 892, 892, 892, + /* 230 */ 871, 892, 892, 892, 892, 892, 816, 892, 809, 824, + /* 240 */ 821, 822, 709, 892, 710, 812, 794, 772, 892, 738, + /* 250 */ 892, 892, 722, 892, 729, 728, 723, 892, 611, 730, + /* 260 */ 725, 729, 728, 724, 892, 734, 892, 824, 732, 892, + /* 270 */ 741, 693, 704, 702, 703, 712, 713, 892, 714, 892, + /* 280 */ 715, 892, 716, 892, 709, 700, 892, 698, 699, 718, + /* 290 */ 720, 705, 892, 892, 892, 719, 892, 753, 754, 892, + /* 300 */ 717, 704, 892, 892, 892, 700, 718, 720, 706, 892, + /* 310 */ 700, 695, 696, 892, 892, 697, 810, 892, 756, 892, + /* 320 */ 769, 892, 770, 892, 672, 639, 892, 828, 645, 640, + /* 330 */ 646, 892, 647, 892, 892, 648, 892, 651, 652, 653, + /* 340 */ 654, 892, 649, 892, 650, 892, 892, 829, 892, 729, + /* 350 */ 728, 830, 832, 729, 728, 831, 641, 892, 642, 657, + /* 360 */ 656, 629, 892, 630, 892, 892, 631, 892, 632, 764, + /* 370 */ 892, 633, 634, 618, 610, 892, 892, 662, 892, 665, + /* 380 */ 892, 892, 892, 892, 892, 672, 666, 892, 892, 892, + /* 390 */ 672, 667, 892, 672, 668, 892, 892, 892, 892, 892, + /* 400 */ 892, 828, 645, 670, 892, 669, 671, 663, 664, 608, + /* 410 */ 892, 892, 604, 892, 892, 709, 602, 892, 892, 892, + /* 420 */ 892, 892, 892, 709, 853, 892, 892, 892, 709, 711, + /* 430 */ 858, 892, 892, 892, 892, 892, 892, 859, 860, 892, + /* 440 */ 892, 892, 892, 892, 850, 851, 892, 852, 603, 892, + /* 450 */ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892, + /* 460 */ 892, 892, 892, 892, 892, 675, 892, 892, 892, 892, + /* 470 */ 892, 892, 892, 674, 892, 892, 892, 892, 892, 892, + /* 480 */ 892, 743, 892, 892, 892, 744, 892, 892, 751, 892, + /* 490 */ 892, 752, 892, 892, 892, 892, 892, 892, 749, 892, + /* 500 */ 750, 892, 892, 892, 892, 892, 892, 892, 892, 892, + /* 510 */ 892, 892, 892, 892, 892, 892, 892, 892, 892, 674, + /* 520 */ 892, 892, 892, 892, 892, 892, 892, 751, 892, 892, + /* 530 */ 892, 892, 892, 892, 892, 892, 892, 709, 892, 847, + /* 540 */ 892, 892, 892, 892, 892, 892, 892, 881, 892, 892, + /* 550 */ 892, 892, 892, 892, 892, 892, 880, 881, 892, 892, + /* 560 */ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892, + /* 570 */ 892, 892, 892, 890, 892, 892, 891, 588, 892, 589, + /* 580 */ 583, }; #define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0])) @@ -660,59 +678,64 @@ 0, /* FUNCTION => nothing */ 0, /* COLUMN => nothing */ 0, /* AGG_FUNCTION => nothing */ + 0, /* AGG_COLUMN => nothing */ 0, /* CONST_FUNC => nothing */ 0, /* SEMI => nothing */ - 27, /* EXPLAIN => ID */ - 27, /* BEGIN => ID */ + 30, /* EXPLAIN => ID */ + 30, /* QUERY => ID */ + 30, /* PLAN => ID */ + 30, /* BEGIN => ID */ 0, /* TRANSACTION => nothing */ - 27, /* DEFERRED => ID */ - 27, /* IMMEDIATE => ID */ - 27, /* EXCLUSIVE => ID */ + 30, /* DEFERRED => ID */ + 30, /* IMMEDIATE => ID */ + 30, /* EXCLUSIVE => ID */ 0, /* COMMIT => nothing */ - 27, /* END => ID */ + 30, /* END => ID */ 0, /* ROLLBACK => nothing */ 0, /* CREATE => nothing */ 0, /* TABLE => nothing */ - 27, /* TEMP => ID */ + 30, /* TEMP => ID */ 0, /* LP => nothing */ 0, /* RP => nothing */ 0, /* AS => nothing */ 0, /* COMMA => nothing */ 0, /* ID => nothing */ - 27, /* ABORT => ID */ - 27, /* AFTER => ID */ - 27, /* ASC => ID */ - 27, /* ATTACH => ID */ - 27, /* BEFORE => ID */ - 27, /* CASCADE => ID */ - 27, /* CONFLICT => ID */ - 27, /* DATABASE => ID */ - 27, /* DESC => ID */ - 27, /* DETACH => ID */ - 27, /* EACH => ID */ - 27, /* FAIL => ID */ - 27, /* FOR => ID */ - 27, /* IGNORE => ID */ - 27, /* INITIALLY => ID */ - 27, /* INSTEAD => ID */ - 27, /* LIKE_KW => ID */ - 27, /* MATCH => ID */ - 27, /* KEY => ID */ - 27, /* OF => ID */ - 27, /* OFFSET => ID */ - 27, /* PRAGMA => ID */ - 27, /* RAISE => ID */ - 27, /* REPLACE => ID */ - 27, /* RESTRICT => ID */ - 27, /* ROW => ID */ - 27, /* STATEMENT => ID */ - 27, /* TRIGGER => ID */ - 27, /* VACUUM => ID */ - 27, /* VIEW => ID */ - 27, /* REINDEX => ID */ - 27, /* RENAME => ID */ - 27, /* CTIME_KW => ID */ - 27, /* ALTER => ID */ + 30, /* ABORT => ID */ + 30, /* AFTER => ID */ + 30, /* ANALYZE => ID */ + 30, /* ASC => ID */ + 30, /* ATTACH => ID */ + 30, /* BEFORE => ID */ + 30, /* CASCADE => ID */ + 30, /* CAST => ID */ + 30, /* CONFLICT => ID */ + 30, /* DATABASE => ID */ + 30, /* DESC => ID */ + 30, /* DETACH => ID */ + 30, /* EACH => ID */ + 30, /* FAIL => ID */ + 30, /* FOR => ID */ + 30, /* IGNORE => ID */ + 30, /* INITIALLY => ID */ + 30, /* INSTEAD => ID */ + 30, /* LIKE_KW => ID */ + 30, /* MATCH => ID */ + 30, /* KEY => ID */ + 30, /* OF => ID */ + 30, /* OFFSET => ID */ + 30, /* PRAGMA => ID */ + 30, /* RAISE => ID */ + 30, /* REPLACE => ID */ + 30, /* RESTRICT => ID */ + 30, /* ROW => ID */ + 30, /* STATEMENT => ID */ + 30, /* TRIGGER => ID */ + 30, /* VACUUM => ID */ + 30, /* VIEW => ID */ + 30, /* REINDEX => ID */ + 30, /* RENAME => ID */ + 30, /* CTIME_KW => ID */ + 30, /* ALTER => ID */ 0, /* OR => nothing */ 0, /* AND => nothing */ 0, /* NOT => nothing */ @@ -864,64 +887,66 @@ static const char *const yyTokenName[] = { "$", "END_OF_FILE", "ILLEGAL", "SPACE", "UNCLOSED_STRING", "COMMENT", "FUNCTION", "COLUMN", - "AGG_FUNCTION", "CONST_FUNC", "SEMI", "EXPLAIN", - "BEGIN", "TRANSACTION", "DEFERRED", "IMMEDIATE", - "EXCLUSIVE", "COMMIT", "END", "ROLLBACK", - "CREATE", "TABLE", "TEMP", "LP", - "RP", "AS", "COMMA", "ID", - "ABORT", "AFTER", "ASC", "ATTACH", - "BEFORE", "CASCADE", "CONFLICT", "DATABASE", - "DESC", "DETACH", "EACH", "FAIL", - "FOR", "IGNORE", "INITIALLY", "INSTEAD", - "LIKE_KW", "MATCH", "KEY", "OF", - "OFFSET", "PRAGMA", "RAISE", "REPLACE", - "RESTRICT", "ROW", "STATEMENT", "TRIGGER", - "VACUUM", "VIEW", "REINDEX", "RENAME", - "CTIME_KW", "ALTER", "OR", "AND", - "NOT", "IS", "BETWEEN", "IN", - "ISNULL", "NOTNULL", "NE", "EQ", - "GT", "LE", "LT", "GE", - "ESCAPE", "BITAND", "BITOR", "LSHIFT", - "RSHIFT", "PLUS", "MINUS", "STAR", - "SLASH", "REM", "CONCAT", "UMINUS", - "UPLUS", "BITNOT", "STRING", "JOIN_KW", - "CONSTRAINT", "DEFAULT", "NULL", "PRIMARY", - "UNIQUE", "CHECK", "REFERENCES", "COLLATE", - "AUTOINCR", "ON", "DELETE", "UPDATE", - "INSERT", "SET", "DEFERRABLE", "FOREIGN", - "DROP", "UNION", "ALL", "INTERSECT", - "EXCEPT", "SELECT", "DISTINCT", "DOT", - "FROM", "JOIN", "USING", "ORDER", - "BY", "GROUP", "HAVING", "LIMIT", - "WHERE", "INTO", "VALUES", "INTEGER", - "FLOAT", "BLOB", "REGISTER", "VARIABLE", - "EXISTS", "CASE", "WHEN", "THEN", - "ELSE", "INDEX", "TO", "ADD", - "COLUMNKW", "error", "input", "cmdlist", - "ecmd", "cmdx", "cmd", "explain", - "transtype", "trans_opt", "nm", "create_table", - "create_table_args", "temp", "dbnm", "columnlist", - "conslist_opt", "select", "column", "columnid", - "type", "carglist", "id", "ids", - "typename", "signed", "plus_num", "minus_num", - "carg", "ccons", "term", "onconf", - "sortorder", "autoinc", "expr", "idxlist_opt", - "refargs", "defer_subclause", "refarg", "refact", - "init_deferred_pred_opt", "conslist", "tcons", "idxlist", - "defer_subclause_opt", "orconf", "resolvetype", "raisetype", - "fullname", "oneselect", "multiselect_op", "distinct", - "selcollist", "from", "where_opt", "groupby_opt", - "having_opt", "orderby_opt", "limit_opt", "sclp", - "as", "seltablist", "stl_prefix", "joinop", - "on_opt", "using_opt", "seltablist_paren", "joinop2", - "inscollist", "sortlist", "sortitem", "collate", - "exprlist", "setlist", "insert_cmd", "inscollist_opt", - "itemlist", "likeop", "escape", "between_op", - "in_op", "case_operand", "case_exprlist", "case_else", - "expritem", "uniqueflag", "idxitem", "plus_opt", - "number", "trigger_decl", "trigger_cmd_list", "trigger_time", - "trigger_event", "foreach_clause", "when_clause", "trigger_cmd", - "database_kw_opt", "key_opt", "add_column_fullname", "kwcolumn_opt", + "AGG_FUNCTION", "AGG_COLUMN", "CONST_FUNC", "SEMI", + "EXPLAIN", "QUERY", "PLAN", "BEGIN", + "TRANSACTION", "DEFERRED", "IMMEDIATE", "EXCLUSIVE", + "COMMIT", "END", "ROLLBACK", "CREATE", + "TABLE", "TEMP", "LP", "RP", + "AS", "COMMA", "ID", "ABORT", + "AFTER", "ANALYZE", "ASC", "ATTACH", + "BEFORE", "CASCADE", "CAST", "CONFLICT", + "DATABASE", "DESC", "DETACH", "EACH", + "FAIL", "FOR", "IGNORE", "INITIALLY", + "INSTEAD", "LIKE_KW", "MATCH", "KEY", + "OF", "OFFSET", "PRAGMA", "RAISE", + "REPLACE", "RESTRICT", "ROW", "STATEMENT", + "TRIGGER", "VACUUM", "VIEW", "REINDEX", + "RENAME", "CTIME_KW", "ALTER", "OR", + "AND", "NOT", "IS", "BETWEEN", + "IN", "ISNULL", "NOTNULL", "NE", + "EQ", "GT", "LE", "LT", + "GE", "ESCAPE", "BITAND", "BITOR", + "LSHIFT", "RSHIFT", "PLUS", "MINUS", + "STAR", "SLASH", "REM", "CONCAT", + "UMINUS", "UPLUS", "BITNOT", "STRING", + "JOIN_KW", "CONSTRAINT", "DEFAULT", "NULL", + "PRIMARY", "UNIQUE", "CHECK", "REFERENCES", + "COLLATE", "AUTOINCR", "ON", "DELETE", + "UPDATE", "INSERT", "SET", "DEFERRABLE", + "FOREIGN", "DROP", "UNION", "ALL", + "INTERSECT", "EXCEPT", "SELECT", "DISTINCT", + "DOT", "FROM", "JOIN", "USING", + "ORDER", "BY", "GROUP", "HAVING", + "LIMIT", "WHERE", "INTO", "VALUES", + "INTEGER", "FLOAT", "BLOB", "REGISTER", + "VARIABLE", "EXISTS", "CASE", "WHEN", + "THEN", "ELSE", "INDEX", "TO", + "ADD", "COLUMNKW", "error", "input", + "cmdlist", "ecmd", "cmdx", "cmd", + "explain", "transtype", "trans_opt", "nm", + "create_table", "create_table_args", "temp", "dbnm", + "columnlist", "conslist_opt", "select", "column", + "columnid", "type", "carglist", "id", + "ids", "typetoken", "typename", "signed", + "plus_num", "minus_num", "carg", "ccons", + "term", "expr", "onconf", "sortorder", + "autoinc", "idxlist_opt", "refargs", "defer_subclause", + "refarg", "refact", "init_deferred_pred_opt", "conslist", + "tcons", "idxlist", "defer_subclause_opt", "orconf", + "resolvetype", "raisetype", "fullname", "oneselect", + "multiselect_op", "distinct", "selcollist", "from", + "where_opt", "groupby_opt", "having_opt", "orderby_opt", + "limit_opt", "sclp", "as", "seltablist", + "stl_prefix", "joinop", "on_opt", "using_opt", + "seltablist_paren", "joinop2", "inscollist", "sortlist", + "sortitem", "collate", "exprlist", "setlist", + "insert_cmd", "inscollist_opt", "itemlist", "likeop", + "escape", "between_op", "in_op", "case_operand", + "case_exprlist", "case_else", "expritem", "uniqueflag", + "idxitem", "plus_opt", "number", "trigger_decl", + "trigger_cmd_list", "trigger_time", "trigger_event", "foreach_clause", + "when_clause", "trigger_cmd", "database_kw_opt", "key_opt", + "add_column_fullname", "kwcolumn_opt", }; #endif /* NDEBUG */ @@ -937,303 +962,309 @@ /* 5 */ "ecmd ::= explain cmdx SEMI", /* 6 */ "explain ::=", /* 7 */ "explain ::= EXPLAIN", - /* 8 */ "cmd ::= BEGIN transtype trans_opt", - /* 9 */ "trans_opt ::=", - /* 10 */ "trans_opt ::= TRANSACTION", - /* 11 */ "trans_opt ::= TRANSACTION nm", - /* 12 */ "transtype ::=", - /* 13 */ "transtype ::= DEFERRED", - /* 14 */ "transtype ::= IMMEDIATE", - /* 15 */ "transtype ::= EXCLUSIVE", - /* 16 */ "cmd ::= COMMIT trans_opt", - /* 17 */ "cmd ::= END trans_opt", - /* 18 */ "cmd ::= ROLLBACK trans_opt", - /* 19 */ "cmd ::= create_table create_table_args", - /* 20 */ "create_table ::= CREATE temp TABLE nm dbnm", - /* 21 */ "temp ::= TEMP", - /* 22 */ "temp ::=", - /* 23 */ "create_table_args ::= LP columnlist conslist_opt RP", - /* 24 */ "create_table_args ::= AS select", - /* 25 */ "columnlist ::= columnlist COMMA column", - /* 26 */ "columnlist ::= column", - /* 27 */ "column ::= columnid type carglist", - /* 28 */ "columnid ::= nm", - /* 29 */ "id ::= ID", - /* 30 */ "ids ::= ID", - /* 31 */ "ids ::= STRING", - /* 32 */ "nm ::= ID", - /* 33 */ "nm ::= STRING", - /* 34 */ "nm ::= JOIN_KW", - /* 35 */ "type ::=", - /* 36 */ "type ::= typename", - /* 37 */ "type ::= typename LP signed RP", - /* 38 */ "type ::= typename LP signed COMMA signed RP", - /* 39 */ "typename ::= ids", - /* 40 */ "typename ::= typename ids", - /* 41 */ "signed ::= plus_num", - /* 42 */ "signed ::= minus_num", - /* 43 */ "carglist ::= carglist carg", - /* 44 */ "carglist ::=", - /* 45 */ "carg ::= CONSTRAINT nm ccons", - /* 46 */ "carg ::= ccons", - /* 47 */ "carg ::= DEFAULT term", - /* 48 */ "carg ::= DEFAULT PLUS term", - /* 49 */ "carg ::= DEFAULT MINUS term", - /* 50 */ "carg ::= DEFAULT id", - /* 51 */ "ccons ::= NULL onconf", - /* 52 */ "ccons ::= NOT NULL onconf", - /* 53 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc", - /* 54 */ "ccons ::= UNIQUE onconf", - /* 55 */ "ccons ::= CHECK LP expr RP onconf", - /* 56 */ "ccons ::= REFERENCES nm idxlist_opt refargs", - /* 57 */ "ccons ::= defer_subclause", - /* 58 */ "ccons ::= COLLATE id", - /* 59 */ "autoinc ::=", - /* 60 */ "autoinc ::= AUTOINCR", - /* 61 */ "refargs ::=", - /* 62 */ "refargs ::= refargs refarg", - /* 63 */ "refarg ::= MATCH nm", - /* 64 */ "refarg ::= ON DELETE refact", - /* 65 */ "refarg ::= ON UPDATE refact", - /* 66 */ "refarg ::= ON INSERT refact", - /* 67 */ "refact ::= SET NULL", - /* 68 */ "refact ::= SET DEFAULT", - /* 69 */ "refact ::= CASCADE", - /* 70 */ "refact ::= RESTRICT", - /* 71 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt", - /* 72 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt", - /* 73 */ "init_deferred_pred_opt ::=", - /* 74 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED", - /* 75 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE", - /* 76 */ "conslist_opt ::=", - /* 77 */ "conslist_opt ::= COMMA conslist", - /* 78 */ "conslist ::= conslist COMMA tcons", - /* 79 */ "conslist ::= conslist tcons", - /* 80 */ "conslist ::= tcons", - /* 81 */ "tcons ::= CONSTRAINT nm", - /* 82 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf", - /* 83 */ "tcons ::= UNIQUE LP idxlist RP onconf", - /* 84 */ "tcons ::= CHECK expr onconf", - /* 85 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt", - /* 86 */ "defer_subclause_opt ::=", - /* 87 */ "defer_subclause_opt ::= defer_subclause", - /* 88 */ "onconf ::=", - /* 89 */ "onconf ::= ON CONFLICT resolvetype", - /* 90 */ "orconf ::=", - /* 91 */ "orconf ::= OR resolvetype", - /* 92 */ "resolvetype ::= raisetype", - /* 93 */ "resolvetype ::= IGNORE", - /* 94 */ "resolvetype ::= REPLACE", - /* 95 */ "cmd ::= DROP TABLE fullname", - /* 96 */ "cmd ::= CREATE temp VIEW nm dbnm AS select", - /* 97 */ "cmd ::= DROP VIEW fullname", - /* 98 */ "cmd ::= select", - /* 99 */ "select ::= oneselect", - /* 100 */ "select ::= select multiselect_op oneselect", - /* 101 */ "multiselect_op ::= UNION", - /* 102 */ "multiselect_op ::= UNION ALL", - /* 103 */ "multiselect_op ::= INTERSECT", - /* 104 */ "multiselect_op ::= EXCEPT", - /* 105 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", - /* 106 */ "distinct ::= DISTINCT", - /* 107 */ "distinct ::= ALL", - /* 108 */ "distinct ::=", - /* 109 */ "sclp ::= selcollist COMMA", - /* 110 */ "sclp ::=", - /* 111 */ "selcollist ::= sclp expr as", - /* 112 */ "selcollist ::= sclp STAR", - /* 113 */ "selcollist ::= sclp nm DOT STAR", - /* 114 */ "as ::= AS nm", - /* 115 */ "as ::= ids", - /* 116 */ "as ::=", - /* 117 */ "from ::=", - /* 118 */ "from ::= FROM seltablist", - /* 119 */ "stl_prefix ::= seltablist joinop", - /* 120 */ "stl_prefix ::=", - /* 121 */ "seltablist ::= stl_prefix nm dbnm as on_opt using_opt", - /* 122 */ "seltablist ::= stl_prefix LP seltablist_paren RP as on_opt using_opt", - /* 123 */ "seltablist_paren ::= select", - /* 124 */ "seltablist_paren ::= seltablist", - /* 125 */ "dbnm ::=", - /* 126 */ "dbnm ::= DOT nm", - /* 127 */ "fullname ::= nm dbnm", - /* 128 */ "joinop ::= COMMA", - /* 129 */ "joinop ::= JOIN", - /* 130 */ "joinop ::= JOIN_KW JOIN", - /* 131 */ "joinop ::= JOIN_KW nm JOIN", - /* 132 */ "joinop ::= JOIN_KW nm nm JOIN", - /* 133 */ "on_opt ::= ON expr", - /* 134 */ "on_opt ::=", - /* 135 */ "using_opt ::= USING LP inscollist RP", - /* 136 */ "using_opt ::=", - /* 137 */ "orderby_opt ::=", - /* 138 */ "orderby_opt ::= ORDER BY sortlist", - /* 139 */ "sortlist ::= sortlist COMMA sortitem collate sortorder", - /* 140 */ "sortlist ::= sortitem collate sortorder", - /* 141 */ "sortitem ::= expr", - /* 142 */ "sortorder ::= ASC", - /* 143 */ "sortorder ::= DESC", - /* 144 */ "sortorder ::=", - /* 145 */ "collate ::=", - /* 146 */ "collate ::= COLLATE id", - /* 147 */ "groupby_opt ::=", - /* 148 */ "groupby_opt ::= GROUP BY exprlist", - /* 149 */ "having_opt ::=", - /* 150 */ "having_opt ::= HAVING expr", - /* 151 */ "limit_opt ::=", - /* 152 */ "limit_opt ::= LIMIT expr", - /* 153 */ "limit_opt ::= LIMIT expr OFFSET expr", - /* 154 */ "limit_opt ::= LIMIT expr COMMA expr", - /* 155 */ "cmd ::= DELETE FROM fullname where_opt", - /* 156 */ "where_opt ::=", - /* 157 */ "where_opt ::= WHERE expr", - /* 158 */ "cmd ::= UPDATE orconf fullname SET setlist where_opt", - /* 159 */ "setlist ::= setlist COMMA nm EQ expr", - /* 160 */ "setlist ::= nm EQ expr", - /* 161 */ "cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP", - /* 162 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select", - /* 163 */ "insert_cmd ::= INSERT orconf", - /* 164 */ "insert_cmd ::= REPLACE", - /* 165 */ "itemlist ::= itemlist COMMA expr", - /* 166 */ "itemlist ::= expr", - /* 167 */ "inscollist_opt ::=", - /* 168 */ "inscollist_opt ::= LP inscollist RP", - /* 169 */ "inscollist ::= inscollist COMMA nm", - /* 170 */ "inscollist ::= nm", - /* 171 */ "expr ::= term", - /* 172 */ "expr ::= LP expr RP", - /* 173 */ "term ::= NULL", - /* 174 */ "expr ::= ID", - /* 175 */ "expr ::= JOIN_KW", - /* 176 */ "expr ::= nm DOT nm", - /* 177 */ "expr ::= nm DOT nm DOT nm", - /* 178 */ "term ::= INTEGER", - /* 179 */ "term ::= FLOAT", - /* 180 */ "term ::= STRING", - /* 181 */ "term ::= BLOB", - /* 182 */ "expr ::= REGISTER", - /* 183 */ "expr ::= VARIABLE", - /* 184 */ "expr ::= ID LP exprlist RP", - /* 185 */ "expr ::= ID LP STAR RP", - /* 186 */ "term ::= CTIME_KW", - /* 187 */ "expr ::= expr AND expr", - /* 188 */ "expr ::= expr OR expr", - /* 189 */ "expr ::= expr LT expr", - /* 190 */ "expr ::= expr GT expr", - /* 191 */ "expr ::= expr LE expr", - /* 192 */ "expr ::= expr GE expr", - /* 193 */ "expr ::= expr NE expr", - /* 194 */ "expr ::= expr EQ expr", - /* 195 */ "expr ::= expr BITAND expr", - /* 196 */ "expr ::= expr BITOR expr", - /* 197 */ "expr ::= expr LSHIFT expr", - /* 198 */ "expr ::= expr RSHIFT expr", - /* 199 */ "expr ::= expr PLUS expr", - /* 200 */ "expr ::= expr MINUS expr", - /* 201 */ "expr ::= expr STAR expr", - /* 202 */ "expr ::= expr SLASH expr", - /* 203 */ "expr ::= expr REM expr", - /* 204 */ "expr ::= expr CONCAT expr", - /* 205 */ "likeop ::= LIKE_KW", - /* 206 */ "likeop ::= NOT LIKE_KW", - /* 207 */ "escape ::= ESCAPE expr", - /* 208 */ "escape ::=", - /* 209 */ "expr ::= expr likeop expr escape", - /* 210 */ "expr ::= expr ISNULL", - /* 211 */ "expr ::= expr IS NULL", - /* 212 */ "expr ::= expr NOTNULL", - /* 213 */ "expr ::= expr NOT NULL", - /* 214 */ "expr ::= expr IS NOT NULL", - /* 215 */ "expr ::= NOT expr", - /* 216 */ "expr ::= BITNOT expr", - /* 217 */ "expr ::= MINUS expr", - /* 218 */ "expr ::= PLUS expr", - /* 219 */ "between_op ::= BETWEEN", - /* 220 */ "between_op ::= NOT BETWEEN", - /* 221 */ "expr ::= expr between_op expr AND expr", - /* 222 */ "in_op ::= IN", - /* 223 */ "in_op ::= NOT IN", - /* 224 */ "expr ::= expr in_op LP exprlist RP", - /* 225 */ "expr ::= LP select RP", - /* 226 */ "expr ::= expr in_op LP select RP", - /* 227 */ "expr ::= expr in_op nm dbnm", - /* 228 */ "expr ::= EXISTS LP select RP", - /* 229 */ "expr ::= CASE case_operand case_exprlist case_else END", - /* 230 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", - /* 231 */ "case_exprlist ::= WHEN expr THEN expr", - /* 232 */ "case_else ::= ELSE expr", - /* 233 */ "case_else ::=", - /* 234 */ "case_operand ::= expr", - /* 235 */ "case_operand ::=", - /* 236 */ "exprlist ::= exprlist COMMA expritem", - /* 237 */ "exprlist ::= expritem", - /* 238 */ "expritem ::= expr", - /* 239 */ "expritem ::=", - /* 240 */ "cmd ::= CREATE uniqueflag INDEX nm dbnm ON nm LP idxlist RP onconf", - /* 241 */ "uniqueflag ::= UNIQUE", - /* 242 */ "uniqueflag ::=", - /* 243 */ "idxlist_opt ::=", - /* 244 */ "idxlist_opt ::= LP idxlist RP", - /* 245 */ "idxlist ::= idxlist COMMA idxitem collate sortorder", - /* 246 */ "idxlist ::= idxitem collate sortorder", - /* 247 */ "idxitem ::= nm", - /* 248 */ "cmd ::= DROP INDEX fullname", - /* 249 */ "cmd ::= VACUUM", - /* 250 */ "cmd ::= VACUUM nm", - /* 251 */ "cmd ::= PRAGMA nm dbnm EQ nm", - /* 252 */ "cmd ::= PRAGMA nm dbnm EQ ON", - /* 253 */ "cmd ::= PRAGMA nm dbnm EQ plus_num", - /* 254 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", - /* 255 */ "cmd ::= PRAGMA nm dbnm LP nm RP", - /* 256 */ "cmd ::= PRAGMA nm dbnm", - /* 257 */ "plus_num ::= plus_opt number", - /* 258 */ "minus_num ::= MINUS number", - /* 259 */ "number ::= INTEGER", - /* 260 */ "number ::= FLOAT", - /* 261 */ "plus_opt ::= PLUS", - /* 262 */ "plus_opt ::=", - /* 263 */ "cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END", - /* 264 */ "trigger_decl ::= temp TRIGGER nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", - /* 265 */ "trigger_time ::= BEFORE", - /* 266 */ "trigger_time ::= AFTER", - /* 267 */ "trigger_time ::= INSTEAD OF", - /* 268 */ "trigger_time ::=", - /* 269 */ "trigger_event ::= DELETE", - /* 270 */ "trigger_event ::= INSERT", - /* 271 */ "trigger_event ::= UPDATE", - /* 272 */ "trigger_event ::= UPDATE OF inscollist", - /* 273 */ "foreach_clause ::=", - /* 274 */ "foreach_clause ::= FOR EACH ROW", - /* 275 */ "foreach_clause ::= FOR EACH STATEMENT", - /* 276 */ "when_clause ::=", - /* 277 */ "when_clause ::= WHEN expr", - /* 278 */ "trigger_cmd_list ::= trigger_cmd SEMI trigger_cmd_list", - /* 279 */ "trigger_cmd_list ::=", - /* 280 */ "trigger_cmd ::= UPDATE orconf nm SET setlist where_opt", - /* 281 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP", - /* 282 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt select", - /* 283 */ "trigger_cmd ::= DELETE FROM nm where_opt", - /* 284 */ "trigger_cmd ::= select", - /* 285 */ "expr ::= RAISE LP IGNORE RP", - /* 286 */ "expr ::= RAISE LP raisetype COMMA nm RP", - /* 287 */ "raisetype ::= ROLLBACK", - /* 288 */ "raisetype ::= ABORT", - /* 289 */ "raisetype ::= FAIL", - /* 290 */ "cmd ::= DROP TRIGGER fullname", - /* 291 */ "cmd ::= ATTACH database_kw_opt ids AS nm key_opt", - /* 292 */ "key_opt ::=", - /* 293 */ "key_opt ::= KEY ids", - /* 294 */ "key_opt ::= KEY BLOB", - /* 295 */ "database_kw_opt ::= DATABASE", - /* 296 */ "database_kw_opt ::=", - /* 297 */ "cmd ::= DETACH database_kw_opt nm", - /* 298 */ "cmd ::= REINDEX", - /* 299 */ "cmd ::= REINDEX nm dbnm", - /* 300 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", - /* 301 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column", - /* 302 */ "add_column_fullname ::= fullname", - /* 303 */ "kwcolumn_opt ::=", - /* 304 */ "kwcolumn_opt ::= COLUMNKW", + /* 8 */ "explain ::= EXPLAIN QUERY PLAN", + /* 9 */ "cmd ::= BEGIN transtype trans_opt", + /* 10 */ "trans_opt ::=", + /* 11 */ "trans_opt ::= TRANSACTION", + /* 12 */ "trans_opt ::= TRANSACTION nm", + /* 13 */ "transtype ::=", + /* 14 */ "transtype ::= DEFERRED", + /* 15 */ "transtype ::= IMMEDIATE", + /* 16 */ "transtype ::= EXCLUSIVE", + /* 17 */ "cmd ::= COMMIT trans_opt", + /* 18 */ "cmd ::= END trans_opt", + /* 19 */ "cmd ::= ROLLBACK trans_opt", + /* 20 */ "cmd ::= create_table create_table_args", + /* 21 */ "create_table ::= CREATE temp TABLE nm dbnm", + /* 22 */ "temp ::= TEMP", + /* 23 */ "temp ::=", + /* 24 */ "create_table_args ::= LP columnlist conslist_opt RP", + /* 25 */ "create_table_args ::= AS select", + /* 26 */ "columnlist ::= columnlist COMMA column", + /* 27 */ "columnlist ::= column", + /* 28 */ "column ::= columnid type carglist", + /* 29 */ "columnid ::= nm", + /* 30 */ "id ::= ID", + /* 31 */ "ids ::= ID", + /* 32 */ "ids ::= STRING", + /* 33 */ "nm ::= ID", + /* 34 */ "nm ::= STRING", + /* 35 */ "nm ::= JOIN_KW", + /* 36 */ "type ::=", + /* 37 */ "type ::= typetoken", + /* 38 */ "typetoken ::= typename", + /* 39 */ "typetoken ::= typename LP signed RP", + /* 40 */ "typetoken ::= typename LP signed COMMA signed RP", + /* 41 */ "typename ::= ids", + /* 42 */ "typename ::= typename ids", + /* 43 */ "signed ::= plus_num", + /* 44 */ "signed ::= minus_num", + /* 45 */ "carglist ::= carglist carg", + /* 46 */ "carglist ::=", + /* 47 */ "carg ::= CONSTRAINT nm ccons", + /* 48 */ "carg ::= ccons", + /* 49 */ "carg ::= DEFAULT term", + /* 50 */ "carg ::= DEFAULT LP expr RP", + /* 51 */ "carg ::= DEFAULT PLUS term", + /* 52 */ "carg ::= DEFAULT MINUS term", + /* 53 */ "carg ::= DEFAULT id", + /* 54 */ "ccons ::= NULL onconf", + /* 55 */ "ccons ::= NOT NULL onconf", + /* 56 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc", + /* 57 */ "ccons ::= UNIQUE onconf", + /* 58 */ "ccons ::= CHECK LP expr RP onconf", + /* 59 */ "ccons ::= REFERENCES nm idxlist_opt refargs", + /* 60 */ "ccons ::= defer_subclause", + /* 61 */ "ccons ::= COLLATE id", + /* 62 */ "autoinc ::=", + /* 63 */ "autoinc ::= AUTOINCR", + /* 64 */ "refargs ::=", + /* 65 */ "refargs ::= refargs refarg", + /* 66 */ "refarg ::= MATCH nm", + /* 67 */ "refarg ::= ON DELETE refact", + /* 68 */ "refarg ::= ON UPDATE refact", + /* 69 */ "refarg ::= ON INSERT refact", + /* 70 */ "refact ::= SET NULL", + /* 71 */ "refact ::= SET DEFAULT", + /* 72 */ "refact ::= CASCADE", + /* 73 */ "refact ::= RESTRICT", + /* 74 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt", + /* 75 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt", + /* 76 */ "init_deferred_pred_opt ::=", + /* 77 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED", + /* 78 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE", + /* 79 */ "conslist_opt ::=", + /* 80 */ "conslist_opt ::= COMMA conslist", + /* 81 */ "conslist ::= conslist COMMA tcons", + /* 82 */ "conslist ::= conslist tcons", + /* 83 */ "conslist ::= tcons", + /* 84 */ "tcons ::= CONSTRAINT nm", + /* 85 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf", + /* 86 */ "tcons ::= UNIQUE LP idxlist RP onconf", + /* 87 */ "tcons ::= CHECK expr onconf", + /* 88 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt", + /* 89 */ "defer_subclause_opt ::=", + /* 90 */ "defer_subclause_opt ::= defer_subclause", + /* 91 */ "onconf ::=", + /* 92 */ "onconf ::= ON CONFLICT resolvetype", + /* 93 */ "orconf ::=", + /* 94 */ "orconf ::= OR resolvetype", + /* 95 */ "resolvetype ::= raisetype", + /* 96 */ "resolvetype ::= IGNORE", + /* 97 */ "resolvetype ::= REPLACE", + /* 98 */ "cmd ::= DROP TABLE fullname", + /* 99 */ "cmd ::= CREATE temp VIEW nm dbnm AS select", + /* 100 */ "cmd ::= DROP VIEW fullname", + /* 101 */ "cmd ::= select", + /* 102 */ "select ::= oneselect", + /* 103 */ "select ::= select multiselect_op oneselect", + /* 104 */ "multiselect_op ::= UNION", + /* 105 */ "multiselect_op ::= UNION ALL", + /* 106 */ "multiselect_op ::= INTERSECT", + /* 107 */ "multiselect_op ::= EXCEPT", + /* 108 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", + /* 109 */ "distinct ::= DISTINCT", + /* 110 */ "distinct ::= ALL", + /* 111 */ "distinct ::=", + /* 112 */ "sclp ::= selcollist COMMA", + /* 113 */ "sclp ::=", + /* 114 */ "selcollist ::= sclp expr as", + /* 115 */ "selcollist ::= sclp STAR", + /* 116 */ "selcollist ::= sclp nm DOT STAR", + /* 117 */ "as ::= AS nm", + /* 118 */ "as ::= ids", + /* 119 */ "as ::=", + /* 120 */ "from ::=", + /* 121 */ "from ::= FROM seltablist", + /* 122 */ "stl_prefix ::= seltablist joinop", + /* 123 */ "stl_prefix ::=", + /* 124 */ "seltablist ::= stl_prefix nm dbnm as on_opt using_opt", + /* 125 */ "seltablist ::= stl_prefix LP seltablist_paren RP as on_opt using_opt", + /* 126 */ "seltablist_paren ::= select", + /* 127 */ "seltablist_paren ::= seltablist", + /* 128 */ "dbnm ::=", + /* 129 */ "dbnm ::= DOT nm", + /* 130 */ "fullname ::= nm dbnm", + /* 131 */ "joinop ::= COMMA", + /* 132 */ "joinop ::= JOIN", + /* 133 */ "joinop ::= JOIN_KW JOIN", + /* 134 */ "joinop ::= JOIN_KW nm JOIN", + /* 135 */ "joinop ::= JOIN_KW nm nm JOIN", + /* 136 */ "on_opt ::= ON expr", + /* 137 */ "on_opt ::=", + /* 138 */ "using_opt ::= USING LP inscollist RP", + /* 139 */ "using_opt ::=", + /* 140 */ "orderby_opt ::=", + /* 141 */ "orderby_opt ::= ORDER BY sortlist", + /* 142 */ "sortlist ::= sortlist COMMA sortitem collate sortorder", + /* 143 */ "sortlist ::= sortitem collate sortorder", + /* 144 */ "sortitem ::= expr", + /* 145 */ "sortorder ::= ASC", + /* 146 */ "sortorder ::= DESC", + /* 147 */ "sortorder ::=", + /* 148 */ "collate ::=", + /* 149 */ "collate ::= COLLATE id", + /* 150 */ "groupby_opt ::=", + /* 151 */ "groupby_opt ::= GROUP BY exprlist", + /* 152 */ "having_opt ::=", + /* 153 */ "having_opt ::= HAVING expr", + /* 154 */ "limit_opt ::=", + /* 155 */ "limit_opt ::= LIMIT expr", + /* 156 */ "limit_opt ::= LIMIT expr OFFSET expr", + /* 157 */ "limit_opt ::= LIMIT expr COMMA expr", + /* 158 */ "cmd ::= DELETE FROM fullname where_opt", + /* 159 */ "where_opt ::=", + /* 160 */ "where_opt ::= WHERE expr", + /* 161 */ "cmd ::= UPDATE orconf fullname SET setlist where_opt", + /* 162 */ "setlist ::= setlist COMMA nm EQ expr", + /* 163 */ "setlist ::= nm EQ expr", + /* 164 */ "cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP", + /* 165 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select", + /* 166 */ "insert_cmd ::= INSERT orconf", + /* 167 */ "insert_cmd ::= REPLACE", + /* 168 */ "itemlist ::= itemlist COMMA expr", + /* 169 */ "itemlist ::= expr", + /* 170 */ "inscollist_opt ::=", + /* 171 */ "inscollist_opt ::= LP inscollist RP", + /* 172 */ "inscollist ::= inscollist COMMA nm", + /* 173 */ "inscollist ::= nm", + /* 174 */ "expr ::= term", + /* 175 */ "expr ::= LP expr RP", + /* 176 */ "term ::= NULL", + /* 177 */ "expr ::= ID", + /* 178 */ "expr ::= JOIN_KW", + /* 179 */ "expr ::= nm DOT nm", + /* 180 */ "expr ::= nm DOT nm DOT nm", + /* 181 */ "term ::= INTEGER", + /* 182 */ "term ::= FLOAT", + /* 183 */ "term ::= STRING", + /* 184 */ "term ::= BLOB", + /* 185 */ "expr ::= REGISTER", + /* 186 */ "expr ::= VARIABLE", + /* 187 */ "expr ::= CAST LP expr AS typetoken RP", + /* 188 */ "expr ::= ID LP distinct exprlist RP", + /* 189 */ "expr ::= ID LP STAR RP", + /* 190 */ "term ::= CTIME_KW", + /* 191 */ "expr ::= expr AND expr", + /* 192 */ "expr ::= expr OR expr", + /* 193 */ "expr ::= expr LT expr", + /* 194 */ "expr ::= expr GT expr", + /* 195 */ "expr ::= expr LE expr", + /* 196 */ "expr ::= expr GE expr", + /* 197 */ "expr ::= expr NE expr", + /* 198 */ "expr ::= expr EQ expr", + /* 199 */ "expr ::= expr BITAND expr", + /* 200 */ "expr ::= expr BITOR expr", + /* 201 */ "expr ::= expr LSHIFT expr", + /* 202 */ "expr ::= expr RSHIFT expr", + /* 203 */ "expr ::= expr PLUS expr", + /* 204 */ "expr ::= expr MINUS expr", + /* 205 */ "expr ::= expr STAR expr", + /* 206 */ "expr ::= expr SLASH expr", + /* 207 */ "expr ::= expr REM expr", + /* 208 */ "expr ::= expr CONCAT expr", + /* 209 */ "likeop ::= LIKE_KW", + /* 210 */ "likeop ::= NOT LIKE_KW", + /* 211 */ "escape ::= ESCAPE expr", + /* 212 */ "escape ::=", + /* 213 */ "expr ::= expr likeop expr escape", + /* 214 */ "expr ::= expr ISNULL", + /* 215 */ "expr ::= expr IS NULL", + /* 216 */ "expr ::= expr NOTNULL", + /* 217 */ "expr ::= expr NOT NULL", + /* 218 */ "expr ::= expr IS NOT NULL", + /* 219 */ "expr ::= NOT expr", + /* 220 */ "expr ::= BITNOT expr", + /* 221 */ "expr ::= MINUS expr", + /* 222 */ "expr ::= PLUS expr", + /* 223 */ "between_op ::= BETWEEN", + /* 224 */ "between_op ::= NOT BETWEEN", + /* 225 */ "expr ::= expr between_op expr AND expr", + /* 226 */ "in_op ::= IN", + /* 227 */ "in_op ::= NOT IN", + /* 228 */ "expr ::= expr in_op LP exprlist RP", + /* 229 */ "expr ::= LP select RP", + /* 230 */ "expr ::= expr in_op LP select RP", + /* 231 */ "expr ::= expr in_op nm dbnm", + /* 232 */ "expr ::= EXISTS LP select RP", + /* 233 */ "expr ::= CASE case_operand case_exprlist case_else END", + /* 234 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", + /* 235 */ "case_exprlist ::= WHEN expr THEN expr", + /* 236 */ "case_else ::= ELSE expr", + /* 237 */ "case_else ::=", + /* 238 */ "case_operand ::= expr", + /* 239 */ "case_operand ::=", + /* 240 */ "exprlist ::= exprlist COMMA expritem", + /* 241 */ "exprlist ::= expritem", + /* 242 */ "expritem ::= expr", + /* 243 */ "expritem ::=", + /* 244 */ "cmd ::= CREATE uniqueflag INDEX nm dbnm ON nm LP idxlist RP onconf", + /* 245 */ "uniqueflag ::= UNIQUE", + /* 246 */ "uniqueflag ::=", + /* 247 */ "idxlist_opt ::=", + /* 248 */ "idxlist_opt ::= LP idxlist RP", + /* 249 */ "idxlist ::= idxlist COMMA idxitem collate sortorder", + /* 250 */ "idxlist ::= idxitem collate sortorder", + /* 251 */ "idxitem ::= nm", + /* 252 */ "cmd ::= DROP INDEX fullname", + /* 253 */ "cmd ::= VACUUM", + /* 254 */ "cmd ::= VACUUM nm", + /* 255 */ "cmd ::= PRAGMA nm dbnm EQ nm", + /* 256 */ "cmd ::= PRAGMA nm dbnm EQ ON", + /* 257 */ "cmd ::= PRAGMA nm dbnm EQ plus_num", + /* 258 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", + /* 259 */ "cmd ::= PRAGMA nm dbnm LP nm RP", + /* 260 */ "cmd ::= PRAGMA nm dbnm", + /* 261 */ "plus_num ::= plus_opt number", + /* 262 */ "minus_num ::= MINUS number", + /* 263 */ "number ::= INTEGER", + /* 264 */ "number ::= FLOAT", + /* 265 */ "plus_opt ::= PLUS", + /* 266 */ "plus_opt ::=", + /* 267 */ "cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END", + /* 268 */ "trigger_decl ::= temp TRIGGER nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", + /* 269 */ "trigger_time ::= BEFORE", + /* 270 */ "trigger_time ::= AFTER", + /* 271 */ "trigger_time ::= INSTEAD OF", + /* 272 */ "trigger_time ::=", + /* 273 */ "trigger_event ::= DELETE", + /* 274 */ "trigger_event ::= INSERT", + /* 275 */ "trigger_event ::= UPDATE", + /* 276 */ "trigger_event ::= UPDATE OF inscollist", + /* 277 */ "foreach_clause ::=", + /* 278 */ "foreach_clause ::= FOR EACH ROW", + /* 279 */ "foreach_clause ::= FOR EACH STATEMENT", + /* 280 */ "when_clause ::=", + /* 281 */ "when_clause ::= WHEN expr", + /* 282 */ "trigger_cmd_list ::= trigger_cmd SEMI trigger_cmd_list", + /* 283 */ "trigger_cmd_list ::=", + /* 284 */ "trigger_cmd ::= UPDATE orconf nm SET setlist where_opt", + /* 285 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP", + /* 286 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt select", + /* 287 */ "trigger_cmd ::= DELETE FROM nm where_opt", + /* 288 */ "trigger_cmd ::= select", + /* 289 */ "expr ::= RAISE LP IGNORE RP", + /* 290 */ "expr ::= RAISE LP raisetype COMMA nm RP", + /* 291 */ "raisetype ::= ROLLBACK", + /* 292 */ "raisetype ::= ABORT", + /* 293 */ "raisetype ::= FAIL", + /* 294 */ "cmd ::= DROP TRIGGER fullname", + /* 295 */ "cmd ::= ATTACH database_kw_opt ids AS nm key_opt", + /* 296 */ "key_opt ::=", + /* 297 */ "key_opt ::= KEY ids", + /* 298 */ "key_opt ::= KEY BLOB", + /* 299 */ "database_kw_opt ::= DATABASE", + /* 300 */ "database_kw_opt ::=", + /* 301 */ "cmd ::= DETACH database_kw_opt nm", + /* 302 */ "cmd ::= REINDEX", + /* 303 */ "cmd ::= REINDEX nm dbnm", + /* 304 */ "cmd ::= ANALYZE", + /* 305 */ "cmd ::= ANALYZE nm dbnm", + /* 306 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", + /* 307 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column", + /* 308 */ "add_column_fullname ::= fullname", + /* 309 */ "kwcolumn_opt ::=", + /* 310 */ "kwcolumn_opt ::= COLUMNKW", }; #endif /* NDEBUG */ @@ -1291,72 +1322,72 @@ ** which appear on the RHS of the rule, but which are not used ** inside the C code. */ - case 157: - case 189: - case 206: -#line 334 "parse.y" -{sqlite3SelectDelete((yypminor->yy459));} -#line 1301 "parse.c" + case 162: + case 195: + case 212: +#line 370 "parse.y" +{sqlite3SelectDelete((yypminor->yy375));} +#line 1332 "parse.c" break; - case 170: - case 174: - case 194: - case 196: - case 204: + case 176: + case 177: + case 200: + case 202: case 210: - case 224: -#line 593 "parse.y" -{sqlite3ExprDelete((yypminor->yy2));} -#line 1312 "parse.c" + case 216: + case 230: +#line 629 "parse.y" +{sqlite3ExprDelete((yypminor->yy62));} +#line 1343 "parse.c" break; - case 175: - case 183: - case 192: - case 195: - case 197: - case 199: - case 209: - case 212: - case 213: - case 216: + case 181: + case 189: + case 198: + case 201: + case 203: + case 205: + case 215: + case 218: + case 219: case 222: -#line 812 "parse.y" -{sqlite3ExprListDelete((yypminor->yy82));} -#line 1327 "parse.c" + case 228: +#line 876 "parse.y" +{sqlite3ExprListDelete((yypminor->yy418));} +#line 1358 "parse.c" break; - case 188: - case 193: - case 201: - case 202: -#line 463 "parse.y" -{sqlite3SrcListDelete((yypminor->yy67));} -#line 1335 "parse.c" + case 194: + case 199: + case 207: + case 208: +#line 499 "parse.y" +{sqlite3SrcListDelete((yypminor->yy151));} +#line 1366 "parse.c" break; - case 198: -#line 525 "parse.y" + case 204: +#line 561 "parse.y" { - sqlite3ExprDelete((yypminor->yy244).pLimit); - sqlite3ExprDelete((yypminor->yy244).pOffset); + sqlite3ExprDelete((yypminor->yy220).pLimit); + sqlite3ExprDelete((yypminor->yy220).pOffset); } -#line 1343 "parse.c" +#line 1374 "parse.c" break; - case 205: - case 208: - case 215: -#line 481 "parse.y" + case 211: + case 214: + case 221: +#line 517 "parse.y" {sqlite3IdListDelete((yypminor->yy240));} -#line 1350 "parse.c" +#line 1381 "parse.c" break; - case 230: - case 235: -#line 905 "parse.y" -{sqlite3DeleteTriggerStep((yypminor->yy347));} -#line 1356 "parse.c" + case 236: + case 241: +#line 969 "parse.y" +{sqlite3DeleteTriggerStep((yypminor->yy360));} +#line 1387 "parse.c" break; - case 232: -#line 889 "parse.y" -{sqlite3IdListDelete((yypminor->yy210).b);} -#line 1361 "parse.c" + case 238: +#line 953 "parse.y" +{sqlite3IdListDelete((yypminor->yy30).b);} +#line 1392 "parse.c" break; default: break; /* If no destructor action specified: do nothing */ } @@ -1532,311 +1563,317 @@ YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ unsigned char nrhs; /* Number of right-hand side symbols in the rule */ } yyRuleInfo[] = { - { 142, 1 }, - { 143, 2 }, - { 143, 1 }, - { 145, 1 }, - { 144, 1 }, - { 144, 3 }, - { 147, 0 }, { 147, 1 }, - { 146, 3 }, - { 149, 0 }, + { 148, 2 }, + { 148, 1 }, + { 150, 1 }, { 149, 1 }, - { 149, 2 }, - { 148, 0 }, - { 148, 1 }, - { 148, 1 }, - { 148, 1 }, - { 146, 2 }, - { 146, 2 }, - { 146, 2 }, - { 146, 2 }, - { 151, 5 }, + { 149, 3 }, + { 152, 0 }, + { 152, 1 }, + { 152, 3 }, + { 151, 3 }, + { 154, 0 }, + { 154, 1 }, + { 154, 2 }, + { 153, 0 }, { 153, 1 }, - { 153, 0 }, - { 152, 4 }, - { 152, 2 }, - { 155, 3 }, - { 155, 1 }, - { 158, 3 }, - { 159, 1 }, - { 162, 1 }, - { 163, 1 }, - { 163, 1 }, - { 150, 1 }, - { 150, 1 }, - { 150, 1 }, - { 160, 0 }, + { 153, 1 }, + { 153, 1 }, + { 151, 2 }, + { 151, 2 }, + { 151, 2 }, + { 151, 2 }, + { 156, 5 }, + { 158, 1 }, + { 158, 0 }, + { 157, 4 }, + { 157, 2 }, + { 160, 3 }, { 160, 1 }, - { 160, 4 }, - { 160, 6 }, + { 163, 3 }, { 164, 1 }, - { 164, 2 }, + { 167, 1 }, + { 168, 1 }, + { 168, 1 }, + { 155, 1 }, + { 155, 1 }, + { 155, 1 }, + { 165, 0 }, { 165, 1 }, - { 165, 1 }, - { 161, 2 }, - { 161, 0 }, - { 168, 3 }, - { 168, 1 }, - { 168, 2 }, - { 168, 3 }, - { 168, 3 }, - { 168, 2 }, - { 169, 2 }, - { 169, 3 }, - { 169, 5 }, - { 169, 2 }, - { 169, 5 }, + { 169, 1 }, { 169, 4 }, - { 169, 1 }, - { 169, 2 }, - { 173, 0 }, - { 173, 1 }, - { 176, 0 }, - { 176, 2 }, - { 178, 2 }, - { 178, 3 }, - { 178, 3 }, - { 178, 3 }, - { 179, 2 }, - { 179, 2 }, - { 179, 1 }, - { 179, 1 }, - { 177, 3 }, - { 177, 2 }, + { 169, 6 }, + { 170, 1 }, + { 170, 2 }, + { 171, 1 }, + { 171, 1 }, + { 166, 2 }, + { 166, 0 }, + { 174, 3 }, + { 174, 1 }, + { 174, 2 }, + { 174, 4 }, + { 174, 3 }, + { 174, 3 }, + { 174, 2 }, + { 175, 2 }, + { 175, 3 }, + { 175, 5 }, + { 175, 2 }, + { 175, 5 }, + { 175, 4 }, + { 175, 1 }, + { 175, 2 }, { 180, 0 }, - { 180, 2 }, - { 180, 2 }, - { 156, 0 }, - { 156, 2 }, - { 181, 3 }, - { 181, 2 }, - { 181, 1 }, + { 180, 1 }, + { 182, 0 }, { 182, 2 }, - { 182, 7 }, - { 182, 5 }, - { 182, 3 }, - { 182, 10 }, - { 184, 0 }, - { 184, 1 }, - { 171, 0 }, - { 171, 3 }, - { 185, 0 }, + { 184, 2 }, + { 184, 3 }, + { 184, 3 }, + { 184, 3 }, { 185, 2 }, - { 186, 1 }, - { 186, 1 }, - { 186, 1 }, - { 146, 3 }, - { 146, 7 }, - { 146, 3 }, - { 146, 1 }, - { 157, 1 }, - { 157, 3 }, + { 185, 2 }, + { 185, 1 }, + { 185, 1 }, + { 183, 3 }, + { 183, 2 }, + { 186, 0 }, + { 186, 2 }, + { 186, 2 }, + { 161, 0 }, + { 161, 2 }, + { 187, 3 }, + { 187, 2 }, + { 187, 1 }, + { 188, 2 }, + { 188, 7 }, + { 188, 5 }, + { 188, 3 }, + { 188, 10 }, + { 190, 0 }, { 190, 1 }, - { 190, 2 }, - { 190, 1 }, - { 190, 1 }, - { 189, 9 }, - { 191, 1 }, - { 191, 1 }, + { 178, 0 }, + { 178, 3 }, { 191, 0 }, - { 199, 2 }, - { 199, 0 }, - { 192, 3 }, - { 192, 2 }, - { 192, 4 }, - { 200, 2 }, - { 200, 1 }, - { 200, 0 }, - { 193, 0 }, - { 193, 2 }, - { 202, 2 }, - { 202, 0 }, - { 201, 6 }, - { 201, 7 }, - { 206, 1 }, - { 206, 1 }, - { 154, 0 }, - { 154, 2 }, - { 188, 2 }, - { 203, 1 }, - { 203, 1 }, - { 203, 2 }, - { 203, 3 }, - { 203, 4 }, - { 204, 2 }, - { 204, 0 }, - { 205, 4 }, - { 205, 0 }, + { 191, 2 }, + { 192, 1 }, + { 192, 1 }, + { 192, 1 }, + { 151, 3 }, + { 151, 7 }, + { 151, 3 }, + { 151, 1 }, + { 162, 1 }, + { 162, 3 }, + { 196, 1 }, + { 196, 2 }, + { 196, 1 }, + { 196, 1 }, + { 195, 9 }, + { 197, 1 }, + { 197, 1 }, { 197, 0 }, - { 197, 3 }, - { 209, 5 }, - { 209, 3 }, - { 210, 1 }, - { 172, 1 }, - { 172, 1 }, - { 172, 0 }, - { 211, 0 }, - { 211, 2 }, - { 195, 0 }, - { 195, 3 }, - { 196, 0 }, - { 196, 2 }, - { 198, 0 }, + { 205, 2 }, + { 205, 0 }, + { 198, 3 }, { 198, 2 }, { 198, 4 }, - { 198, 4 }, - { 146, 4 }, - { 194, 0 }, + { 206, 2 }, + { 206, 1 }, + { 206, 0 }, + { 199, 0 }, + { 199, 2 }, + { 208, 2 }, + { 208, 0 }, + { 207, 6 }, + { 207, 7 }, + { 212, 1 }, + { 212, 1 }, + { 159, 0 }, + { 159, 2 }, { 194, 2 }, - { 146, 6 }, - { 213, 5 }, - { 213, 3 }, - { 146, 8 }, - { 146, 5 }, - { 214, 2 }, - { 214, 1 }, - { 216, 3 }, - { 216, 1 }, - { 215, 0 }, + { 209, 1 }, + { 209, 1 }, + { 209, 2 }, + { 209, 3 }, + { 209, 4 }, + { 210, 2 }, + { 210, 0 }, + { 211, 4 }, + { 211, 0 }, + { 203, 0 }, + { 203, 3 }, + { 215, 5 }, { 215, 3 }, - { 208, 3 }, - { 208, 1 }, - { 174, 1 }, - { 174, 3 }, - { 170, 1 }, - { 174, 1 }, - { 174, 1 }, - { 174, 3 }, - { 174, 5 }, - { 170, 1 }, - { 170, 1 }, - { 170, 1 }, - { 170, 1 }, - { 174, 1 }, - { 174, 1 }, - { 174, 4 }, - { 174, 4 }, - { 170, 1 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 174, 3 }, - { 217, 1 }, + { 216, 1 }, + { 179, 1 }, + { 179, 1 }, + { 179, 0 }, + { 217, 0 }, { 217, 2 }, - { 218, 2 }, - { 218, 0 }, - { 174, 4 }, - { 174, 2 }, - { 174, 3 }, - { 174, 2 }, - { 174, 3 }, - { 174, 4 }, - { 174, 2 }, - { 174, 2 }, - { 174, 2 }, - { 174, 2 }, - { 219, 1 }, - { 219, 2 }, - { 174, 5 }, + { 201, 0 }, + { 201, 3 }, + { 202, 0 }, + { 202, 2 }, + { 204, 0 }, + { 204, 2 }, + { 204, 4 }, + { 204, 4 }, + { 151, 4 }, + { 200, 0 }, + { 200, 2 }, + { 151, 6 }, + { 219, 5 }, + { 219, 3 }, + { 151, 8 }, + { 151, 5 }, + { 220, 2 }, { 220, 1 }, - { 220, 2 }, - { 174, 5 }, - { 174, 3 }, - { 174, 5 }, - { 174, 4 }, - { 174, 4 }, - { 174, 5 }, - { 222, 5 }, - { 222, 4 }, + { 222, 3 }, + { 222, 1 }, + { 221, 0 }, + { 221, 3 }, + { 214, 3 }, + { 214, 1 }, + { 177, 1 }, + { 177, 3 }, + { 176, 1 }, + { 177, 1 }, + { 177, 1 }, + { 177, 3 }, + { 177, 5 }, + { 176, 1 }, + { 176, 1 }, + { 176, 1 }, + { 176, 1 }, + { 177, 1 }, + { 177, 1 }, + { 177, 6 }, + { 177, 5 }, + { 177, 4 }, + { 176, 1 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 177, 3 }, + { 223, 1 }, { 223, 2 }, - { 223, 0 }, - { 221, 1 }, - { 221, 0 }, - { 212, 3 }, - { 212, 1 }, - { 224, 1 }, + { 224, 2 }, { 224, 0 }, - { 146, 11 }, + { 177, 4 }, + { 177, 2 }, + { 177, 3 }, + { 177, 2 }, + { 177, 3 }, + { 177, 4 }, + { 177, 2 }, + { 177, 2 }, + { 177, 2 }, + { 177, 2 }, { 225, 1 }, - { 225, 0 }, - { 175, 0 }, - { 175, 3 }, - { 183, 5 }, - { 183, 3 }, + { 225, 2 }, + { 177, 5 }, { 226, 1 }, - { 146, 3 }, - { 146, 1 }, - { 146, 2 }, - { 146, 5 }, - { 146, 5 }, - { 146, 5 }, - { 146, 5 }, - { 146, 6 }, - { 146, 3 }, - { 166, 2 }, - { 167, 2 }, - { 228, 1 }, - { 228, 1 }, + { 226, 2 }, + { 177, 5 }, + { 177, 3 }, + { 177, 5 }, + { 177, 4 }, + { 177, 4 }, + { 177, 5 }, + { 228, 5 }, + { 228, 4 }, + { 229, 2 }, + { 229, 0 }, { 227, 1 }, { 227, 0 }, - { 146, 5 }, - { 229, 10 }, + { 218, 3 }, + { 218, 1 }, + { 230, 1 }, + { 230, 0 }, + { 151, 11 }, { 231, 1 }, - { 231, 1 }, - { 231, 2 }, { 231, 0 }, + { 181, 0 }, + { 181, 3 }, + { 189, 5 }, + { 189, 3 }, { 232, 1 }, - { 232, 1 }, - { 232, 1 }, - { 232, 3 }, + { 151, 3 }, + { 151, 1 }, + { 151, 2 }, + { 151, 5 }, + { 151, 5 }, + { 151, 5 }, + { 151, 5 }, + { 151, 6 }, + { 151, 3 }, + { 172, 2 }, + { 173, 2 }, + { 234, 1 }, + { 234, 1 }, + { 233, 1 }, { 233, 0 }, - { 233, 3 }, - { 233, 3 }, - { 234, 0 }, - { 234, 2 }, - { 230, 3 }, - { 230, 0 }, - { 235, 6 }, - { 235, 8 }, - { 235, 5 }, - { 235, 4 }, - { 235, 1 }, - { 174, 4 }, - { 174, 6 }, - { 187, 1 }, - { 187, 1 }, - { 187, 1 }, - { 146, 3 }, - { 146, 6 }, + { 151, 5 }, + { 235, 10 }, + { 237, 1 }, + { 237, 1 }, + { 237, 2 }, { 237, 0 }, - { 237, 2 }, - { 237, 2 }, - { 236, 1 }, - { 236, 0 }, - { 146, 3 }, - { 146, 1 }, - { 146, 3 }, - { 146, 6 }, - { 146, 6 }, { 238, 1 }, + { 238, 1 }, + { 238, 1 }, + { 238, 3 }, { 239, 0 }, - { 239, 1 }, + { 239, 3 }, + { 239, 3 }, + { 240, 0 }, + { 240, 2 }, + { 236, 3 }, + { 236, 0 }, + { 241, 6 }, + { 241, 8 }, + { 241, 5 }, + { 241, 4 }, + { 241, 1 }, + { 177, 4 }, + { 177, 6 }, + { 193, 1 }, + { 193, 1 }, + { 193, 1 }, + { 151, 3 }, + { 151, 6 }, + { 243, 0 }, + { 243, 2 }, + { 243, 2 }, + { 242, 1 }, + { 242, 0 }, + { 151, 3 }, + { 151, 1 }, + { 151, 3 }, + { 151, 1 }, + { 151, 3 }, + { 151, 6 }, + { 151, 6 }, + { 244, 1 }, + { 245, 0 }, + { 245, 1 }, }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -1886,753 +1923,777 @@ ** break; */ case 3: -#line 84 "parse.y" +#line 102 "parse.y" { sqlite3FinishCoding(pParse); } -#line 1893 "parse.c" +#line 1930 "parse.c" break; case 6: -#line 87 "parse.y" +#line 105 "parse.y" { sqlite3BeginParse(pParse, 0); } -#line 1898 "parse.c" +#line 1935 "parse.c" break; case 7: -#line 89 "parse.y" +#line 107 "parse.y" { sqlite3BeginParse(pParse, 1); } -#line 1903 "parse.c" +#line 1940 "parse.c" break; case 8: -#line 95 "parse.y" -{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy412);} -#line 1908 "parse.c" +#line 108 "parse.y" +{ sqlite3BeginParse(pParse, 2); } +#line 1945 "parse.c" break; - case 12: -#line 100 "parse.y" -{yygotominor.yy412 = TK_DEFERRED;} -#line 1913 "parse.c" + case 9: +#line 114 "parse.y" +{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy280);} +#line 1950 "parse.c" break; case 13: +#line 119 "parse.y" +{yygotominor.yy280 = TK_DEFERRED;} +#line 1955 "parse.c" + break; case 14: case 15: - case 101: - case 103: + case 16: case 104: -#line 101 "parse.y" -{yygotominor.yy412 = yymsp[0].major;} -#line 1923 "parse.c" + case 106: + case 107: +#line 120 "parse.y" +{yygotominor.yy280 = yymsp[0].major;} +#line 1965 "parse.c" break; - case 16: case 17: -#line 104 "parse.y" + case 18: +#line 123 "parse.y" {sqlite3CommitTransaction(pParse);} -#line 1929 "parse.c" +#line 1971 "parse.c" break; - case 18: -#line 106 "parse.y" + case 19: +#line 125 "parse.y" {sqlite3RollbackTransaction(pParse);} -#line 1934 "parse.c" +#line 1976 "parse.c" break; - case 20: -#line 111 "parse.y" + case 21: +#line 130 "parse.y" { - sqlite3StartTable(pParse,&yymsp[-4].minor.yy0,&yymsp[-1].minor.yy258,&yymsp[0].minor.yy258,yymsp[-3].minor.yy412,0); + sqlite3StartTable(pParse,&yymsp[-4].minor.yy0,&yymsp[-1].minor.yy198,&yymsp[0].minor.yy198,yymsp[-3].minor.yy280,0); } -#line 1941 "parse.c" +#line 1983 "parse.c" break; - case 21: - case 60: - case 74: - case 106: - case 220: - case 223: -#line 116 "parse.y" -{yygotominor.yy412 = 1;} -#line 1951 "parse.c" - break; case 22: - case 59: - case 73: - case 75: - case 86: - case 107: - case 108: - case 219: - case 222: -#line 118 "parse.y" -{yygotominor.yy412 = 0;} -#line 1964 "parse.c" + case 63: + case 77: + case 109: + case 224: + case 227: +#line 135 "parse.y" +{yygotominor.yy280 = 1;} +#line 1993 "parse.c" break; case 23: -#line 119 "parse.y" -{ - sqlite3EndTable(pParse,&yymsp[-1].minor.yy258,&yymsp[0].minor.yy0,0); -} -#line 1971 "parse.c" + case 62: + case 76: + case 78: + case 89: + case 110: + case 111: + case 223: + case 226: +#line 137 "parse.y" +{yygotominor.yy280 = 0;} +#line 2006 "parse.c" break; case 24: -#line 122 "parse.y" +#line 138 "parse.y" { - sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy459); - sqlite3SelectDelete(yymsp[0].minor.yy459); + sqlite3EndTable(pParse,&yymsp[-1].minor.yy198,&yymsp[0].minor.yy0,0); } -#line 1979 "parse.c" +#line 2013 "parse.c" break; - case 27: -#line 133 "parse.y" + case 25: +#line 141 "parse.y" { - yygotominor.yy258.z = yymsp[-2].minor.yy258.z; - yygotominor.yy258.n = (pParse->sLastToken.z-yymsp[-2].minor.yy258.z) + pParse->sLastToken.n; + sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy375); + sqlite3SelectDelete(yymsp[0].minor.yy375); } -#line 1987 "parse.c" +#line 2021 "parse.c" break; case 28: -#line 137 "parse.y" +#line 153 "parse.y" { - sqlite3AddColumn(pParse,&yymsp[0].minor.yy258); - yygotominor.yy258 = yymsp[0].minor.yy258; + yygotominor.yy198.z = yymsp[-2].minor.yy198.z; + yygotominor.yy198.n = (pParse->sLastToken.z-yymsp[-2].minor.yy198.z) + pParse->sLastToken.n; } -#line 1995 "parse.c" +#line 2029 "parse.c" break; case 29: +#line 157 "parse.y" +{ + sqlite3AddColumn(pParse,&yymsp[0].minor.yy198); + yygotominor.yy198 = yymsp[0].minor.yy198; +} +#line 2037 "parse.c" + break; case 30: case 31: case 32: case 33: case 34: - case 259: - case 260: -#line 147 "parse.y" -{yygotominor.yy258 = yymsp[0].minor.yy0;} -#line 2007 "parse.c" + case 35: + case 263: + case 264: +#line 167 "parse.y" +{yygotominor.yy198 = yymsp[0].minor.yy0;} +#line 2049 "parse.c" break; - case 36: -#line 202 "parse.y" -{sqlite3AddColumnType(pParse,&yymsp[0].minor.yy258,&yymsp[0].minor.yy258);} -#line 2012 "parse.c" - break; case 37: -#line 203 "parse.y" -{sqlite3AddColumnType(pParse,&yymsp[-3].minor.yy258,&yymsp[0].minor.yy0);} -#line 2017 "parse.c" +#line 227 "parse.y" +{sqlite3AddColumnType(pParse,&yymsp[0].minor.yy198);} +#line 2054 "parse.c" break; case 38: -#line 205 "parse.y" -{sqlite3AddColumnType(pParse,&yymsp[-5].minor.yy258,&yymsp[0].minor.yy0);} -#line 2022 "parse.c" + case 41: + case 117: + case 118: + case 129: + case 149: + case 251: + case 261: + case 262: +#line 228 "parse.y" +{yygotominor.yy198 = yymsp[0].minor.yy198;} +#line 2067 "parse.c" break; case 39: - case 114: - case 115: - case 126: - case 146: - case 247: - case 257: - case 258: -#line 207 "parse.y" -{yygotominor.yy258 = yymsp[0].minor.yy258;} -#line 2034 "parse.c" +#line 229 "parse.y" +{ + yygotominor.yy198.z = yymsp[-3].minor.yy198.z; + yygotominor.yy198.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy198.z; +} +#line 2075 "parse.c" break; case 40: -#line 208 "parse.y" -{yygotominor.yy258.z=yymsp[-1].minor.yy258.z; yygotominor.yy258.n=yymsp[0].minor.yy258.n+(yymsp[0].minor.yy258.z-yymsp[-1].minor.yy258.z);} -#line 2039 "parse.c" +#line 233 "parse.y" +{ + yygotominor.yy198.z = yymsp[-5].minor.yy198.z; + yygotominor.yy198.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy198.z; +} +#line 2083 "parse.c" break; - case 41: -#line 210 "parse.y" -{ yygotominor.yy412 = atoi(yymsp[0].minor.yy258.z); } -#line 2044 "parse.c" - break; case 42: -#line 211 "parse.y" -{ yygotominor.yy412 = -atoi(yymsp[0].minor.yy258.z); } -#line 2049 "parse.c" +#line 239 "parse.y" +{yygotominor.yy198.z=yymsp[-1].minor.yy198.z; yygotominor.yy198.n=yymsp[0].minor.yy198.n+(yymsp[0].minor.yy198.z-yymsp[-1].minor.yy198.z);} +#line 2088 "parse.c" break; - case 47: - case 48: -#line 216 "parse.y" -{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy2);} -#line 2055 "parse.c" + case 43: +#line 241 "parse.y" +{ yygotominor.yy280 = atoi(yymsp[0].minor.yy198.z); } +#line 2093 "parse.c" break; + case 44: +#line 242 "parse.y" +{ yygotominor.yy280 = -atoi(yymsp[0].minor.yy198.z); } +#line 2098 "parse.c" + break; case 49: -#line 218 "parse.y" -{ - Expr *p = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy2, 0, 0); - sqlite3AddDefaultValue(pParse,p); -} -#line 2063 "parse.c" + case 51: +#line 251 "parse.y" +{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy62);} +#line 2104 "parse.c" break; case 50: -#line 222 "parse.y" +#line 252 "parse.y" +{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy62);} +#line 2109 "parse.c" + break; + case 52: +#line 254 "parse.y" { - Expr *p = sqlite3Expr(TK_STRING, 0, 0, &yymsp[0].minor.yy258); + Expr *p = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy62, 0, 0); sqlite3AddDefaultValue(pParse,p); } -#line 2071 "parse.c" +#line 2117 "parse.c" break; - case 52: -#line 231 "parse.y" -{sqlite3AddNotNull(pParse, yymsp[0].minor.yy412);} -#line 2076 "parse.c" - break; case 53: -#line 233 "parse.y" -{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy412,yymsp[0].minor.yy412);} -#line 2081 "parse.c" +#line 258 "parse.y" +{ + Expr *p = sqlite3Expr(TK_STRING, 0, 0, &yymsp[0].minor.yy198); + sqlite3AddDefaultValue(pParse,p); +} +#line 2125 "parse.c" break; - case 54: -#line 234 "parse.y" -{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy412,0,0);} -#line 2086 "parse.c" - break; case 55: -#line 235 "parse.y" -{sqlite3ExprDelete(yymsp[-2].minor.yy2);} -#line 2091 "parse.c" +#line 267 "parse.y" +{sqlite3AddNotNull(pParse, yymsp[0].minor.yy280);} +#line 2130 "parse.c" break; case 56: -#line 237 "parse.y" -{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy258,yymsp[-1].minor.yy82,yymsp[0].minor.yy412);} -#line 2096 "parse.c" +#line 269 "parse.y" +{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy280,yymsp[0].minor.yy280);} +#line 2135 "parse.c" break; case 57: -#line 238 "parse.y" -{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy412);} -#line 2101 "parse.c" +#line 270 "parse.y" +{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy280,0,0);} +#line 2140 "parse.c" break; case 58: -#line 239 "parse.y" -{sqlite3AddCollateType(pParse, yymsp[0].minor.yy258.z, yymsp[0].minor.yy258.n);} -#line 2106 "parse.c" +#line 271 "parse.y" +{sqlite3ExprDelete(yymsp[-2].minor.yy62);} +#line 2145 "parse.c" break; - case 61: -#line 252 "parse.y" -{ yygotominor.yy412 = OE_Restrict * 0x010101; } -#line 2111 "parse.c" + case 59: +#line 273 "parse.y" +{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy198,yymsp[-1].minor.yy418,yymsp[0].minor.yy280);} +#line 2150 "parse.c" break; - case 62: -#line 253 "parse.y" -{ yygotominor.yy412 = (yymsp[-1].minor.yy412 & yymsp[0].minor.yy47.mask) | yymsp[0].minor.yy47.value; } -#line 2116 "parse.c" + case 60: +#line 274 "parse.y" +{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy280);} +#line 2155 "parse.c" break; - case 63: -#line 255 "parse.y" -{ yygotominor.yy47.value = 0; yygotominor.yy47.mask = 0x000000; } -#line 2121 "parse.c" + case 61: +#line 275 "parse.y" +{sqlite3AddCollateType(pParse, yymsp[0].minor.yy198.z, yymsp[0].minor.yy198.n);} +#line 2160 "parse.c" break; case 64: -#line 256 "parse.y" -{ yygotominor.yy47.value = yymsp[0].minor.yy412; yygotominor.yy47.mask = 0x0000ff; } -#line 2126 "parse.c" +#line 288 "parse.y" +{ yygotominor.yy280 = OE_Restrict * 0x010101; } +#line 2165 "parse.c" break; case 65: -#line 257 "parse.y" -{ yygotominor.yy47.value = yymsp[0].minor.yy412<<8; yygotominor.yy47.mask = 0x00ff00; } -#line 2131 "parse.c" +#line 289 "parse.y" +{ yygotominor.yy280 = (yymsp[-1].minor.yy280 & yymsp[0].minor.yy359.mask) | yymsp[0].minor.yy359.value; } +#line 2170 "parse.c" break; case 66: -#line 258 "parse.y" -{ yygotominor.yy47.value = yymsp[0].minor.yy412<<16; yygotominor.yy47.mask = 0xff0000; } -#line 2136 "parse.c" +#line 291 "parse.y" +{ yygotominor.yy359.value = 0; yygotominor.yy359.mask = 0x000000; } +#line 2175 "parse.c" break; case 67: -#line 260 "parse.y" -{ yygotominor.yy412 = OE_SetNull; } -#line 2141 "parse.c" +#line 292 "parse.y" +{ yygotominor.yy359.value = yymsp[0].minor.yy280; yygotominor.yy359.mask = 0x0000ff; } +#line 2180 "parse.c" break; case 68: -#line 261 "parse.y" -{ yygotominor.yy412 = OE_SetDflt; } -#line 2146 "parse.c" +#line 293 "parse.y" +{ yygotominor.yy359.value = yymsp[0].minor.yy280<<8; yygotominor.yy359.mask = 0x00ff00; } +#line 2185 "parse.c" break; case 69: -#line 262 "parse.y" -{ yygotominor.yy412 = OE_Cascade; } -#line 2151 "parse.c" +#line 294 "parse.y" +{ yygotominor.yy359.value = yymsp[0].minor.yy280<<16; yygotominor.yy359.mask = 0xff0000; } +#line 2190 "parse.c" break; case 70: -#line 263 "parse.y" -{ yygotominor.yy412 = OE_Restrict; } -#line 2156 "parse.c" +#line 296 "parse.y" +{ yygotominor.yy280 = OE_SetNull; } +#line 2195 "parse.c" break; case 71: +#line 297 "parse.y" +{ yygotominor.yy280 = OE_SetDflt; } +#line 2200 "parse.c" + break; case 72: - case 87: - case 89: - case 91: - case 92: - case 163: -#line 265 "parse.y" -{yygotominor.yy412 = yymsp[0].minor.yy412;} -#line 2167 "parse.c" +#line 298 "parse.y" +{ yygotominor.yy280 = OE_Cascade; } +#line 2205 "parse.c" break; - case 76: -#line 275 "parse.y" -{yygotominor.yy258.n = 0; yygotominor.yy258.z = 0;} -#line 2172 "parse.c" + case 73: +#line 299 "parse.y" +{ yygotominor.yy280 = OE_Restrict; } +#line 2210 "parse.c" break; - case 77: -#line 276 "parse.y" -{yygotominor.yy258 = yymsp[-1].minor.yy0;} -#line 2177 "parse.c" + case 74: + case 75: + case 90: + case 92: + case 94: + case 95: + case 166: +#line 301 "parse.y" +{yygotominor.yy280 = yymsp[0].minor.yy280;} +#line 2221 "parse.c" break; - case 82: -#line 282 "parse.y" -{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy82,yymsp[0].minor.yy412,yymsp[-2].minor.yy412);} -#line 2182 "parse.c" + case 79: +#line 311 "parse.y" +{yygotominor.yy198.n = 0; yygotominor.yy198.z = 0;} +#line 2226 "parse.c" break; - case 83: -#line 284 "parse.y" -{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy82,yymsp[0].minor.yy412,0,0);} -#line 2187 "parse.c" + case 80: +#line 312 "parse.y" +{yygotominor.yy198 = yymsp[-1].minor.yy0;} +#line 2231 "parse.c" break; case 85: -#line 287 "parse.y" -{ - sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy82, &yymsp[-3].minor.yy258, yymsp[-2].minor.yy82, yymsp[-1].minor.yy412); - sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy412); -} -#line 2195 "parse.c" +#line 318 "parse.y" +{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy418,yymsp[0].minor.yy280,yymsp[-2].minor.yy280);} +#line 2236 "parse.c" break; + case 86: +#line 320 "parse.y" +{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy418,yymsp[0].minor.yy280,0,0);} +#line 2241 "parse.c" + break; case 88: - case 90: -#line 301 "parse.y" -{yygotominor.yy412 = OE_Default;} -#line 2201 "parse.c" +#line 323 "parse.y" +{ + sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy418, &yymsp[-3].minor.yy198, yymsp[-2].minor.yy418, yymsp[-1].minor.yy280); + sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy280); +} +#line 2249 "parse.c" break; + case 91: case 93: -#line 306 "parse.y" -{yygotominor.yy412 = OE_Ignore;} -#line 2206 "parse.c" +#line 337 "parse.y" +{yygotominor.yy280 = OE_Default;} +#line 2255 "parse.c" break; - case 94: - case 164: -#line 307 "parse.y" -{yygotominor.yy412 = OE_Replace;} -#line 2212 "parse.c" + case 96: +#line 342 "parse.y" +{yygotominor.yy280 = OE_Ignore;} +#line 2260 "parse.c" break; - case 95: -#line 311 "parse.y" + case 97: + case 167: +#line 343 "parse.y" +{yygotominor.yy280 = OE_Replace;} +#line 2266 "parse.c" + break; + case 98: +#line 347 "parse.y" { - sqlite3DropTable(pParse, yymsp[0].minor.yy67, 0); + sqlite3DropTable(pParse, yymsp[0].minor.yy151, 0); } -#line 2219 "parse.c" +#line 2273 "parse.c" break; - case 96: -#line 318 "parse.y" + case 99: +#line 354 "parse.y" { - sqlite3CreateView(pParse, &yymsp[-6].minor.yy0, &yymsp[-3].minor.yy258, &yymsp[-2].minor.yy258, yymsp[0].minor.yy459, yymsp[-5].minor.yy412); + sqlite3CreateView(pParse, &yymsp[-6].minor.yy0, &yymsp[-3].minor.yy198, &yymsp[-2].minor.yy198, yymsp[0].minor.yy375, yymsp[-5].minor.yy280); } -#line 2226 "parse.c" +#line 2280 "parse.c" break; - case 97: -#line 321 "parse.y" + case 100: +#line 357 "parse.y" { - sqlite3DropTable(pParse, yymsp[0].minor.yy67, 1); + sqlite3DropTable(pParse, yymsp[0].minor.yy151, 1); } -#line 2233 "parse.c" +#line 2287 "parse.c" break; - case 98: -#line 328 "parse.y" + case 101: +#line 364 "parse.y" { - sqlite3Select(pParse, yymsp[0].minor.yy459, SRT_Callback, 0, 0, 0, 0, 0); - sqlite3SelectDelete(yymsp[0].minor.yy459); + sqlite3Select(pParse, yymsp[0].minor.yy375, SRT_Callback, 0, 0, 0, 0, 0); + sqlite3SelectDelete(yymsp[0].minor.yy375); } -#line 2241 "parse.c" +#line 2295 "parse.c" break; - case 99: - case 123: -#line 338 "parse.y" -{yygotominor.yy459 = yymsp[0].minor.yy459;} -#line 2247 "parse.c" + case 102: + case 126: +#line 374 "parse.y" +{yygotominor.yy375 = yymsp[0].minor.yy375;} +#line 2301 "parse.c" break; - case 100: -#line 340 "parse.y" + case 103: +#line 376 "parse.y" { - if( yymsp[0].minor.yy459 ){ - yymsp[0].minor.yy459->op = yymsp[-1].minor.yy412; - yymsp[0].minor.yy459->pPrior = yymsp[-2].minor.yy459; + if( yymsp[0].minor.yy375 ){ + yymsp[0].minor.yy375->op = yymsp[-1].minor.yy280; + yymsp[0].minor.yy375->pPrior = yymsp[-2].minor.yy375; } - yygotominor.yy459 = yymsp[0].minor.yy459; + yygotominor.yy375 = yymsp[0].minor.yy375; } -#line 2258 "parse.c" +#line 2312 "parse.c" break; - case 102: -#line 349 "parse.y" -{yygotominor.yy412 = TK_ALL;} -#line 2263 "parse.c" - break; case 105: -#line 354 "parse.y" +#line 385 "parse.y" +{yygotominor.yy280 = TK_ALL;} +#line 2317 "parse.c" + break; + case 108: +#line 390 "parse.y" { - yygotominor.yy459 = sqlite3SelectNew(yymsp[-6].minor.yy82,yymsp[-5].minor.yy67,yymsp[-4].minor.yy2,yymsp[-3].minor.yy82,yymsp[-2].minor.yy2,yymsp[-1].minor.yy82,yymsp[-7].minor.yy412,yymsp[0].minor.yy244.pLimit,yymsp[0].minor.yy244.pOffset); + yygotominor.yy375 = sqlite3SelectNew(yymsp[-6].minor.yy418,yymsp[-5].minor.yy151,yymsp[-4].minor.yy62,yymsp[-3].minor.yy418,yymsp[-2].minor.yy62,yymsp[-1].minor.yy418,yymsp[-7].minor.yy280,yymsp[0].minor.yy220.pLimit,yymsp[0].minor.yy220.pOffset); } -#line 2270 "parse.c" +#line 2324 "parse.c" break; - case 109: - case 244: -#line 375 "parse.y" -{yygotominor.yy82 = yymsp[-1].minor.yy82;} -#line 2276 "parse.c" + case 112: + case 248: +#line 411 "parse.y" +{yygotominor.yy418 = yymsp[-1].minor.yy418;} +#line 2330 "parse.c" break; - case 110: - case 137: - case 147: - case 243: -#line 376 "parse.y" -{yygotominor.yy82 = 0;} -#line 2284 "parse.c" + case 113: + case 140: + case 150: + case 247: +#line 412 "parse.y" +{yygotominor.yy418 = 0;} +#line 2338 "parse.c" break; - case 111: -#line 377 "parse.y" + case 114: +#line 413 "parse.y" { - yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-2].minor.yy82,yymsp[-1].minor.yy2,yymsp[0].minor.yy258.n?&yymsp[0].minor.yy258:0); + yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-2].minor.yy418,yymsp[-1].minor.yy62,yymsp[0].minor.yy198.n?&yymsp[0].minor.yy198:0); } -#line 2291 "parse.c" +#line 2345 "parse.c" break; - case 112: -#line 380 "parse.y" + case 115: +#line 416 "parse.y" { - yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-1].minor.yy82, sqlite3Expr(TK_ALL, 0, 0, 0), 0); + yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-1].minor.yy418, sqlite3Expr(TK_ALL, 0, 0, 0), 0); } -#line 2298 "parse.c" +#line 2352 "parse.c" break; - case 113: -#line 383 "parse.y" + case 116: +#line 419 "parse.y" { Expr *pRight = sqlite3Expr(TK_ALL, 0, 0, 0); - Expr *pLeft = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy258); - yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-3].minor.yy82, sqlite3Expr(TK_DOT, pLeft, pRight, 0), 0); + Expr *pLeft = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy198); + yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-3].minor.yy418, sqlite3Expr(TK_DOT, pLeft, pRight, 0), 0); } -#line 2307 "parse.c" +#line 2361 "parse.c" break; - case 116: -#line 395 "parse.y" -{yygotominor.yy258.n = 0;} -#line 2312 "parse.c" + case 119: +#line 431 "parse.y" +{yygotominor.yy198.n = 0;} +#line 2366 "parse.c" break; - case 117: -#line 407 "parse.y" -{yygotominor.yy67 = sqliteMalloc(sizeof(*yygotominor.yy67));} -#line 2317 "parse.c" + case 120: +#line 443 "parse.y" +{yygotominor.yy151 = sqliteMalloc(sizeof(*yygotominor.yy151));} +#line 2371 "parse.c" break; - case 118: -#line 408 "parse.y" -{yygotominor.yy67 = yymsp[0].minor.yy67;} -#line 2322 "parse.c" + case 121: +#line 444 "parse.y" +{yygotominor.yy151 = yymsp[0].minor.yy151;} +#line 2376 "parse.c" break; - case 119: -#line 413 "parse.y" + case 122: +#line 449 "parse.y" { - yygotominor.yy67 = yymsp[-1].minor.yy67; - if( yygotominor.yy67 && yygotominor.yy67->nSrc>0 ) yygotominor.yy67->a[yygotominor.yy67->nSrc-1].jointype = yymsp[0].minor.yy412; + yygotominor.yy151 = yymsp[-1].minor.yy151; + if( yygotominor.yy151 && yygotominor.yy151->nSrc>0 ) yygotominor.yy151->a[yygotominor.yy151->nSrc-1].jointype = yymsp[0].minor.yy280; } -#line 2330 "parse.c" +#line 2384 "parse.c" break; - case 120: -#line 417 "parse.y" -{yygotominor.yy67 = 0;} -#line 2335 "parse.c" + case 123: +#line 453 "parse.y" +{yygotominor.yy151 = 0;} +#line 2389 "parse.c" break; - case 121: -#line 418 "parse.y" + case 124: +#line 454 "parse.y" { - yygotominor.yy67 = sqlite3SrcListAppend(yymsp[-5].minor.yy67,&yymsp[-4].minor.yy258,&yymsp[-3].minor.yy258); - if( yymsp[-2].minor.yy258.n ) sqlite3SrcListAddAlias(yygotominor.yy67,&yymsp[-2].minor.yy258); - if( yymsp[-1].minor.yy2 ){ - if( yygotominor.yy67 && yygotominor.yy67->nSrc>1 ){ yygotominor.yy67->a[yygotominor.yy67->nSrc-2].pOn = yymsp[-1].minor.yy2; } - else { sqlite3ExprDelete(yymsp[-1].minor.yy2); } + yygotominor.yy151 = sqlite3SrcListAppend(yymsp[-5].minor.yy151,&yymsp[-4].minor.yy198,&yymsp[-3].minor.yy198); + if( yymsp[-2].minor.yy198.n ) sqlite3SrcListAddAlias(yygotominor.yy151,&yymsp[-2].minor.yy198); + if( yymsp[-1].minor.yy62 ){ + if( yygotominor.yy151 && yygotominor.yy151->nSrc>1 ){ yygotominor.yy151->a[yygotominor.yy151->nSrc-2].pOn = yymsp[-1].minor.yy62; } + else { sqlite3ExprDelete(yymsp[-1].minor.yy62); } } if( yymsp[0].minor.yy240 ){ - if( yygotominor.yy67 && yygotominor.yy67->nSrc>1 ){ yygotominor.yy67->a[yygotominor.yy67->nSrc-2].pUsing = yymsp[0].minor.yy240; } + if( yygotominor.yy151 && yygotominor.yy151->nSrc>1 ){ yygotominor.yy151->a[yygotominor.yy151->nSrc-2].pUsing = yymsp[0].minor.yy240; } else { sqlite3IdListDelete(yymsp[0].minor.yy240); } } } -#line 2351 "parse.c" +#line 2405 "parse.c" break; - case 122: -#line 432 "parse.y" + case 125: +#line 468 "parse.y" { - yygotominor.yy67 = sqlite3SrcListAppend(yymsp[-6].minor.yy67,0,0); - yygotominor.yy67->a[yygotominor.yy67->nSrc-1].pSelect = yymsp[-4].minor.yy459; - if( yymsp[-2].minor.yy258.n ) sqlite3SrcListAddAlias(yygotominor.yy67,&yymsp[-2].minor.yy258); - if( yymsp[-1].minor.yy2 ){ - if( yygotominor.yy67 && yygotominor.yy67->nSrc>1 ){ yygotominor.yy67->a[yygotominor.yy67->nSrc-2].pOn = yymsp[-1].minor.yy2; } - else { sqlite3ExprDelete(yymsp[-1].minor.yy2); } + yygotominor.yy151 = sqlite3SrcListAppend(yymsp[-6].minor.yy151,0,0); + yygotominor.yy151->a[yygotominor.yy151->nSrc-1].pSelect = yymsp[-4].minor.yy375; + if( yymsp[-2].minor.yy198.n ) sqlite3SrcListAddAlias(yygotominor.yy151,&yymsp[-2].minor.yy198); + if( yymsp[-1].minor.yy62 ){ + if( yygotominor.yy151 && yygotominor.yy151->nSrc>1 ){ yygotominor.yy151->a[yygotominor.yy151->nSrc-2].pOn = yymsp[-1].minor.yy62; } + else { sqlite3ExprDelete(yymsp[-1].minor.yy62); } } if( yymsp[0].minor.yy240 ){ - if( yygotominor.yy67 && yygotominor.yy67->nSrc>1 ){ yygotominor.yy67->a[yygotominor.yy67->nSrc-2].pUsing = yymsp[0].minor.yy240; } + if( yygotominor.yy151 && yygotominor.yy151->nSrc>1 ){ yygotominor.yy151->a[yygotominor.yy151->nSrc-2].pUsing = yymsp[0].minor.yy240; } else { sqlite3IdListDelete(yymsp[0].minor.yy240); } } } -#line 2368 "parse.c" +#line 2422 "parse.c" break; - case 124: -#line 453 "parse.y" + case 127: +#line 489 "parse.y" { - yygotominor.yy459 = sqlite3SelectNew(0,yymsp[0].minor.yy67,0,0,0,0,0,0,0); + yygotominor.yy375 = sqlite3SelectNew(0,yymsp[0].minor.yy151,0,0,0,0,0,0,0); } -#line 2375 "parse.c" +#line 2429 "parse.c" break; - case 125: -#line 459 "parse.y" -{yygotominor.yy258.z=0; yygotominor.yy258.n=0;} -#line 2380 "parse.c" - break; - case 127: -#line 464 "parse.y" -{yygotominor.yy67 = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy258,&yymsp[0].minor.yy258);} -#line 2385 "parse.c" - break; case 128: - case 129: -#line 468 "parse.y" -{ yygotominor.yy412 = JT_INNER; } -#line 2391 "parse.c" +#line 495 "parse.y" +{yygotominor.yy198.z=0; yygotominor.yy198.n=0;} +#line 2434 "parse.c" break; case 130: -#line 470 "parse.y" -{ yygotominor.yy412 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); } -#line 2396 "parse.c" +#line 500 "parse.y" +{yygotominor.yy151 = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy198,&yymsp[0].minor.yy198);} +#line 2439 "parse.c" break; case 131: -#line 471 "parse.y" -{ yygotominor.yy412 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy258,0); } -#line 2401 "parse.c" - break; case 132: -#line 473 "parse.y" -{ yygotominor.yy412 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy258,&yymsp[-1].minor.yy258); } -#line 2406 "parse.c" +#line 504 "parse.y" +{ yygotominor.yy280 = JT_INNER; } +#line 2445 "parse.c" break; case 133: - case 141: - case 150: - case 157: - case 171: - case 207: - case 232: - case 234: - case 238: -#line 477 "parse.y" -{yygotominor.yy2 = yymsp[0].minor.yy2;} -#line 2419 "parse.c" +#line 506 "parse.y" +{ yygotominor.yy280 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); } +#line 2450 "parse.c" break; case 134: - case 149: - case 156: - case 208: - case 233: - case 235: - case 239: -#line 478 "parse.y" -{yygotominor.yy2 = 0;} -#line 2430 "parse.c" +#line 507 "parse.y" +{ yygotominor.yy280 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy198,0); } +#line 2455 "parse.c" break; case 135: - case 168: -#line 482 "parse.y" -{yygotominor.yy240 = yymsp[-1].minor.yy240;} -#line 2436 "parse.c" +#line 509 "parse.y" +{ yygotominor.yy280 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy198,&yymsp[-1].minor.yy198); } +#line 2460 "parse.c" break; case 136: - case 167: -#line 483 "parse.y" -{yygotominor.yy240 = 0;} -#line 2442 "parse.c" + case 144: + case 153: + case 160: + case 174: + case 211: + case 236: + case 238: + case 242: +#line 513 "parse.y" +{yygotominor.yy62 = yymsp[0].minor.yy62;} +#line 2473 "parse.c" break; + case 137: + case 152: + case 159: + case 212: + case 237: + case 239: + case 243: +#line 514 "parse.y" +{yygotominor.yy62 = 0;} +#line 2484 "parse.c" + break; case 138: - case 148: -#line 494 "parse.y" -{yygotominor.yy82 = yymsp[0].minor.yy82;} -#line 2448 "parse.c" + case 171: +#line 518 "parse.y" +{yygotominor.yy240 = yymsp[-1].minor.yy240;} +#line 2490 "parse.c" break; case 139: -#line 495 "parse.y" -{ - yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-4].minor.yy82,yymsp[-2].minor.yy2,yymsp[-1].minor.yy258.n>0?&yymsp[-1].minor.yy258:0); - if( yygotominor.yy82 ) yygotominor.yy82->a[yygotominor.yy82->nExpr-1].sortOrder = yymsp[0].minor.yy412; -} -#line 2456 "parse.c" + case 170: +#line 519 "parse.y" +{yygotominor.yy240 = 0;} +#line 2496 "parse.c" break; - case 140: -#line 499 "parse.y" + case 141: + case 151: +#line 530 "parse.y" +{yygotominor.yy418 = yymsp[0].minor.yy418;} +#line 2502 "parse.c" + break; + case 142: +#line 531 "parse.y" { - yygotominor.yy82 = sqlite3ExprListAppend(0,yymsp[-2].minor.yy2,yymsp[-1].minor.yy258.n>0?&yymsp[-1].minor.yy258:0); - if( yygotominor.yy82 && yygotominor.yy82->a ) yygotominor.yy82->a[0].sortOrder = yymsp[0].minor.yy412; + yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-4].minor.yy418,yymsp[-2].minor.yy62,yymsp[-1].minor.yy198.n>0?&yymsp[-1].minor.yy198:0); + if( yygotominor.yy418 ) yygotominor.yy418->a[yygotominor.yy418->nExpr-1].sortOrder = yymsp[0].minor.yy280; } -#line 2464 "parse.c" +#line 2510 "parse.c" break; - case 142: - case 144: -#line 508 "parse.y" -{yygotominor.yy412 = SQLITE_SO_ASC;} -#line 2470 "parse.c" - break; case 143: -#line 509 "parse.y" -{yygotominor.yy412 = SQLITE_SO_DESC;} -#line 2475 "parse.c" +#line 535 "parse.y" +{ + yygotominor.yy418 = sqlite3ExprListAppend(0,yymsp[-2].minor.yy62,yymsp[-1].minor.yy198.n>0?&yymsp[-1].minor.yy198:0); + if( yygotominor.yy418 && yygotominor.yy418->a ) yygotominor.yy418->a[0].sortOrder = yymsp[0].minor.yy280; +} +#line 2518 "parse.c" break; case 145: -#line 511 "parse.y" -{yygotominor.yy258.z = 0; yygotominor.yy258.n = 0;} -#line 2480 "parse.c" + case 147: +#line 544 "parse.y" +{yygotominor.yy280 = SQLITE_SO_ASC;} +#line 2524 "parse.c" break; - case 151: -#line 529 "parse.y" -{yygotominor.yy244.pLimit = 0; yygotominor.yy244.pOffset = 0;} -#line 2485 "parse.c" + case 146: +#line 545 "parse.y" +{yygotominor.yy280 = SQLITE_SO_DESC;} +#line 2529 "parse.c" break; - case 152: -#line 530 "parse.y" -{yygotominor.yy244.pLimit = yymsp[0].minor.yy2; yygotominor.yy244.pOffset = 0;} -#line 2490 "parse.c" + case 148: +#line 547 "parse.y" +{yygotominor.yy198.z = 0; yygotominor.yy198.n = 0;} +#line 2534 "parse.c" break; - case 153: -#line 532 "parse.y" -{yygotominor.yy244.pLimit = yymsp[-2].minor.yy2; yygotominor.yy244.pOffset = yymsp[0].minor.yy2;} -#line 2495 "parse.c" - break; case 154: -#line 534 "parse.y" -{yygotominor.yy244.pOffset = yymsp[-2].minor.yy2; yygotominor.yy244.pLimit = yymsp[0].minor.yy2;} -#line 2500 "parse.c" +#line 565 "parse.y" +{yygotominor.yy220.pLimit = 0; yygotominor.yy220.pOffset = 0;} +#line 2539 "parse.c" break; case 155: -#line 538 "parse.y" -{sqlite3DeleteFrom(pParse,yymsp[-1].minor.yy67,yymsp[0].minor.yy2);} -#line 2505 "parse.c" +#line 566 "parse.y" +{yygotominor.yy220.pLimit = yymsp[0].minor.yy62; yygotominor.yy220.pOffset = 0;} +#line 2544 "parse.c" break; - case 158: -#line 549 "parse.y" -{sqlite3Update(pParse,yymsp[-3].minor.yy67,yymsp[-1].minor.yy82,yymsp[0].minor.yy2,yymsp[-4].minor.yy412);} -#line 2510 "parse.c" + case 156: +#line 568 "parse.y" +{yygotominor.yy220.pLimit = yymsp[-2].minor.yy62; yygotominor.yy220.pOffset = yymsp[0].minor.yy62;} +#line 2549 "parse.c" break; - case 159: -#line 555 "parse.y" -{yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-4].minor.yy82,yymsp[0].minor.yy2,&yymsp[-2].minor.yy258);} -#line 2515 "parse.c" + case 157: +#line 570 "parse.y" +{yygotominor.yy220.pOffset = yymsp[-2].minor.yy62; yygotominor.yy220.pLimit = yymsp[0].minor.yy62;} +#line 2554 "parse.c" break; - case 160: -#line 556 "parse.y" -{yygotominor.yy82 = sqlite3ExprListAppend(0,yymsp[0].minor.yy2,&yymsp[-2].minor.yy258);} -#line 2520 "parse.c" + case 158: +#line 574 "parse.y" +{sqlite3DeleteFrom(pParse,yymsp[-1].minor.yy151,yymsp[0].minor.yy62);} +#line 2559 "parse.c" break; case 161: -#line 562 "parse.y" -{sqlite3Insert(pParse, yymsp[-5].minor.yy67, yymsp[-1].minor.yy82, 0, yymsp[-4].minor.yy240, yymsp[-7].minor.yy412);} -#line 2525 "parse.c" +#line 585 "parse.y" +{sqlite3Update(pParse,yymsp[-3].minor.yy151,yymsp[-1].minor.yy418,yymsp[0].minor.yy62,yymsp[-4].minor.yy280);} +#line 2564 "parse.c" break; case 162: -#line 564 "parse.y" -{sqlite3Insert(pParse, yymsp[-2].minor.yy67, 0, yymsp[0].minor.yy459, yymsp[-1].minor.yy240, yymsp[-4].minor.yy412);} -#line 2530 "parse.c" +#line 591 "parse.y" +{yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-4].minor.yy418,yymsp[0].minor.yy62,&yymsp[-2].minor.yy198);} +#line 2569 "parse.c" break; + case 163: +#line 592 "parse.y" +{yygotominor.yy418 = sqlite3ExprListAppend(0,yymsp[0].minor.yy62,&yymsp[-2].minor.yy198);} +#line 2574 "parse.c" + break; + case 164: +#line 598 "parse.y" +{sqlite3Insert(pParse, yymsp[-5].minor.yy151, yymsp[-1].minor.yy418, 0, yymsp[-4].minor.yy240, yymsp[-7].minor.yy280);} +#line 2579 "parse.c" + break; case 165: - case 236: -#line 574 "parse.y" -{yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-2].minor.yy82,yymsp[0].minor.yy2,0);} -#line 2536 "parse.c" +#line 600 "parse.y" +{sqlite3Insert(pParse, yymsp[-2].minor.yy151, 0, yymsp[0].minor.yy375, yymsp[-1].minor.yy240, yymsp[-4].minor.yy280);} +#line 2584 "parse.c" break; - case 166: - case 237: -#line 575 "parse.y" -{yygotominor.yy82 = sqlite3ExprListAppend(0,yymsp[0].minor.yy2,0);} -#line 2542 "parse.c" + case 168: + case 240: +#line 610 "parse.y" +{yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-2].minor.yy418,yymsp[0].minor.yy62,0);} +#line 2590 "parse.c" break; case 169: -#line 584 "parse.y" -{yygotominor.yy240 = sqlite3IdListAppend(yymsp[-2].minor.yy240,&yymsp[0].minor.yy258);} -#line 2547 "parse.c" + case 241: +#line 611 "parse.y" +{yygotominor.yy418 = sqlite3ExprListAppend(0,yymsp[0].minor.yy62,0);} +#line 2596 "parse.c" break; - case 170: -#line 585 "parse.y" -{yygotominor.yy240 = sqlite3IdListAppend(0,&yymsp[0].minor.yy258);} -#line 2552 "parse.c" - break; case 172: -#line 596 "parse.y" -{yygotominor.yy2 = yymsp[-1].minor.yy2; sqlite3ExprSpan(yygotominor.yy2,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); } -#line 2557 "parse.c" +#line 620 "parse.y" +{yygotominor.yy240 = sqlite3IdListAppend(yymsp[-2].minor.yy240,&yymsp[0].minor.yy198);} +#line 2601 "parse.c" break; case 173: - case 178: - case 179: - case 180: - case 181: -#line 597 "parse.y" -{yygotominor.yy2 = sqlite3Expr(yymsp[0].major, 0, 0, &yymsp[0].minor.yy0);} -#line 2566 "parse.c" +#line 621 "parse.y" +{yygotominor.yy240 = sqlite3IdListAppend(0,&yymsp[0].minor.yy198);} +#line 2606 "parse.c" break; - case 174: case 175: -#line 598 "parse.y" -{yygotominor.yy2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy0);} -#line 2572 "parse.c" +#line 632 "parse.y" +{yygotominor.yy62 = yymsp[-1].minor.yy62; sqlite3ExprSpan(yygotominor.yy62,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); } +#line 2611 "parse.c" break; case 176: -#line 600 "parse.y" + case 181: + case 182: + case 183: + case 184: +#line 633 "parse.y" +{yygotominor.yy62 = sqlite3Expr(yymsp[0].major, 0, 0, &yymsp[0].minor.yy0);} +#line 2620 "parse.c" + break; + case 177: + case 178: +#line 634 "parse.y" +{yygotominor.yy62 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy0);} +#line 2626 "parse.c" + break; + case 179: +#line 636 "parse.y" { - Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy258); - Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy258); - yygotominor.yy2 = sqlite3Expr(TK_DOT, temp1, temp2, 0); + Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy198); + Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy198); + yygotominor.yy62 = sqlite3Expr(TK_DOT, temp1, temp2, 0); } -#line 2581 "parse.c" +#line 2635 "parse.c" break; - case 177: -#line 605 "parse.y" + case 180: +#line 641 "parse.y" { - Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-4].minor.yy258); - Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy258); - Expr *temp3 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy258); + Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-4].minor.yy198); + Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy198); + Expr *temp3 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy198); Expr *temp4 = sqlite3Expr(TK_DOT, temp2, temp3, 0); - yygotominor.yy2 = sqlite3Expr(TK_DOT, temp1, temp4, 0); + yygotominor.yy62 = sqlite3Expr(TK_DOT, temp1, temp4, 0); } -#line 2592 "parse.c" +#line 2646 "parse.c" break; - case 182: -#line 616 "parse.y" -{yygotominor.yy2 = sqlite3RegisterExpr(pParse, &yymsp[0].minor.yy0);} -#line 2597 "parse.c" + case 185: +#line 652 "parse.y" +{yygotominor.yy62 = sqlite3RegisterExpr(pParse, &yymsp[0].minor.yy0);} +#line 2651 "parse.c" break; - case 183: -#line 617 "parse.y" + case 186: +#line 653 "parse.y" { Token *pToken = &yymsp[0].minor.yy0; - Expr *pExpr = yygotominor.yy2 = sqlite3Expr(TK_VARIABLE, 0, 0, pToken); + Expr *pExpr = yygotominor.yy62 = sqlite3Expr(TK_VARIABLE, 0, 0, pToken); sqlite3ExprAssignVarNumber(pParse, pExpr); } -#line 2606 "parse.c" +#line 2660 "parse.c" break; - case 184: -#line 622 "parse.y" + case 187: +#line 659 "parse.y" { - yygotominor.yy2 = sqlite3ExprFunction(yymsp[-1].minor.yy82, &yymsp[-3].minor.yy0); - sqlite3ExprSpan(yygotominor.yy2,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); + yygotominor.yy62 = sqlite3Expr(TK_CAST, yymsp[-3].minor.yy62, 0, &yymsp[-1].minor.yy198); + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); } -#line 2614 "parse.c" +#line 2668 "parse.c" break; - case 185: -#line 626 "parse.y" + case 188: +#line 664 "parse.y" { - yygotominor.yy2 = sqlite3ExprFunction(0, &yymsp[-3].minor.yy0); - sqlite3ExprSpan(yygotominor.yy2,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); + yygotominor.yy62 = sqlite3ExprFunction(yymsp[-1].minor.yy418, &yymsp[-4].minor.yy0); + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); + if( yymsp[-2].minor.yy280 ){ + yygotominor.yy62->flags |= EP_Distinct; + } } -#line 2622 "parse.c" +#line 2679 "parse.c" break; - case 186: -#line 630 "parse.y" + case 189: +#line 671 "parse.y" { + yygotominor.yy62 = sqlite3ExprFunction(0, &yymsp[-3].minor.yy0); + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); +} +#line 2687 "parse.c" + break; + case 190: +#line 675 "parse.y" +{ /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are ** treated as functions that return constants */ - yygotominor.yy2 = sqlite3ExprFunction(0,&yymsp[0].minor.yy0); - if( yygotominor.yy2 ) yygotominor.yy2->op = TK_CONST_FUNC; + yygotominor.yy62 = sqlite3ExprFunction(0,&yymsp[0].minor.yy0); + if( yygotominor.yy62 ) yygotominor.yy62->op = TK_CONST_FUNC; } -#line 2632 "parse.c" +#line 2697 "parse.c" break; - case 187: - case 188: - case 189: - case 190: case 191: case 192: case 193: @@ -2647,476 +2708,509 @@ case 202: case 203: case 204: -#line 636 "parse.y" -{yygotominor.yy2 = sqlite3Expr(yymsp[-1].major, yymsp[-2].minor.yy2, yymsp[0].minor.yy2, 0);} -#line 2654 "parse.c" - break; case 205: -#line 655 "parse.y" -{yygotominor.yy438.operator = yymsp[0].minor.yy0; yygotominor.yy438.not = 0;} -#line 2659 "parse.c" - break; case 206: -#line 656 "parse.y" -{yygotominor.yy438.operator = yymsp[0].minor.yy0; yygotominor.yy438.not = 1;} -#line 2664 "parse.c" + case 207: + case 208: +#line 681 "parse.y" +{yygotominor.yy62 = sqlite3Expr(yymsp[-1].major, yymsp[-2].minor.yy62, yymsp[0].minor.yy62, 0);} +#line 2719 "parse.c" break; case 209: -#line 660 "parse.y" +#line 700 "parse.y" +{yygotominor.yy222.operator = yymsp[0].minor.yy0; yygotominor.yy222.not = 0;} +#line 2724 "parse.c" + break; + case 210: +#line 701 "parse.y" +{yygotominor.yy222.operator = yymsp[0].minor.yy0; yygotominor.yy222.not = 1;} +#line 2729 "parse.c" + break; + case 213: +#line 705 "parse.y" { - ExprList *pList = sqlite3ExprListAppend(0, yymsp[-1].minor.yy2, 0); - pList = sqlite3ExprListAppend(pList, yymsp[-3].minor.yy2, 0); - if( yymsp[0].minor.yy2 ){ - pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy2, 0); + ExprList *pList = sqlite3ExprListAppend(0, yymsp[-1].minor.yy62, 0); + pList = sqlite3ExprListAppend(pList, yymsp[-3].minor.yy62, 0); + if( yymsp[0].minor.yy62 ){ + pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy62, 0); } - yygotominor.yy2 = sqlite3ExprFunction(pList, &yymsp[-2].minor.yy438.operator); - if( yymsp[-2].minor.yy438.not ) yygotominor.yy2 = sqlite3Expr(TK_NOT, yygotominor.yy2, 0, 0); - sqlite3ExprSpan(yygotominor.yy2, &yymsp[-3].minor.yy2->span, &yymsp[-1].minor.yy2->span); + yygotominor.yy62 = sqlite3ExprFunction(pList, &yymsp[-2].minor.yy222.operator); + if( yymsp[-2].minor.yy222.not ) yygotominor.yy62 = sqlite3Expr(TK_NOT, yygotominor.yy62, 0, 0); + sqlite3ExprSpan(yygotominor.yy62, &yymsp[-3].minor.yy62->span, &yymsp[-1].minor.yy62->span); } -#line 2678 "parse.c" +#line 2743 "parse.c" break; - case 210: -#line 671 "parse.y" + case 214: +#line 716 "parse.y" { - yygotominor.yy2 = sqlite3Expr(TK_ISNULL, yymsp[-1].minor.yy2, 0, 0); - sqlite3ExprSpan(yygotominor.yy2,&yymsp[-1].minor.yy2->span,&yymsp[0].minor.yy0); + yygotominor.yy62 = sqlite3Expr(TK_ISNULL, yymsp[-1].minor.yy62, 0, 0); + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-1].minor.yy62->span,&yymsp[0].minor.yy0); } -#line 2686 "parse.c" +#line 2751 "parse.c" break; - case 211: -#line 675 "parse.y" + case 215: +#line 720 "parse.y" { - yygotominor.yy2 = sqlite3Expr(TK_ISNULL, yymsp[-2].minor.yy2, 0, 0); - sqlite3ExprSpan(yygotominor.yy2,&yymsp[-2].minor.yy2->span,&yymsp[0].minor.yy0); + yygotominor.yy62 = sqlite3Expr(TK_ISNULL, yymsp[-2].minor.yy62, 0, 0); + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-2].minor.yy62->span,&yymsp[0].minor.yy0); } -#line 2694 "parse.c" +#line 2759 "parse.c" break; - case 212: -#line 679 "parse.y" + case 216: +#line 724 "parse.y" { - yygotominor.yy2 = sqlite3Expr(TK_NOTNULL, yymsp[-1].minor.yy2, 0, 0); - sqlite3ExprSpan(yygotominor.yy2,&yymsp[-1].minor.yy2->span,&yymsp[0].minor.yy0); + yygotominor.yy62 = sqlite3Expr(TK_NOTNULL, yymsp[-1].minor.yy62, 0, 0); + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-1].minor.yy62->span,&yymsp[0].minor.yy0); } -#line 2702 "parse.c" +#line 2767 "parse.c" break; - case 213: -#line 683 "parse.y" + case 217: +#line 728 "parse.y" { - yygotominor.yy2 = sqlite3Expr(TK_NOTNULL, yymsp[-2].minor.yy2, 0, 0); - sqlite3ExprSpan(yygotominor.yy2,&yymsp[-2].minor.yy2->span,&yymsp[0].minor.yy0); + yygotominor.yy62 = sqlite3Expr(TK_NOTNULL, yymsp[-2].minor.yy62, 0, 0); + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-2].minor.yy62->span,&yymsp[0].minor.yy0); } -#line 2710 "parse.c" +#line 2775 "parse.c" break; - case 214: -#line 687 "parse.y" + case 218: +#line 732 "parse.y" { - yygotominor.yy2 = sqlite3Expr(TK_NOTNULL, yymsp[-3].minor.yy2, 0, 0); - sqlite3ExprSpan(yygotominor.yy2,&yymsp[-3].minor.yy2->span,&yymsp[0].minor.yy0); + yygotominor.yy62 = sqlite3Expr(TK_NOTNULL, yymsp[-3].minor.yy62, 0, 0); + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-3].minor.yy62->span,&yymsp[0].minor.yy0); } -#line 2718 "parse.c" +#line 2783 "parse.c" break; - case 215: - case 216: -#line 691 "parse.y" + case 219: + case 220: +#line 736 "parse.y" { - yygotominor.yy2 = sqlite3Expr(yymsp[-1].major, yymsp[0].minor.yy2, 0, 0); - sqlite3ExprSpan(yygotominor.yy2,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy2->span); + yygotominor.yy62 = sqlite3Expr(yymsp[-1].major, yymsp[0].minor.yy62, 0, 0); + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy62->span); } -#line 2727 "parse.c" +#line 2792 "parse.c" break; - case 217: -#line 699 "parse.y" + case 221: +#line 744 "parse.y" { - yygotominor.yy2 = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy2, 0, 0); - sqlite3ExprSpan(yygotominor.yy2,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy2->span); + yygotominor.yy62 = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy62, 0, 0); + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy62->span); } -#line 2735 "parse.c" +#line 2800 "parse.c" break; - case 218: -#line 703 "parse.y" + case 222: +#line 748 "parse.y" { - yygotominor.yy2 = sqlite3Expr(TK_UPLUS, yymsp[0].minor.yy2, 0, 0); - sqlite3ExprSpan(yygotominor.yy2,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy2->span); + yygotominor.yy62 = sqlite3Expr(TK_UPLUS, yymsp[0].minor.yy62, 0, 0); + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy62->span); } -#line 2743 "parse.c" +#line 2808 "parse.c" break; - case 221: -#line 710 "parse.y" + case 225: +#line 755 "parse.y" { - ExprList *pList = sqlite3ExprListAppend(0, yymsp[-2].minor.yy2, 0); - pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy2, 0); - yygotominor.yy2 = sqlite3Expr(TK_BETWEEN, yymsp[-4].minor.yy2, 0, 0); - if( yygotominor.yy2 ) yygotominor.yy2->pList = pList; - if( yymsp[-3].minor.yy412 ) yygotominor.yy2 = sqlite3Expr(TK_NOT, yygotominor.yy2, 0, 0); - sqlite3ExprSpan(yygotominor.yy2,&yymsp[-4].minor.yy2->span,&yymsp[0].minor.yy2->span); + ExprList *pList = sqlite3ExprListAppend(0, yymsp[-2].minor.yy62, 0); + pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy62, 0); + yygotominor.yy62 = sqlite3Expr(TK_BETWEEN, yymsp[-4].minor.yy62, 0, 0); + if( yygotominor.yy62 ){ + yygotominor.yy62->pList = pList; + }else{ + sqlite3ExprListDelete(pList); + } + if( yymsp[-3].minor.yy280 ) yygotominor.yy62 = sqlite3Expr(TK_NOT, yygotominor.yy62, 0, 0); + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-4].minor.yy62->span,&yymsp[0].minor.yy62->span); } -#line 2755 "parse.c" +#line 2824 "parse.c" break; - case 224: -#line 722 "parse.y" + case 228: +#line 771 "parse.y" { - yygotominor.yy2 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy2, 0, 0); - if( yygotominor.yy2 ){ - yygotominor.yy2->pList = yymsp[-1].minor.yy82; + yygotominor.yy62 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy62, 0, 0); + if( yygotominor.yy62 ){ + yygotominor.yy62->pList = yymsp[-1].minor.yy418; }else{ - sqlite3ExprListDelete(yymsp[-1].minor.yy82); + sqlite3ExprListDelete(yymsp[-1].minor.yy418); } - if( yymsp[-3].minor.yy412 ) yygotominor.yy2 = sqlite3Expr(TK_NOT, yygotominor.yy2, 0, 0); - sqlite3ExprSpan(yygotominor.yy2,&yymsp[-4].minor.yy2->span,&yymsp[0].minor.yy0); + if( yymsp[-3].minor.yy280 ) yygotominor.yy62 = sqlite3Expr(TK_NOT, yygotominor.yy62, 0, 0); + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-4].minor.yy62->span,&yymsp[0].minor.yy0); } -#line 2769 "parse.c" +#line 2838 "parse.c" break; - case 225: -#line 732 "parse.y" + case 229: +#line 781 "parse.y" { - yygotominor.yy2 = sqlite3Expr(TK_SELECT, 0, 0, 0); - if( yygotominor.yy2 ) yygotominor.yy2->pSelect = yymsp[-1].minor.yy459; - if( !yygotominor.yy2 ) sqlite3SelectDelete(yymsp[-1].minor.yy459); - sqlite3ExprSpan(yygotominor.yy2,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); + yygotominor.yy62 = sqlite3Expr(TK_SELECT, 0, 0, 0); + if( yygotominor.yy62 ){ + yygotominor.yy62->pSelect = yymsp[-1].minor.yy375; + }else{ + sqlite3SelectDelete(yymsp[-1].minor.yy375); + } + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); } -#line 2779 "parse.c" +#line 2851 "parse.c" break; - case 226: -#line 738 "parse.y" + case 230: +#line 790 "parse.y" { - yygotominor.yy2 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy2, 0, 0); - if( yygotominor.yy2 ) yygotominor.yy2->pSelect = yymsp[-1].minor.yy459; - if( !yygotominor.yy2 ) sqlite3SelectDelete(yymsp[-1].minor.yy459); - if( yymsp[-3].minor.yy412 ) yygotominor.yy2 = sqlite3Expr(TK_NOT, yygotominor.yy2, 0, 0); - sqlite3ExprSpan(yygotominor.yy2,&yymsp[-4].minor.yy2->span,&yymsp[0].minor.yy0); + yygotominor.yy62 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy62, 0, 0); + if( yygotominor.yy62 ){ + yygotominor.yy62->pSelect = yymsp[-1].minor.yy375; + }else{ + sqlite3SelectDelete(yymsp[-1].minor.yy375); + } + if( yymsp[-3].minor.yy280 ) yygotominor.yy62 = sqlite3Expr(TK_NOT, yygotominor.yy62, 0, 0); + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-4].minor.yy62->span,&yymsp[0].minor.yy0); } -#line 2790 "parse.c" +#line 2865 "parse.c" break; - case 227: -#line 745 "parse.y" + case 231: +#line 800 "parse.y" { - SrcList *pSrc = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy258,&yymsp[0].minor.yy258); - yygotominor.yy2 = sqlite3Expr(TK_IN, yymsp[-3].minor.yy2, 0, 0); - if( yygotominor.yy2 ) yygotominor.yy2->pSelect = sqlite3SelectNew(0,pSrc,0,0,0,0,0,0,0); - if( yymsp[-2].minor.yy412 ) yygotominor.yy2 = sqlite3Expr(TK_NOT, yygotominor.yy2, 0, 0); - sqlite3ExprSpan(yygotominor.yy2,&yymsp[-3].minor.yy2->span,yymsp[0].minor.yy258.z?&yymsp[0].minor.yy258:&yymsp[-1].minor.yy258); + SrcList *pSrc = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy198,&yymsp[0].minor.yy198); + yygotominor.yy62 = sqlite3Expr(TK_IN, yymsp[-3].minor.yy62, 0, 0); + if( yygotominor.yy62 ){ + yygotominor.yy62->pSelect = sqlite3SelectNew(0,pSrc,0,0,0,0,0,0,0); + }else{ + sqlite3SrcListDelete(pSrc); + } + if( yymsp[-2].minor.yy280 ) yygotominor.yy62 = sqlite3Expr(TK_NOT, yygotominor.yy62, 0, 0); + sqlite3ExprSpan(yygotominor.yy62,&yymsp[-3].minor.yy62->span,yymsp[0].minor.yy198.z?&yymsp[0].minor.yy198:&yymsp[-1].minor.yy198); } -#line 2801 "parse.c" +#line 2880 "parse.c" break; - case 228: -#line 752 "parse.y" + case 232: +#line 811 "parse.y" { - Expr *p = yygotominor.yy2 = sqlite3Expr(TK_EXISTS, 0, 0, 0); + Expr *p = yygotominor.yy62 = sqlite3Expr(TK_EXISTS, 0, 0, 0); if( p ){ - p->pSelect = yymsp[-1].minor.yy459; + p->pSelect = yymsp[-1].minor.yy375; sqlite3ExprSpan(p,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); + }else{ + sqlite3SelectDelete(yymsp[-1].minor.yy375); } - if( !p ) sqlite3SelectDelete(yymsp[-1].minor.yy459); } -#line 2813 "parse.c" +#line 2893 "parse.c" break; - case 229: -#line 763 "parse.y" + case 233: +#line 823 "parse.y" { - yygotominor.yy2 = sqlite3Expr(TK_CASE, yymsp[-3].minor.yy2, yymsp[-1].minor.yy2, 0); - if( yygotominor.yy2 ) yygotominor.yy2->pList = yymsp[-2].minor.yy82; - sqlite3ExprSpan(yygotominor.yy2, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0); + yygotominor.yy62 = sqlite3Expr(TK_CASE, yymsp[-3].minor.yy62, yymsp[-1].minor.yy62, 0); + if( yygotominor.yy62 ){ + yygotominor.yy62->pList = yymsp[-2].minor.yy418; + }else{ + sqlite3ExprListDelete(yymsp[-2].minor.yy418); + } + sqlite3ExprSpan(yygotominor.yy62, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0); } -#line 2822 "parse.c" +#line 2906 "parse.c" break; - case 230: -#line 770 "parse.y" + case 234: +#line 834 "parse.y" { - yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-4].minor.yy82, yymsp[-2].minor.yy2, 0); - yygotominor.yy82 = sqlite3ExprListAppend(yygotominor.yy82, yymsp[0].minor.yy2, 0); + yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-4].minor.yy418, yymsp[-2].minor.yy62, 0); + yygotominor.yy418 = sqlite3ExprListAppend(yygotominor.yy418, yymsp[0].minor.yy62, 0); } -#line 2830 "parse.c" +#line 2914 "parse.c" break; - case 231: -#line 774 "parse.y" + case 235: +#line 838 "parse.y" { - yygotominor.yy82 = sqlite3ExprListAppend(0, yymsp[-2].minor.yy2, 0); - yygotominor.yy82 = sqlite3ExprListAppend(yygotominor.yy82, yymsp[0].minor.yy2, 0); + yygotominor.yy418 = sqlite3ExprListAppend(0, yymsp[-2].minor.yy62, 0); + yygotominor.yy418 = sqlite3ExprListAppend(yygotominor.yy418, yymsp[0].minor.yy62, 0); } -#line 2838 "parse.c" +#line 2922 "parse.c" break; - case 240: -#line 799 "parse.y" + case 244: +#line 863 "parse.y" { - if( yymsp[-9].minor.yy412!=OE_None ) yymsp[-9].minor.yy412 = yymsp[0].minor.yy412; - if( yymsp[-9].minor.yy412==OE_Default) yymsp[-9].minor.yy412 = OE_Abort; - sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy258, &yymsp[-6].minor.yy258, sqlite3SrcListAppend(0,&yymsp[-4].minor.yy258,0),yymsp[-2].minor.yy82,yymsp[-9].minor.yy412, &yymsp[-10].minor.yy0, &yymsp[-1].minor.yy0); + if( yymsp[-9].minor.yy280!=OE_None ) yymsp[-9].minor.yy280 = yymsp[0].minor.yy280; + if( yymsp[-9].minor.yy280==OE_Default) yymsp[-9].minor.yy280 = OE_Abort; + sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy198, &yymsp[-6].minor.yy198, sqlite3SrcListAppend(0,&yymsp[-4].minor.yy198,0),yymsp[-2].minor.yy418,yymsp[-9].minor.yy280, &yymsp[-10].minor.yy0, &yymsp[-1].minor.yy0); } -#line 2847 "parse.c" +#line 2931 "parse.c" break; - case 241: - case 288: -#line 806 "parse.y" -{yygotominor.yy412 = OE_Abort;} -#line 2853 "parse.c" + case 245: + case 292: +#line 870 "parse.y" +{yygotominor.yy280 = OE_Abort;} +#line 2937 "parse.c" break; - case 242: -#line 807 "parse.y" -{yygotominor.yy412 = OE_None;} -#line 2858 "parse.c" + case 246: +#line 871 "parse.y" +{yygotominor.yy280 = OE_None;} +#line 2942 "parse.c" break; - case 245: -#line 817 "parse.y" + case 249: +#line 881 "parse.y" { Expr *p = 0; - if( yymsp[-1].minor.yy258.n>0 ){ + if( yymsp[-1].minor.yy198.n>0 ){ p = sqlite3Expr(TK_COLUMN, 0, 0, 0); - if( p ) p->pColl = sqlite3LocateCollSeq(pParse, yymsp[-1].minor.yy258.z, yymsp[-1].minor.yy258.n); + if( p ) p->pColl = sqlite3LocateCollSeq(pParse, yymsp[-1].minor.yy198.z, yymsp[-1].minor.yy198.n); } - yygotominor.yy82 = sqlite3ExprListAppend(yymsp[-4].minor.yy82, p, &yymsp[-2].minor.yy258); + yygotominor.yy418 = sqlite3ExprListAppend(yymsp[-4].minor.yy418, p, &yymsp[-2].minor.yy198); } -#line 2870 "parse.c" +#line 2954 "parse.c" break; - case 246: -#line 825 "parse.y" + case 250: +#line 889 "parse.y" { Expr *p = 0; - if( yymsp[-1].minor.yy258.n>0 ){ + if( yymsp[-1].minor.yy198.n>0 ){ p = sqlite3Expr(TK_COLUMN, 0, 0, 0); - if( p ) p->pColl = sqlite3LocateCollSeq(pParse, yymsp[-1].minor.yy258.z, yymsp[-1].minor.yy258.n); + if( p ) p->pColl = sqlite3LocateCollSeq(pParse, yymsp[-1].minor.yy198.z, yymsp[-1].minor.yy198.n); } - yygotominor.yy82 = sqlite3ExprListAppend(0, p, &yymsp[-2].minor.yy258); + yygotominor.yy418 = sqlite3ExprListAppend(0, p, &yymsp[-2].minor.yy198); } -#line 2882 "parse.c" +#line 2966 "parse.c" break; - case 248: -#line 838 "parse.y" -{sqlite3DropIndex(pParse, yymsp[0].minor.yy67);} -#line 2887 "parse.c" + case 252: +#line 902 "parse.y" +{sqlite3DropIndex(pParse, yymsp[0].minor.yy151);} +#line 2971 "parse.c" break; - case 249: - case 250: -#line 842 "parse.y" + case 253: + case 254: +#line 906 "parse.y" {sqlite3Vacuum(pParse,0);} -#line 2893 "parse.c" +#line 2977 "parse.c" break; - case 251: - case 253: -#line 848 "parse.y" -{sqlite3Pragma(pParse,&yymsp[-3].minor.yy258,&yymsp[-2].minor.yy258,&yymsp[0].minor.yy258,0);} -#line 2899 "parse.c" + case 255: + case 257: +#line 912 "parse.y" +{sqlite3Pragma(pParse,&yymsp[-3].minor.yy198,&yymsp[-2].minor.yy198,&yymsp[0].minor.yy198,0);} +#line 2983 "parse.c" break; - case 252: -#line 849 "parse.y" -{sqlite3Pragma(pParse,&yymsp[-3].minor.yy258,&yymsp[-2].minor.yy258,&yymsp[0].minor.yy0,0);} -#line 2904 "parse.c" + case 256: +#line 913 "parse.y" +{sqlite3Pragma(pParse,&yymsp[-3].minor.yy198,&yymsp[-2].minor.yy198,&yymsp[0].minor.yy0,0);} +#line 2988 "parse.c" break; - case 254: -#line 851 "parse.y" + case 258: +#line 915 "parse.y" { - sqlite3Pragma(pParse,&yymsp[-3].minor.yy258,&yymsp[-2].minor.yy258,&yymsp[0].minor.yy258,1); + sqlite3Pragma(pParse,&yymsp[-3].minor.yy198,&yymsp[-2].minor.yy198,&yymsp[0].minor.yy198,1); } -#line 2911 "parse.c" +#line 2995 "parse.c" break; - case 255: -#line 854 "parse.y" -{sqlite3Pragma(pParse,&yymsp[-4].minor.yy258,&yymsp[-3].minor.yy258,&yymsp[-1].minor.yy258,0);} -#line 2916 "parse.c" + case 259: +#line 918 "parse.y" +{sqlite3Pragma(pParse,&yymsp[-4].minor.yy198,&yymsp[-3].minor.yy198,&yymsp[-1].minor.yy198,0);} +#line 3000 "parse.c" break; - case 256: -#line 855 "parse.y" -{sqlite3Pragma(pParse,&yymsp[-1].minor.yy258,&yymsp[0].minor.yy258,0,0);} -#line 2921 "parse.c" + case 260: +#line 919 "parse.y" +{sqlite3Pragma(pParse,&yymsp[-1].minor.yy198,&yymsp[0].minor.yy198,0,0);} +#line 3005 "parse.c" break; - case 263: -#line 868 "parse.y" + case 267: +#line 932 "parse.y" { Token all; - all.z = yymsp[-3].minor.yy258.z; - all.n = (yymsp[0].minor.yy0.z - yymsp[-3].minor.yy258.z) + yymsp[0].minor.yy0.n; - sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy347, &all); + all.z = yymsp[-3].minor.yy198.z; + all.n = (yymsp[0].minor.yy0.z - yymsp[-3].minor.yy198.z) + yymsp[0].minor.yy0.n; + sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy360, &all); } -#line 2931 "parse.c" +#line 3015 "parse.c" break; - case 264: -#line 877 "parse.y" + case 268: +#line 941 "parse.y" { - sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy258, &yymsp[-6].minor.yy258, yymsp[-5].minor.yy412, yymsp[-4].minor.yy210.a, yymsp[-4].minor.yy210.b, yymsp[-2].minor.yy67, yymsp[-1].minor.yy412, yymsp[0].minor.yy2, yymsp[-9].minor.yy412); - yygotominor.yy258 = (yymsp[-6].minor.yy258.n==0?yymsp[-7].minor.yy258:yymsp[-6].minor.yy258); + sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy198, &yymsp[-6].minor.yy198, yymsp[-5].minor.yy280, yymsp[-4].minor.yy30.a, yymsp[-4].minor.yy30.b, yymsp[-2].minor.yy151, yymsp[-1].minor.yy280, yymsp[0].minor.yy62, yymsp[-9].minor.yy280); + yygotominor.yy198 = (yymsp[-6].minor.yy198.n==0?yymsp[-7].minor.yy198:yymsp[-6].minor.yy198); } -#line 2939 "parse.c" +#line 3023 "parse.c" break; - case 265: - case 268: -#line 883 "parse.y" -{ yygotominor.yy412 = TK_BEFORE; } -#line 2945 "parse.c" - break; - case 266: -#line 884 "parse.y" -{ yygotominor.yy412 = TK_AFTER; } -#line 2950 "parse.c" - break; - case 267: -#line 885 "parse.y" -{ yygotominor.yy412 = TK_INSTEAD;} -#line 2955 "parse.c" - break; case 269: + case 272: +#line 947 "parse.y" +{ yygotominor.yy280 = TK_BEFORE; } +#line 3029 "parse.c" + break; case 270: - case 271: -#line 890 "parse.y" -{yygotominor.yy210.a = yymsp[0].major; yygotominor.yy210.b = 0;} -#line 2962 "parse.c" +#line 948 "parse.y" +{ yygotominor.yy280 = TK_AFTER; } +#line 3034 "parse.c" break; - case 272: -#line 893 "parse.y" -{yygotominor.yy210.a = TK_UPDATE; yygotominor.yy210.b = yymsp[0].minor.yy240;} -#line 2967 "parse.c" + case 271: +#line 949 "parse.y" +{ yygotominor.yy280 = TK_INSTEAD;} +#line 3039 "parse.c" break; case 273: case 274: -#line 896 "parse.y" -{ yygotominor.yy412 = TK_ROW; } -#line 2973 "parse.c" - break; case 275: -#line 898 "parse.y" -{ yygotominor.yy412 = TK_STATEMENT; } -#line 2978 "parse.c" +#line 954 "parse.y" +{yygotominor.yy30.a = yymsp[0].major; yygotominor.yy30.b = 0;} +#line 3046 "parse.c" break; case 276: -#line 901 "parse.y" -{ yygotominor.yy2 = 0; } -#line 2983 "parse.c" +#line 957 "parse.y" +{yygotominor.yy30.a = TK_UPDATE; yygotominor.yy30.b = yymsp[0].minor.yy240;} +#line 3051 "parse.c" break; case 277: -#line 902 "parse.y" -{ yygotominor.yy2 = yymsp[0].minor.yy2; } -#line 2988 "parse.c" - break; case 278: -#line 906 "parse.y" -{ - yymsp[-2].minor.yy347->pNext = yymsp[0].minor.yy347; - yygotominor.yy347 = yymsp[-2].minor.yy347; -} -#line 2996 "parse.c" +#line 960 "parse.y" +{ yygotominor.yy280 = TK_ROW; } +#line 3057 "parse.c" break; case 279: -#line 910 "parse.y" -{ yygotominor.yy347 = 0; } -#line 3001 "parse.c" +#line 962 "parse.y" +{ yygotominor.yy280 = TK_STATEMENT; } +#line 3062 "parse.c" break; case 280: -#line 916 "parse.y" -{ yygotominor.yy347 = sqlite3TriggerUpdateStep(&yymsp[-3].minor.yy258, yymsp[-1].minor.yy82, yymsp[0].minor.yy2, yymsp[-4].minor.yy412); } -#line 3006 "parse.c" +#line 965 "parse.y" +{ yygotominor.yy62 = 0; } +#line 3067 "parse.c" break; case 281: -#line 921 "parse.y" -{yygotominor.yy347 = sqlite3TriggerInsertStep(&yymsp[-5].minor.yy258, yymsp[-4].minor.yy240, yymsp[-1].minor.yy82, 0, yymsp[-7].minor.yy412);} -#line 3011 "parse.c" +#line 966 "parse.y" +{ yygotominor.yy62 = yymsp[0].minor.yy62; } +#line 3072 "parse.c" break; case 282: -#line 924 "parse.y" -{yygotominor.yy347 = sqlite3TriggerInsertStep(&yymsp[-2].minor.yy258, yymsp[-1].minor.yy240, 0, yymsp[0].minor.yy459, yymsp[-4].minor.yy412);} -#line 3016 "parse.c" +#line 970 "parse.y" +{ + yymsp[-2].minor.yy360->pNext = yymsp[0].minor.yy360; + yygotominor.yy360 = yymsp[-2].minor.yy360; +} +#line 3080 "parse.c" break; case 283: -#line 928 "parse.y" -{yygotominor.yy347 = sqlite3TriggerDeleteStep(&yymsp[-1].minor.yy258, yymsp[0].minor.yy2);} -#line 3021 "parse.c" +#line 974 "parse.y" +{ yygotominor.yy360 = 0; } +#line 3085 "parse.c" break; case 284: -#line 931 "parse.y" -{yygotominor.yy347 = sqlite3TriggerSelectStep(yymsp[0].minor.yy459); } -#line 3026 "parse.c" +#line 980 "parse.y" +{ yygotominor.yy360 = sqlite3TriggerUpdateStep(&yymsp[-3].minor.yy198, yymsp[-1].minor.yy418, yymsp[0].minor.yy62, yymsp[-4].minor.yy280); } +#line 3090 "parse.c" break; case 285: -#line 934 "parse.y" -{ - yygotominor.yy2 = sqlite3Expr(TK_RAISE, 0, 0, 0); - yygotominor.yy2->iColumn = OE_Ignore; - sqlite3ExprSpan(yygotominor.yy2, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0); -} -#line 3035 "parse.c" +#line 985 "parse.y" +{yygotominor.yy360 = sqlite3TriggerInsertStep(&yymsp[-5].minor.yy198, yymsp[-4].minor.yy240, yymsp[-1].minor.yy418, 0, yymsp[-7].minor.yy280);} +#line 3095 "parse.c" break; case 286: -#line 939 "parse.y" -{ - yygotominor.yy2 = sqlite3Expr(TK_RAISE, 0, 0, &yymsp[-1].minor.yy258); - yygotominor.yy2->iColumn = yymsp[-3].minor.yy412; - sqlite3ExprSpan(yygotominor.yy2, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0); -} -#line 3044 "parse.c" +#line 988 "parse.y" +{yygotominor.yy360 = sqlite3TriggerInsertStep(&yymsp[-2].minor.yy198, yymsp[-1].minor.yy240, 0, yymsp[0].minor.yy375, yymsp[-4].minor.yy280);} +#line 3100 "parse.c" break; case 287: -#line 947 "parse.y" -{yygotominor.yy412 = OE_Rollback;} -#line 3049 "parse.c" +#line 992 "parse.y" +{yygotominor.yy360 = sqlite3TriggerDeleteStep(&yymsp[-1].minor.yy198, yymsp[0].minor.yy62);} +#line 3105 "parse.c" break; + case 288: +#line 995 "parse.y" +{yygotominor.yy360 = sqlite3TriggerSelectStep(yymsp[0].minor.yy375); } +#line 3110 "parse.c" + break; case 289: -#line 949 "parse.y" -{yygotominor.yy412 = OE_Fail;} -#line 3054 "parse.c" +#line 998 "parse.y" +{ + yygotominor.yy62 = sqlite3Expr(TK_RAISE, 0, 0, 0); + yygotominor.yy62->iColumn = OE_Ignore; + sqlite3ExprSpan(yygotominor.yy62, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0); +} +#line 3119 "parse.c" break; case 290: -#line 954 "parse.y" +#line 1003 "parse.y" { - sqlite3DropTrigger(pParse,yymsp[0].minor.yy67); + yygotominor.yy62 = sqlite3Expr(TK_RAISE, 0, 0, &yymsp[-1].minor.yy198); + yygotominor.yy62->iColumn = yymsp[-3].minor.yy280; + sqlite3ExprSpan(yygotominor.yy62, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0); } -#line 3061 "parse.c" +#line 3128 "parse.c" break; case 291: -#line 960 "parse.y" +#line 1011 "parse.y" +{yygotominor.yy280 = OE_Rollback;} +#line 3133 "parse.c" + break; + case 293: +#line 1013 "parse.y" +{yygotominor.yy280 = OE_Fail;} +#line 3138 "parse.c" + break; + case 294: +#line 1018 "parse.y" { - sqlite3Attach(pParse, &yymsp[-3].minor.yy258, &yymsp[-1].minor.yy258, yymsp[0].minor.yy132.type, &yymsp[0].minor.yy132.key); + sqlite3DropTrigger(pParse,yymsp[0].minor.yy151); } -#line 3068 "parse.c" +#line 3145 "parse.c" break; - case 292: -#line 964 "parse.y" -{ yygotominor.yy132.type = 0; } -#line 3073 "parse.c" + case 295: +#line 1024 "parse.y" +{ + sqlite3Attach(pParse, &yymsp[-3].minor.yy198, &yymsp[-1].minor.yy198, yymsp[0].minor.yy361.type, &yymsp[0].minor.yy361.key); +} +#line 3152 "parse.c" break; - case 293: -#line 965 "parse.y" -{ yygotominor.yy132.type=1; yygotominor.yy132.key = yymsp[0].minor.yy258; } -#line 3078 "parse.c" + case 296: +#line 1028 "parse.y" +{ yygotominor.yy361.type = 0; } +#line 3157 "parse.c" break; - case 294: -#line 966 "parse.y" -{ yygotominor.yy132.type=2; yygotominor.yy132.key = yymsp[0].minor.yy0; } -#line 3083 "parse.c" - break; case 297: -#line 972 "parse.y" +#line 1029 "parse.y" +{ yygotominor.yy361.type=1; yygotominor.yy361.key = yymsp[0].minor.yy198; } +#line 3162 "parse.c" + break; + case 298: +#line 1030 "parse.y" +{ yygotominor.yy361.type=2; yygotominor.yy361.key = yymsp[0].minor.yy0; } +#line 3167 "parse.c" + break; + case 301: +#line 1036 "parse.y" { - sqlite3Detach(pParse, &yymsp[0].minor.yy258); + sqlite3Detach(pParse, &yymsp[0].minor.yy198); } -#line 3090 "parse.c" +#line 3174 "parse.c" break; - case 298: -#line 978 "parse.y" + case 302: +#line 1042 "parse.y" {sqlite3Reindex(pParse, 0, 0);} -#line 3095 "parse.c" +#line 3179 "parse.c" break; - case 299: -#line 979 "parse.y" -{sqlite3Reindex(pParse, &yymsp[-1].minor.yy258, &yymsp[0].minor.yy258);} -#line 3100 "parse.c" + case 303: +#line 1043 "parse.y" +{sqlite3Reindex(pParse, &yymsp[-1].minor.yy198, &yymsp[0].minor.yy198);} +#line 3184 "parse.c" break; - case 300: -#line 984 "parse.y" + case 304: +#line 1048 "parse.y" +{sqlite3Analyze(pParse, 0, 0);} +#line 3189 "parse.c" + break; + case 305: +#line 1049 "parse.y" +{sqlite3Analyze(pParse, &yymsp[-1].minor.yy198, &yymsp[0].minor.yy198);} +#line 3194 "parse.c" + break; + case 306: +#line 1054 "parse.y" { - sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy67,&yymsp[0].minor.yy258); + sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy151,&yymsp[0].minor.yy198); } -#line 3107 "parse.c" +#line 3201 "parse.c" break; - case 301: -#line 987 "parse.y" + case 307: +#line 1057 "parse.y" { - sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy258); + sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy198); } -#line 3114 "parse.c" +#line 3208 "parse.c" break; - case 302: -#line 990 "parse.y" + case 308: +#line 1060 "parse.y" { - sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy67); + sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy151); } -#line 3121 "parse.c" +#line 3215 "parse.c" break; }; yygoto = yyRuleInfo[yyruleno].lhs; @@ -3173,7 +3267,7 @@ ){ sqlite3ParserARG_FETCH; #define TOKEN (yyminor.yy0) -#line 23 "parse.y" +#line 34 "parse.y" if( pParse->zErrMsg==0 ){ if( TOKEN.z[0] ){ @@ -3182,7 +3276,7 @@ sqlite3ErrorMsg(pParse, "incomplete SQL statement"); } } -#line 3188 "parse.c" +#line 3282 "parse.c" sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ } ======================================================================== --- sqlite/parse.h 55c238b9c97ae9a71722f2fabf3e0d23660e4e63 +++ sqlite/parse.h c3a865a73a9e4988142a3008f99d3cc91fdf77b4 @@ -6,135 +6,140 @@ #define TK_FUNCTION 6 #define TK_COLUMN 7 #define TK_AGG_FUNCTION 8 +#define TK_AGG_COLUMN 9 +#define TK_CONST_FUNC 10 +#define TK_SEMI 11 +#define TK_EXPLAIN 12 +#define TK_QUERY 13 +#define TK_PLAN 14 +#define TK_BEGIN 15 +#define TK_TRANSACTION 16 +#define TK_DEFERRED 17 +#define TK_IMMEDIATE 18 +#define TK_EXCLUSIVE 19 +#define TK_COMMIT 20 +#define TK_END 21 +#define TK_ROLLBACK 22 +#define TK_CREATE 23 +#define TK_TABLE 24 +#define TK_TEMP 25 +#define TK_LP 26 +#define TK_RP 27 +#define TK_AS 28 +#define TK_COMMA 29 +#define TK_ID 30 +#define TK_ABORT 31 +#define TK_AFTER 32 +#define TK_ANALYZE 33 +#define TK_ASC 34 +#define TK_ATTACH 35 +#define TK_BEFORE 36 +#define TK_CASCADE 37 +#define TK_CAST 38 +#define TK_CONFLICT 39 +#define TK_DATABASE 40 +#define TK_DESC 41 +#define TK_DETACH 42 +#define TK_EACH 43 +#define TK_FAIL 44 +#define TK_FOR 45 +#define TK_IGNORE 46 +#define TK_INITIALLY 47 +#define TK_INSTEAD 48 +#define TK_LIKE_KW 49 +#define TK_MATCH 50 +#define TK_KEY 51 +#define TK_OF 52 +#define TK_OFFSET 53 +#define TK_PRAGMA 54 +#define TK_RAISE 55 +#define TK_REPLACE 56 +#define TK_RESTRICT 57 +#define TK_ROW 58 +#define TK_STATEMENT 59 +#define TK_TRIGGER 60 +#define TK_VACUUM 61 +#define TK_VIEW 62 +#define TK_REINDEX 63 +#define TK_RENAME 64 +#define TK_CTIME_KW 65 +#define TK_ALTER 66 +#define TK_OR 67 +#define TK_AND 68 +#define TK_NOT 69 +#define TK_IS 70 +#define TK_BETWEEN 71 +#define TK_IN 72 +#define TK_ISNULL 73 +#define TK_NOTNULL 74 +#define TK_NE 75 +#define TK_EQ 76 +#define TK_GT 77 +#define TK_LE 78 +#define TK_LT 79 +#define TK_GE 80 +#define TK_ESCAPE 81 +#define TK_BITAND 82 +#define TK_BITOR 83 +#define TK_LSHIFT 84 +#define TK_RSHIFT 85 +#define TK_PLUS 86 +#define TK_MINUS 87 +#define TK_STAR 88 +#define TK_SLASH 89 +#define TK_REM 90 +#define TK_CONCAT 91 +#define TK_UMINUS 92 +#define TK_UPLUS 93 +#define TK_BITNOT 94 +#define TK_STRING 95 +#define TK_JOIN_KW 96 +#define TK_CONSTRAINT 97 +#define TK_DEFAULT 98 +#define TK_NULL 99 +#define TK_PRIMARY 100 +#define TK_UNIQUE 101 +#define TK_CHECK 102 +#define TK_REFERENCES 103 +#define TK_COLLATE 104 +#define TK_AUTOINCR 105 +#define TK_ON 106 +#define TK_DELETE 107 +#define TK_UPDATE 108 +#define TK_INSERT 109 +#define TK_SET 110 +#define TK_DEFERRABLE 111 +#define TK_FOREIGN 112 +#define TK_DROP 113 +#define TK_UNION 114 +#define TK_ALL 115 +#define TK_INTERSECT 116 +#define TK_EXCEPT 117 +#define TK_SELECT 118 +#define TK_DISTINCT 119 +#define TK_DOT 120 +#define TK_FROM 121 +#define TK_JOIN 122 +#define TK_USING 123 +#define TK_ORDER 124 +#define TK_BY 125 +#define TK_GROUP 126 +#define TK_HAVING 127 +#define TK_LIMIT 128 +#define TK_WHERE 129 +#define TK_INTO 130 +#define TK_VALUES 131 +#define TK_INTEGER 132 +#define TK_FLOAT 133 +#define TK_BLOB 134 +#define TK_REGISTER 135 +#define TK_VARIABLE 136 +#define TK_EXISTS 137 +#define TK_CASE 138 +#define TK_WHEN 139 +#define TK_THEN 140 +#define TK_ELSE 141 +#define TK_INDEX 142 +#define TK_TO 143 +#define TK_ADD 144 +#define TK_COLUMNKW 145 -#define TK_CONST_FUNC 9 -#define TK_SEMI 10 -#define TK_EXPLAIN 11 -#define TK_BEGIN 12 -#define TK_TRANSACTION 13 -#define TK_DEFERRED 14 -#define TK_IMMEDIATE 15 -#define TK_EXCLUSIVE 16 -#define TK_COMMIT 17 -#define TK_END 18 -#define TK_ROLLBACK 19 -#define TK_CREATE 20 -#define TK_TABLE 21 -#define TK_TEMP 22 -#define TK_LP 23 -#define TK_RP 24 -#define TK_AS 25 -#define TK_COMMA 26 -#define TK_ID 27 -#define TK_ABORT 28 -#define TK_AFTER 29 -#define TK_ASC 30 -#define TK_ATTACH 31 -#define TK_BEFORE 32 -#define TK_CASCADE 33 -#define TK_CONFLICT 34 -#define TK_DATABASE 35 -#define TK_DESC 36 -#define TK_DETACH 37 -#define TK_EACH 38 -#define TK_FAIL 39 -#define TK_FOR 40 -#define TK_IGNORE 41 -#define TK_INITIALLY 42 -#define TK_INSTEAD 43 -#define TK_LIKE_KW 44 -#define TK_MATCH 45 -#define TK_KEY 46 -#define TK_OF 47 -#define TK_OFFSET 48 -#define TK_PRAGMA 49 -#define TK_RAISE 50 -#define TK_REPLACE 51 -#define TK_RESTRICT 52 -#define TK_ROW 53 -#define TK_STATEMENT 54 -#define TK_TRIGGER 55 -#define TK_VACUUM 56 -#define TK_VIEW 57 -#define TK_REINDEX 58 -#define TK_RENAME 59 -#define TK_CTIME_KW 60 -#define TK_ALTER 61 -#define TK_OR 62 -#define TK_AND 63 -#define TK_NOT 64 -#define TK_IS 65 -#define TK_BETWEEN 66 -#define TK_IN 67 -#define TK_ISNULL 68 -#define TK_NOTNULL 69 -#define TK_NE 70 -#define TK_EQ 71 -#define TK_GT 72 -#define TK_LE 73 -#define TK_LT 74 -#define TK_GE 75 -#define TK_ESCAPE 76 -#define TK_BITAND 77 -#define TK_BITOR 78 -#define TK_LSHIFT 79 -#define TK_RSHIFT 80 -#define TK_PLUS 81 -#define TK_MINUS 82 -#define TK_STAR 83 -#define TK_SLASH 84 -#define TK_REM 85 -#define TK_CONCAT 86 -#define TK_UMINUS 87 -#define TK_UPLUS 88 -#define TK_BITNOT 89 -#define TK_STRING 90 -#define TK_JOIN_KW 91 -#define TK_CONSTRAINT 92 -#define TK_DEFAULT 93 -#define TK_NULL 94 -#define TK_PRIMARY 95 -#define TK_UNIQUE 96 -#define TK_CHECK 97 -#define TK_REFERENCES 98 -#define TK_COLLATE 99 -#define TK_AUTOINCR 100 -#define TK_ON 101 -#define TK_DELETE 102 -#define TK_UPDATE 103 -#define TK_INSERT 104 -#define TK_SET 105 -#define TK_DEFERRABLE 106 -#define TK_FOREIGN 107 -#define TK_DROP 108 -#define TK_UNION 109 -#define TK_ALL 110 -#define TK_INTERSECT 111 -#define TK_EXCEPT 112 -#define TK_SELECT 113 -#define TK_DISTINCT 114 -#define TK_DOT 115 -#define TK_FROM 116 -#define TK_JOIN 117 -#define TK_USING 118 -#define TK_ORDER 119 -#define TK_BY 120 -#define TK_GROUP 121 -#define TK_HAVING 122 -#define TK_LIMIT 123 -#define TK_WHERE 124 -#define TK_INTO 125 -#define TK_VALUES 126 -#define TK_INTEGER 127 -#define TK_FLOAT 128 -#define TK_BLOB 129 -#define TK_REGISTER 130 -#define TK_VARIABLE 131 -#define TK_EXISTS 132 -#define TK_CASE 133 -#define TK_WHEN 134 -#define TK_THEN 135 -#define TK_ELSE 136 -#define TK_INDEX 137 -#define TK_TO 138 -#define TK_ADD 139 -#define TK_COLUMNKW 140 ======================================================================== --- sqlite/pragma.c 5ea2ba0e43f6a83968a936b071b77bd4516d11f0 +++ sqlite/pragma.c 6d773e25e8af13ef0820531ad2793417f8a8959d @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** -** $Id: pragma.c,v 1.95 2005/06/12 21:35:52 drh Exp $ +** $Id: pragma.c,v 1.99 2005/09/17 16:36:56 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -583,12 +583,13 @@ while(pFK){ int j; for(j=0; jnCol; j++){ + char *zCol = pFK->aCol[j].zCol; sqlite3VdbeAddOp(v, OP_Integer, i, 0); sqlite3VdbeAddOp(v, OP_Integer, j, 0); sqlite3VdbeOp3(v, OP_String8, 0, 0, pFK->zTo, 0); sqlite3VdbeOp3(v, OP_String8, 0, 0, pTab->aCol[pFK->aCol[j].iFrom].zName, 0); - sqlite3VdbeOp3(v, OP_String8, 0, 0, pFK->aCol[j].zCol, 0); + sqlite3VdbeOp3(v, zCol ? OP_String8 : OP_Null, 0, 0, zCol, 0); sqlite3VdbeAddOp(v, OP_Callback, 5, 0); } ++i; @@ -602,14 +603,25 @@ #ifndef NDEBUG if( sqlite3StrICmp(zLeft, "parser_trace")==0 ){ extern void sqlite3ParserTrace(FILE*, char *); - if( getBoolean(zRight) ){ - sqlite3ParserTrace(stdout, "parser: "); - }else{ - sqlite3ParserTrace(0, 0); + if( zRight ){ + if( getBoolean(zRight) ){ + sqlite3ParserTrace(stderr, "parser: "); + }else{ + sqlite3ParserTrace(0, 0); + } } }else #endif + /* Reinstall the LIKE and GLOB functions. The variant of LIKE + ** used will be case sensitive or not depending on the RHS. + */ + if( sqlite3StrICmp(zLeft, "case_sensitive_like")==0 ){ + if( zRight ){ + sqlite3RegisterLikeFunctions(db, getBoolean(zRight)); + } + }else + #ifndef SQLITE_OMIT_INTEGRITY_CHECK if( sqlite3StrICmp(zLeft, "integrity_check")==0 ){ int i, j, addr; @@ -891,13 +903,13 @@ Btree *pBt; Pager *pPager; if( db->aDb[i].zName==0 ) continue; - sqlite3VdbeOp3(v, OP_String, 0, 0, db->aDb[i].zName, P3_STATIC); + sqlite3VdbeOp3(v, OP_String8, 0, 0, db->aDb[i].zName, P3_STATIC); pBt = db->aDb[i].pBt; if( pBt==0 || (pPager = sqlite3BtreePager(pBt))==0 ){ - sqlite3VdbeOp3(v, OP_String, 0, 0, "closed", P3_STATIC); + sqlite3VdbeOp3(v, OP_String8, 0, 0, "closed", P3_STATIC); }else{ int j = sqlite3pager_lockstate(pPager); - sqlite3VdbeOp3(v, OP_String, 0, 0, + sqlite3VdbeOp3(v, OP_String8, 0, 0, (j>=0 && j<=4) ? azLockName[j] : "unknown", P3_STATIC); } sqlite3VdbeAddOp(v, OP_Callback, 2, 0); ======================================================================== --- sqlite/prepare.c d53602d2f8e097225ae7c76ec764ae68f759ba47 +++ sqlite/prepare.c fc098db25d2a121affb08686cf04833fd50452d4 @@ -13,7 +13,7 @@ ** interface, and routines that contribute to loading the database schema ** from disk. ** -** $Id: prepare.c,v 1.1 2005/05/25 04:11:56 danielk1977 Exp $ +** $Id: prepare.c,v 1.4 2005/09/10 16:46:13 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -294,6 +294,11 @@ rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0); sqlite3SafetyOn(db); sqliteFree(zSql); +#ifndef SQLITE_OMIT_ANALYZE + if( rc==SQLITE_OK ){ + sqlite3AnalysisLoad(db, iDb); + } +#endif sqlite3BtreeCloseCursor(curMain); } if( sqlite3_malloc_failed ){ @@ -370,7 +375,7 @@ rc = sqlite3Init(db, &pParse->zErrMsg); } } - assert( rc!=SQLITE_OK || (db->flags & SQLITE_Initialized)||db->init.busy ); + assert( rc!=SQLITE_OK || (db->flags & SQLITE_Initialized) || db->init.busy ); if( rc!=SQLITE_OK ){ pParse->rc = rc; pParse->nErr++; @@ -453,12 +458,19 @@ #ifndef SQLITE_OMIT_EXPLAIN if( rc==SQLITE_OK && sParse.pVdbe && sParse.explain ){ - sqlite3VdbeSetNumCols(sParse.pVdbe, 5); - sqlite3VdbeSetColName(sParse.pVdbe, 0, "addr", P3_STATIC); - sqlite3VdbeSetColName(sParse.pVdbe, 1, "opcode", P3_STATIC); - sqlite3VdbeSetColName(sParse.pVdbe, 2, "p1", P3_STATIC); - sqlite3VdbeSetColName(sParse.pVdbe, 3, "p2", P3_STATIC); - sqlite3VdbeSetColName(sParse.pVdbe, 4, "p3", P3_STATIC); + if( sParse.explain==2 ){ + sqlite3VdbeSetNumCols(sParse.pVdbe, 3); + sqlite3VdbeSetColName(sParse.pVdbe, 0, "order", P3_STATIC); + sqlite3VdbeSetColName(sParse.pVdbe, 1, "from", P3_STATIC); + sqlite3VdbeSetColName(sParse.pVdbe, 2, "detail", P3_STATIC); + }else{ + sqlite3VdbeSetNumCols(sParse.pVdbe, 5); + sqlite3VdbeSetColName(sParse.pVdbe, 0, "addr", P3_STATIC); + sqlite3VdbeSetColName(sParse.pVdbe, 1, "opcode", P3_STATIC); + sqlite3VdbeSetColName(sParse.pVdbe, 2, "p1", P3_STATIC); + sqlite3VdbeSetColName(sParse.pVdbe, 3, "p2", P3_STATIC); + sqlite3VdbeSetColName(sParse.pVdbe, 4, "p3", P3_STATIC); + } } #endif @@ -526,4 +538,3 @@ return rc; } #endif /* SQLITE_OMIT_UTF16 */ - ======================================================================== --- sqlite/printf.c 3d20b21cfecadacecac3fb7274e746cb81d3d357 +++ sqlite/printf.c bd421c1ad5e01013c89af63c60eab02852ccd15e @@ -111,6 +111,7 @@ static const et_info fmtinfo[] = { { 'd', 10, 1, etRADIX, 0, 0 }, { 's', 0, 4, etSTRING, 0, 0 }, + { 'g', 0, 1, etGENERIC, 30, 0 }, { 'z', 0, 6, etDYNSTRING, 0, 0 }, { 'q', 0, 4, etSQLESCAPE, 0, 0 }, { 'Q', 0, 4, etSQLESCAPE2, 0, 0 }, @@ -122,7 +123,6 @@ { 'f', 0, 1, etFLOAT, 0, 0 }, { 'e', 0, 1, etEXP, 30, 0 }, { 'E', 0, 1, etEXP, 14, 0 }, - { 'g', 0, 1, etGENERIC, 30, 0 }, { 'G', 0, 1, etGENERIC, 14, 0 }, { 'i', 10, 1, etRADIX, 0, 0 }, { 'n', 0, 0, etSIZE, 0, 0 }, @@ -163,7 +163,15 @@ } #endif -#define etBUFSIZE 1000 /* Size of the output buffer */ +/* +** On machines with a small stack size, you can redefine the +** SQLITE_PRINT_BUF_SIZE to be less than 350. But beware - for +** smaller values some %f conversions may go into an infinite loop. +*/ +#ifndef SQLITE_PRINT_BUF_SIZE +# define SQLITE_PRINT_BUF_SIZE 350 +#endif +#define etBUFSIZE SQLITE_PRINT_BUF_SIZE /* Size of the output buffer */ /* ** The root program. All variations call this core. @@ -210,9 +218,11 @@ etByte flag_plussign; /* True if "+" flag is present */ etByte flag_blanksign; /* True if " " flag is present */ etByte flag_alternateform; /* True if "#" flag is present */ + etByte flag_altform2; /* True if "!" flag is present */ etByte flag_zeropad; /* True if field width constant starts with zero */ etByte flag_long; /* True if "l" flag is present */ etByte flag_longlong; /* True if the "ll" flag is present */ + etByte done; /* Loop termination flag */ UINT64_TYPE longvalue; /* Value for integer types */ LONGDOUBLE_TYPE realvalue; /* Value for real types */ const et_info *infop; /* Pointer to the appropriate info structure */ @@ -225,7 +235,7 @@ " "; #define etSPACESIZE (sizeof(spaces)-1) #ifndef etNOFLOATINGPOINT - int exp; /* exponent of real numbers */ + int exp, e2; /* exponent of real numbers */ double rounder; /* Used for rounding floating point values */ etByte flag_dp; /* True if decimal point should be shown */ etByte flag_rtz; /* True if trailing zeros should be removed */ @@ -254,17 +264,19 @@ } /* Find out what flags are present */ flag_leftjustify = flag_plussign = flag_blanksign = - flag_alternateform = flag_zeropad = 0; + flag_alternateform = flag_altform2 = flag_zeropad = 0; + done = 0; do{ switch( c ){ - case '-': flag_leftjustify = 1; c = 0; break; - case '+': flag_plussign = 1; c = 0; break; - case ' ': flag_blanksign = 1; c = 0; break; - case '#': flag_alternateform = 1; c = 0; break; - case '0': flag_zeropad = 1; c = 0; break; - default: break; + case '-': flag_leftjustify = 1; break; + case '+': flag_plussign = 1; break; + case ' ': flag_blanksign = 1; break; + case '#': flag_alternateform = 1; break; + case '!': flag_altform2 = 1; break; + case '0': flag_zeropad = 1; break; + default: done = 1; break; } - }while( c==0 && (c=(*++fmt))!=0 ); + }while( !done && (c=(*++fmt))!=0 ); /* Get the field width */ width = 0; if( c=='*' ){ @@ -336,6 +348,7 @@ ** At this point, variables are initialized as follows: ** ** flag_alternateform TRUE if a '#' is present. + ** flag_altform2 TRUE if a '!' is present. ** flag_plussign TRUE if a '+' is present. ** flag_leftjustify TRUE if a '-' is present or if the ** field width was negative. @@ -414,7 +427,7 @@ realvalue = va_arg(ap,double); #ifndef etNOFLOATINGPOINT if( precision<0 ) precision = 6; /* Set default precision */ - if( precision>etBUFSIZE-10 ) precision = etBUFSIZE-10; + if( precision>etBUFSIZE/2-10 ) precision = etBUFSIZE/2-10; if( realvalue<0.0 ){ realvalue = -realvalue; prefix = '-'; @@ -423,8 +436,7 @@ else if( flag_blanksign ) prefix = ' '; else prefix = 0; } - if( infop->type==etGENERIC && precision>0 ) precision--; - rounder = 0.0; + if( xtype==etGENERIC && precision>0 ) precision--; #if 0 /* Rounding works like BSD when the constant 0.4999 is used. Wierd! */ for(idx=precision, rounder=0.4999; idx>0; idx--, rounder*=0.1); @@ -432,10 +444,11 @@ /* It makes more sense to use 0.5 */ for(idx=precision, rounder=0.5; idx>0; idx--, rounder*=0.1); #endif - if( infop->type==etFLOAT ) realvalue += rounder; + if( xtype==etFLOAT ) realvalue += rounder; /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */ exp = 0; if( realvalue>0.0 ){ + while( realvalue>=1e32 && exp<=350 ){ realvalue *= 1e-32; exp+=32; } while( realvalue>=1e8 && exp<=350 ){ realvalue *= 1e-8; exp+=8; } while( realvalue>=10.0 && exp<=350 ){ realvalue *= 0.1; exp++; } while( realvalue<1e-8 && exp>=-350 ){ realvalue *= 1e8; exp-=8; } @@ -467,51 +480,67 @@ }else{ flag_rtz = 0; } - /* - ** The "exp+precision" test causes output to be of type etEXP if - ** the precision is too large to fit in buf[]. - */ + if( xtype==etEXP ){ + e2 = 0; + }else{ + e2 = exp; + } nsd = 0; - if( xtype==etFLOAT && exp+precision0 || flag_alternateform); - if( prefix ) *(bufpt++) = prefix; /* Sign */ - if( exp<0 ) *(bufpt++) = '0'; /* Digits before "." */ - else for(; exp>=0; exp--) *(bufpt++) = et_getdigit(&realvalue,&nsd); - if( flag_dp ) *(bufpt++) = '.'; /* The decimal point */ - for(exp++; exp<0 && precision>0; precision--, exp++){ - *(bufpt++) = '0'; + flag_dp = (precision>0) | flag_alternateform | flag_altform2; + /* The sign in front of the number */ + if( prefix ){ + *(bufpt++) = prefix; + } + /* Digits prior to the decimal point */ + if( e2<0 ){ + *(bufpt++) = '0'; + }else{ + for(; e2>=0; e2--){ + *(bufpt++) = et_getdigit(&realvalue,&nsd); } - while( (precision--)>0 ) *(bufpt++) = et_getdigit(&realvalue,&nsd); - *(bufpt--) = 0; /* Null terminate */ - if( flag_rtz && flag_dp ){ /* Remove trailing zeros and "." */ - while( bufpt>=buf && *bufpt=='0' ) *(bufpt--) = 0; - if( bufpt>=buf && *bufpt=='.' ) *(bufpt--) = 0; + } + /* The decimal point */ + if( flag_dp ){ + *(bufpt++) = '.'; + } + /* "0" digits after the decimal point but before the first + ** significant digit of the number */ + for(e2++; e2<0 && precision>0; precision--, e2++){ + *(bufpt++) = '0'; + } + /* Significant digits after the decimal point */ + while( (precision--)>0 ){ + *(bufpt++) = et_getdigit(&realvalue,&nsd); + } + /* Remove trailing zeros and the "." if no digits follow the "." */ + if( flag_rtz && flag_dp ){ + while( bufpt[-1]=='0' ) *(--bufpt) = 0; + assert( bufpt>buf ); + if( bufpt[-1]=='.' ){ + if( flag_altform2 ){ + *(bufpt++) = '0'; + }else{ + *(--bufpt) = 0; + } } - bufpt++; /* point to next free slot */ - }else{ /* etEXP or etGENERIC */ - flag_dp = (precision>0 || flag_alternateform); - if( prefix ) *(bufpt++) = prefix; /* Sign */ - *(bufpt++) = et_getdigit(&realvalue,&nsd); /* First digit */ - if( flag_dp ) *(bufpt++) = '.'; /* Decimal point */ - while( (precision--)>0 ) *(bufpt++) = et_getdigit(&realvalue,&nsd); - bufpt--; /* point to last digit */ - if( flag_rtz && flag_dp ){ /* Remove tail zeros */ - while( bufpt>=buf && *bufpt=='0' ) *(bufpt--) = 0; - if( bufpt>=buf && *bufpt=='.' ) *(bufpt--) = 0; + } + /* Add the "eNNN" suffix */ + if( flag_exp || (xtype==etEXP && exp) ){ + *(bufpt++) = aDigits[infop->charset]; + if( exp<0 ){ + *(bufpt++) = '-'; exp = -exp; + }else{ + *(bufpt++) = '+'; } - bufpt++; /* point to next free slot */ - if( exp || flag_exp ){ - *(bufpt++) = aDigits[infop->charset]; - if( exp<0 ){ *(bufpt++) = '-'; exp = -exp; } /* sign of exp */ - else { *(bufpt++) = '+'; } - if( exp>=100 ){ - *(bufpt++) = (exp/100)+'0'; /* 100's digit */ - exp %= 100; - } - *(bufpt++) = exp/10+'0'; /* 10's digit */ - *(bufpt++) = exp%10+'0'; /* 1's digit */ + if( exp>=100 ){ + *(bufpt++) = (exp/100)+'0'; /* 100's digit */ + exp %= 100; } + *(bufpt++) = exp/10+'0'; /* 10's digit */ + *(bufpt++) = exp%10+'0'; /* 1's digit */ } + *bufpt = 0; + /* The converted number is in buf[] and zero terminated. Output it. ** Note that the number is in the usual order, not reversed as with ** integer conversions. */ @@ -564,36 +593,35 @@ if( precision>=0 && precisionetBUFSIZE ){ - bufpt = zExtra = sqliteMalloc( n ); - if( bufpt==0 ) return -1; - }else{ - bufpt = buf; - } - j = 0; - if( needQuote ) bufpt[j++] = '\''; - for(i=0; (c=arg[i])!=0; i++){ - bufpt[j++] = c; - if( c=='\'' ) bufpt[j++] = c; - } - if( needQuote ) bufpt[j++] = '\''; - bufpt[j] = 0; - length = j; - if( precision>=0 && precisionetBUFSIZE ){ + bufpt = zExtra = sqliteMalloc( n ); + if( bufpt==0 ) return -1; + }else{ + bufpt = buf; + } + j = 0; + if( needQuote ) bufpt[j++] = '\''; + for(i=0; (c=arg[i])!=0; i++){ + bufpt[j++] = c; + if( c=='\'' ) bufpt[j++] = c; + } + if( needQuote ) bufpt[j++] = '\''; + bufpt[j] = 0; + length = j; + if( precision>=0 && precisionz ){ @@ -698,7 +726,11 @@ memcpy(pM->zText, pM->zBase, pM->nChar); } }else{ - pM->zText = pM->xRealloc(pM->zText, pM->nAlloc); + char *zNew; + zNew = pM->xRealloc(pM->zText, pM->nAlloc); + if( zNew ){ + pM->zText = zNew; + } } } } @@ -736,7 +768,10 @@ memcpy(sM.zText, sM.zBase, sM.nChar+1); } }else if( sM.nAlloc>sM.nChar+10 ){ - sM.zText = xRealloc(sM.zText, sM.nChar+1); + char *zNew = xRealloc(sM.zText, sM.nChar+1); + if( zNew ){ + sM.zText = zNew; + } } } return sM.zText; @@ -754,7 +789,7 @@ ** %-conversion extensions. */ char *sqlite3VMPrintf(const char *zFormat, va_list ap){ - char zBase[1000]; + char zBase[SQLITE_PRINT_BUF_SIZE]; return base_vprintf(printf_realloc, 1, zBase, sizeof(zBase), zFormat, ap); } @@ -765,7 +800,7 @@ char *sqlite3MPrintf(const char *zFormat, ...){ va_list ap; char *z; - char zBase[1000]; + char zBase[SQLITE_PRINT_BUF_SIZE]; va_start(ap, zFormat); z = base_vprintf(printf_realloc, 1, zBase, sizeof(zBase), zFormat, ap); va_end(ap); ======================================================================== --- sqlite/select.c 28b752e58955c7920711fbdbfdcd369a2bd09448 +++ sqlite/select.c 9ef1dddd436e1ea86a6bf64ae0ed71bf4a0b894f @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.252 2005/06/12 21:35:52 drh Exp $ +** $Id: select.c,v 1.269 2005/09/12 23:03:17 drh Exp $ */ #include "sqliteInt.h" @@ -60,6 +60,9 @@ pNew->pOffset = pOffset; pNew->iLimit = -1; pNew->iOffset = -1; + pNew->addrOpenVirt[0] = -1; + pNew->addrOpenVirt[1] = -1; + pNew->addrOpenVirt[2] = -1; } return pNew; } @@ -70,6 +73,7 @@ ** in terms of the following bit values: ** ** JT_INNER +** JT_CROSS ** JT_OUTER ** JT_NATURAL ** JT_LEFT @@ -85,7 +89,7 @@ Token *apAll[3]; Token *p; static const struct { - const char *zKeyword; + const char zKeyword[8]; u8 nChar; u8 code; } keywords[] = { @@ -95,7 +99,7 @@ { "full", 4, JT_LEFT|JT_RIGHT|JT_OUTER }, { "outer", 5, JT_OUTER }, { "inner", 5, JT_INNER }, - { "cross", 5, JT_INNER }, + { "cross", 5, JT_INNER|JT_CROSS }, }; int i, j; apAll[0] = pA; @@ -155,7 +159,16 @@ p->dyn = 0; } +/* +** Create an expression node for an identifier with the name of zName +*/ +static Expr *createIdExpr(const char *zName){ + Token dummy; + setToken(&dummy, zName); + return sqlite3Expr(TK_ID, 0, 0, &dummy); +} + /* ** Add a term to the WHERE expression in *ppExpr that requires the ** zCol column to be equal in the two tables pTab1 and pTab2. @@ -168,24 +181,20 @@ const char *zAlias2, /* Alias for second table. May be NULL */ Expr **ppExpr /* Add the equality term to this expression */ ){ - Token dummy; Expr *pE1a, *pE1b, *pE1c; Expr *pE2a, *pE2b, *pE2c; Expr *pE; - setToken(&dummy, zCol); - pE1a = sqlite3Expr(TK_ID, 0, 0, &dummy); - pE2a = sqlite3Expr(TK_ID, 0, 0, &dummy); + pE1a = createIdExpr(zCol); + pE2a = createIdExpr(zCol); if( zAlias1==0 ){ zAlias1 = pTab1->zName; } - setToken(&dummy, zAlias1); - pE1b = sqlite3Expr(TK_ID, 0, 0, &dummy); + pE1b = createIdExpr(zAlias1); if( zAlias2==0 ){ zAlias2 = pTab2->zName; } - setToken(&dummy, zAlias2); - pE2b = sqlite3Expr(TK_ID, 0, 0, &dummy); + pE2b = createIdExpr(zAlias2); pE1c = sqlite3Expr(TK_DOT, pE1b, pE1a, 0); pE2c = sqlite3Expr(TK_DOT, pE2b, pE2a, 0); pE = sqlite3Expr(TK_EQ, pE1c, pE2c, 0); @@ -321,12 +330,11 @@ ** stack into the sorter. */ static void pushOntoSorter(Parse *pParse, Vdbe *v, ExprList *pOrderBy){ - int i; - for(i=0; inExpr; i++){ - sqlite3ExprCode(pParse, pOrderBy->a[i].pExpr); - } - sqlite3VdbeAddOp(v, OP_MakeRecord, pOrderBy->nExpr, 0); - sqlite3VdbeAddOp(v, OP_SortInsert, 0, 0); + sqlite3ExprCodeExprList(pParse, pOrderBy); + sqlite3VdbeAddOp(v, OP_Sequence, pOrderBy->iECursor, 0); + sqlite3VdbeAddOp(v, OP_Pull, pOrderBy->nExpr + 1, 0); + sqlite3VdbeAddOp(v, OP_MakeRecord, pOrderBy->nExpr + 2, 0); + sqlite3VdbeAddOp(v, OP_IdxInsert, pOrderBy->iECursor, 0); } /* @@ -339,7 +347,7 @@ int iBreak, /* Jump here to end the loop */ int nPop /* Number of times to pop stack when jumping */ ){ - if( p->iOffset>=0 ){ + if( p->iOffset>=0 && iContinue!=0 ){ int addr = sqlite3VdbeCurrentAddr(v) + 3; if( nPop>0 ) addr++; sqlite3VdbeAddOp(v, OP_MemIncr, p->iOffset, 0); @@ -350,13 +358,41 @@ sqlite3VdbeAddOp(v, OP_Goto, 0, iContinue); VdbeComment((v, "# skip OFFSET records")); } - if( p->iLimit>=0 ){ + if( p->iLimit>=0 && iBreak!=0 ){ sqlite3VdbeAddOp(v, OP_MemIncr, p->iLimit, iBreak); VdbeComment((v, "# exit when LIMIT reached")); } } /* +** Add code that will check to make sure the top N elements of the +** stack are distinct. iTab is a sorting index that holds previously +** seen combinations of the N values. A new entry is made in iTab +** if the current N values are new. +** +** A jump to addrRepeat is made and the K values are popped from the +** stack if the top N elements are not distinct. +*/ +static void codeDistinct( + Vdbe *v, /* Generate code into this VM */ + int iTab, /* A sorting index used to test for distinctness */ + int addrRepeat, /* Jump to here if not distinct */ + int N, /* The top N elements of the stack must be distinct */ + int K /* Pop K elements from the stack if indistinct */ +){ +#if NULL_ALWAYS_DISTINCT + sqlite3VdbeAddOp(v, OP_IsNull, -N, sqlite3VdbeCurrentAddr(v)+6); +#endif + sqlite3VdbeAddOp(v, OP_MakeRecord, -N, 0); + sqlite3VdbeAddOp(v, OP_Distinct, iTab, sqlite3VdbeCurrentAddr(v)+3); + sqlite3VdbeAddOp(v, OP_Pop, K, 0); + sqlite3VdbeAddOp(v, OP_Goto, 0, addrRepeat); + VdbeComment((v, "# skip indistinct records")); + sqlite3VdbeAddOp(v, OP_IdxInsert, iTab, 0); +} + + +/* ** This routine generates the code for the inside of the inner loop ** of a SELECT. ** @@ -402,9 +438,7 @@ } }else{ nColumn = pEList->nExpr; - for(i=0; inExpr; i++){ - sqlite3ExprCode(pParse, pEList->a[i].pExpr); - } + sqlite3ExprCodeExprList(pParse, pEList); } /* If the DISTINCT keyword was present on the SELECT statement @@ -412,30 +446,23 @@ ** part of the result. */ if( hasDistinct ){ -#if NULL_ALWAYS_DISTINCT - sqlite3VdbeAddOp(v, OP_IsNull, -pEList->nExpr, sqlite3VdbeCurrentAddr(v)+7); -#endif - /* Deliberately leave the affinity string off of the following - ** OP_MakeRecord */ - sqlite3VdbeAddOp(v, OP_MakeRecord, pEList->nExpr * -1, 0); - sqlite3VdbeAddOp(v, OP_Distinct, distinct, sqlite3VdbeCurrentAddr(v)+3); - sqlite3VdbeAddOp(v, OP_Pop, pEList->nExpr+1, 0); - sqlite3VdbeAddOp(v, OP_Goto, 0, iContinue); - VdbeComment((v, "# skip indistinct records")); - sqlite3VdbeAddOp(v, OP_IdxInsert, distinct, 0); + int n = pEList->nExpr; + codeDistinct(v, distinct, iContinue, n, n+1); if( pOrderBy==0 ){ codeLimiter(v, p, iContinue, iBreak, nColumn); } } switch( eDest ){ -#ifndef SQLITE_OMIT_COMPOUND_SELECT /* In this mode, write each query result to the key of the temporary ** table iParm. */ +#ifndef SQLITE_OMIT_COMPOUND_SELECT case SRT_Union: { sqlite3VdbeAddOp(v, OP_MakeRecord, nColumn, NULL_ALWAYS_DISTINCT); - sqlite3VdbeChangeP3(v, -1, aff, P3_STATIC); + if( aff ){ + sqlite3VdbeChangeP3(v, -1, aff, P3_STATIC); + } sqlite3VdbeAddOp(v, OP_IdxInsert, iParm, 0); break; } @@ -457,7 +484,7 @@ /* Store the result as data using a unique key. */ case SRT_Table: - case SRT_TempTable: { + case SRT_VirtualTab: { sqlite3VdbeAddOp(v, OP_MakeRecord, nColumn, 0); if( pOrderBy ){ pushOntoSorter(pParse, v, pOrderBy); @@ -483,6 +510,10 @@ sqlite3VdbeAddOp(v, OP_Pop, 1, 0); addr2 = sqlite3VdbeAddOp(v, OP_Goto, 0, 0); if( pOrderBy ){ + /* At first glance you would think we could optimize out the + ** ORDER BY in this case since the order of entries in the set + ** does not matter. But there might be a LIMIT clause, in which + ** case the order does matter */ pushOntoSorter(pParse, v, pOrderBy); }else{ char aff = (iParm>>16)&0xFF; @@ -511,33 +542,23 @@ } #endif /* #ifndef SQLITE_OMIT_SUBQUERY */ - /* Send the data to the callback function. + /* Send the data to the callback function or to a subroutine. In the + ** case of a subroutine, the subroutine itself is responsible for + ** popping the data from the stack. */ - case SRT_Callback: - case SRT_Sorter: { + case SRT_Subroutine: + case SRT_Callback: { if( pOrderBy ){ sqlite3VdbeAddOp(v, OP_MakeRecord, nColumn, 0); pushOntoSorter(pParse, v, pOrderBy); + }else if( eDest==SRT_Subroutine ){ + sqlite3VdbeAddOp(v, OP_Gosub, 0, iParm); }else{ - assert( eDest==SRT_Callback ); sqlite3VdbeAddOp(v, OP_Callback, nColumn, 0); } break; } - /* Invoke a subroutine to handle the results. The subroutine itself - ** is responsible for popping the results off of the stack. - */ - case SRT_Subroutine: { - if( pOrderBy ){ - sqlite3VdbeAddOp(v, OP_MakeRecord, nColumn, 0); - pushOntoSorter(pParse, v, pOrderBy); - }else{ - sqlite3VdbeAddOp(v, OP_Gosub, 0, iParm); - } - break; - } - #if !defined(SQLITE_OMIT_TRIGGER) /* Discard the results. This is used for SELECT statements inside ** the body of a TRIGGER. The purpose of such selects is to call @@ -555,6 +576,48 @@ } /* +** Given an expression list, generate a KeyInfo structure that records +** the collating sequence for each expression in that expression list. +** +** If the ExprList is an ORDER BY or GROUP BY clause then the resulting +** KeyInfo structure is appropriate for initializing a virtual index to +** implement that clause. If the ExprList is the result set of a SELECT +** then the KeyInfo structure is appropriate for initializing a virtual +** index to implement a DISTINCT test. +** +** Space to hold the KeyInfo structure is obtain from malloc. The calling +** function is responsible for seeing that this structure is eventually +** freed. Add the KeyInfo structure to the P3 field of an opcode using +** P3_KEYINFO_HANDOFF is the usual way of dealing with this. +*/ +static KeyInfo *keyInfoFromExprList(Parse *pParse, ExprList *pList){ + sqlite3 *db = pParse->db; + int nExpr; + KeyInfo *pInfo; + struct ExprList_item *pItem; + int i; + + nExpr = pList->nExpr; + pInfo = sqliteMalloc( sizeof(*pInfo) + nExpr*(sizeof(CollSeq*)+1) ); + if( pInfo ){ + pInfo->aSortOrder = (char*)&pInfo->aColl[nExpr]; + pInfo->nField = nExpr; + pInfo->enc = db->enc; + for(i=0, pItem=pList->a; ipExpr); + if( !pColl ){ + pColl = db->pDfltColl; + } + pInfo->aColl[i] = pColl; + pInfo->aSortOrder[i] = pItem->sortOrder; + } + } + return pInfo; +} + + +/* ** If the inner loop was generated using a non-null pOrderBy argument, ** then the results were placed in a sorter. After the loop is terminated ** we need to run the sorter and output the results. The following @@ -568,38 +631,19 @@ int eDest, /* Write the sorted results here */ int iParm /* Optional parameter associated with eDest */ ){ - int end1 = sqlite3VdbeMakeLabel(v); - int end2 = sqlite3VdbeMakeLabel(v); + int brk = sqlite3VdbeMakeLabel(v); + int cont = sqlite3VdbeMakeLabel(v); int addr; - KeyInfo *pInfo; - ExprList *pOrderBy; - int nCol, i; - sqlite3 *db = pParse->db; + int iTab; + ExprList *pOrderBy = p->pOrderBy; - if( eDest==SRT_Sorter ) return; - pOrderBy = p->pOrderBy; - nCol = pOrderBy->nExpr; - pInfo = sqliteMalloc( sizeof(*pInfo) + nCol*(sizeof(CollSeq*)+1) ); - if( pInfo==0 ) return; - pInfo->aSortOrder = (char*)&pInfo->aColl[nCol]; - pInfo->nField = nCol; - for(i=0; ia[i].zName. Otherwise, use the default - ** collation type for the expression. - */ - pInfo->aColl[i] = sqlite3ExprCollSeq(pParse, pOrderBy->a[i].pExpr); - if( !pInfo->aColl[i] ){ - pInfo->aColl[i] = db->pDfltColl; - } - pInfo->aSortOrder[i] = pOrderBy->a[i].sortOrder; - } - sqlite3VdbeOp3(v, OP_Sort, 0, 0, (char*)pInfo, P3_KEYINFO_HANDOFF); - addr = sqlite3VdbeAddOp(v, OP_SortNext, 0, end1); - codeLimiter(v, p, addr, end2, 1); + iTab = pOrderBy->iECursor; + addr = 1 + sqlite3VdbeAddOp(v, OP_Sort, iTab, brk); + codeLimiter(v, p, cont, brk, 0); + sqlite3VdbeAddOp(v, OP_Column, iTab, pOrderBy->nExpr + 1); switch( eDest ){ case SRT_Table: - case SRT_TempTable: { + case SRT_VirtualTab: { sqlite3VdbeAddOp(v, OP_NewRowid, iParm, 0); sqlite3VdbeAddOp(v, OP_Pull, 1, 0); sqlite3VdbeAddOp(v, OP_Insert, iParm, 0); @@ -619,7 +663,7 @@ case SRT_Mem: { assert( nColumn==1 ); sqlite3VdbeAddOp(v, OP_MemStore, iParm, 1); - sqlite3VdbeAddOp(v, OP_Goto, 0, end1); + sqlite3VdbeAddOp(v, OP_Goto, 0, brk); break; } #endif @@ -644,11 +688,9 @@ break; } } - sqlite3VdbeAddOp(v, OP_Goto, 0, addr); - sqlite3VdbeResolveLabel(v, end2); - sqlite3VdbeAddOp(v, OP_Pop, 1, 0); - sqlite3VdbeResolveLabel(v, end1); - sqlite3VdbeAddOp(v, OP_SortReset, 0, 0); + sqlite3VdbeResolveLabel(v, cont); + sqlite3VdbeAddOp(v, OP_Next, iTab, addr); + sqlite3VdbeResolveLabel(v, brk); } /* @@ -1312,59 +1354,33 @@ } /* -** Generate VDBE instructions that will open a transient table that -** will be used for an index or to store keyed results for a compound -** select. In other words, open a transient table that needs a -** KeyInfo structure. The number of columns in the KeyInfo is determined -** by the result set of the SELECT statement in the second argument. -** -** Specifically, this routine is called to open an index table for -** DISTINCT, UNION, INTERSECT and EXCEPT select statements (but not -** UNION ALL). -** -** The value returned is the address of the OP_OpenTemp instruction. +** Allocate a virtual index to use for sorting. */ -static int openTempIndex(Parse *pParse, Select *p, int iTab){ - KeyInfo *pKeyInfo; - int nColumn; - sqlite3 *db = pParse->db; - int i; - Vdbe *v = pParse->pVdbe; - int addr; - - if( prepSelectStmt(pParse, p) ){ - return 0; +static void createSortingIndex(Parse *pParse, Select *p, ExprList *pOrderBy){ + if( pOrderBy ){ + int addr; + assert( pOrderBy->iECursor==0 ); + pOrderBy->iECursor = pParse->nTab++; + addr = sqlite3VdbeAddOp(pParse->pVdbe, OP_OpenVirtual, + pOrderBy->iECursor, pOrderBy->nExpr+1); + assert( p->addrOpenVirt[2] == -1 ); + p->addrOpenVirt[2] = addr; } - nColumn = p->pEList->nExpr; - pKeyInfo = sqliteMalloc( sizeof(*pKeyInfo)+nColumn*sizeof(CollSeq*) ); - if( pKeyInfo==0 ) return 0; - pKeyInfo->enc = db->enc; - pKeyInfo->nField = nColumn; - for(i=0; iaColl[i] = sqlite3ExprCollSeq(pParse, p->pEList->a[i].pExpr); - if( !pKeyInfo->aColl[i] ){ - pKeyInfo->aColl[i] = db->pDfltColl; - } - } - addr = sqlite3VdbeOp3(v, OP_OpenTemp, iTab, 0, - (char*)pKeyInfo, P3_KEYINFO_HANDOFF); - return addr; } -#ifndef SQLITE_OMIT_COMPOUND_SELECT /* -** Add the address "addr" to the set of all OpenTemp opcode addresses -** that are being accumulated in p->ppOpenTemp. +** The opcode at addr is an OP_OpenVirtual that created a sorting +** index tha we ended up not needing. This routine changes that +** opcode to OP_Noop. */ -static int multiSelectOpenTempAddr(Select *p, int addr){ - IdList *pList = *p->ppOpenTemp = sqlite3IdListAppend(*p->ppOpenTemp, 0); - if( pList==0 ){ - return SQLITE_NOMEM; - } - pList->a[pList->nId-1].idx = addr; - return SQLITE_OK; +static void uncreateSortingIndex(Parse *pParse, int addr){ + Vdbe *v = pParse->pVdbe; + VdbeOp *pOp = sqlite3VdbeGetOp(v, addr); + sqlite3VdbeChangeP3(v, addr, 0, 0); + pOp->opcode = OP_Noop; + pOp->p1 = 0; + pOp->p2 = 0; } -#endif /* SQLITE_OMIT_COMPOUND_SELECT */ #ifndef SQLITE_OMIT_COMPOUND_SELECT /* @@ -1430,10 +1446,10 @@ int rc = SQLITE_OK; /* Success code from a subroutine */ Select *pPrior; /* Another SELECT immediately to our left */ Vdbe *v; /* Generate code to this VDBE */ - IdList *pOpenTemp = 0;/* OP_OpenTemp opcodes that need a KeyInfo */ - int aAddr[5]; /* Addresses of SetNumColumns operators */ - int nAddr = 0; /* Number used */ int nCol; /* Number of columns in the result set */ + ExprList *pOrderBy; /* The ORDER BY clause on p */ + int aSetP2[2]; /* Set P2 value of these op to number of columns */ + int nSetP2 = 0; /* Number of slots in aSetP2[] used */ /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs. Only ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT. @@ -1443,6 +1459,8 @@ goto multi_select_end; } pPrior = p->pPrior; + assert( pPrior->pRightmost!=pPrior ); + assert( pPrior->pRightmost==p->pRightmost ); if( pPrior->pOrderBy ){ sqlite3ErrorMsg(pParse,"ORDER BY clause should come after %s not before", selectOpName(p->op)); @@ -1464,32 +1482,21 @@ goto multi_select_end; } - /* If *p this is the right-most select statement, then initialize - ** p->ppOpenTemp to point to pOpenTemp. If *p is not the right most - ** statement then p->ppOpenTemp will have already been initialized - ** by a prior call to this same procedure. Pass along the pOpenTemp - ** pointer to pPrior, the next statement to our left. - */ - if( p->ppOpenTemp==0 ){ - p->ppOpenTemp = &pOpenTemp; - } - pPrior->ppOpenTemp = p->ppOpenTemp; - /* Create the destination temporary table if necessary */ - if( eDest==SRT_TempTable ){ + if( eDest==SRT_VirtualTab ){ assert( p->pEList ); - sqlite3VdbeAddOp(v, OP_OpenTemp, iParm, 0); - assert( nAddr==0 ); - aAddr[nAddr++] = sqlite3VdbeAddOp(v, OP_SetNumColumns, iParm, 0); + assert( nSetP2pOrderBy; switch( p->op ){ case TK_ALL: { - if( p->pOrderBy==0 ){ + if( pOrderBy==0 ){ assert( !pPrior->pLimit ); pPrior->pLimit = p->pLimit; pPrior->pOffset = p->pOffset; @@ -1517,11 +1524,10 @@ int op = 0; /* One of the SRT_ operations to apply to self */ int priorOp; /* The SRT_ operation to apply to prior selects */ Expr *pLimit, *pOffset; /* Saved values of p->nLimit and p->nOffset */ - ExprList *pOrderBy; /* The ORDER BY clause for the right SELECT */ int addr; priorOp = p->op==TK_ALL ? SRT_Table : SRT_Union; - if( eDest==priorOp && p->pOrderBy==0 && !p->pLimit && !p->pOffset ){ + if( eDest==priorOp && pOrderBy==0 && !p->pLimit && !p->pOffset ){ /* We can reuse a temporary table generated by a SELECT to our ** right. */ @@ -1531,20 +1537,20 @@ ** intermediate results. */ unionTab = pParse->nTab++; - if( p->pOrderBy - && matchOrderbyToColumn(pParse, p, p->pOrderBy, unionTab, 1) ){ + if( pOrderBy && matchOrderbyToColumn(pParse, p, pOrderBy, unionTab,1) ){ rc = 1; goto multi_select_end; } - addr = sqlite3VdbeAddOp(v, OP_OpenTemp, unionTab, 0); - if( p->op!=TK_ALL ){ - rc = multiSelectOpenTempAddr(p, addr); - if( rc!=SQLITE_OK ){ - goto multi_select_end; - } + addr = sqlite3VdbeAddOp(v, OP_OpenVirtual, unionTab, 0); + if( priorOp==SRT_Table ){ + assert( nSetP2addrOpenVirt[0] == -1 ); + p->addrOpenVirt[0] = addr; + p->pRightmost->usesVirt = 1; } - assert( nAddrpEList ); } @@ -1564,7 +1570,6 @@ case TK_ALL: op = SRT_Table; break; } p->pPrior = 0; - pOrderBy = p->pOrderBy; p->pOrderBy = 0; pLimit = p->pLimit; p->pLimit = 0; @@ -1598,7 +1603,7 @@ computeLimitRegisters(pParse, p); iStart = sqlite3VdbeCurrentAddr(v); rc = selectInnerLoop(pParse, p, p->pEList, unionTab, p->pEList->nExpr, - p->pOrderBy, -1, eDest, iParm, + pOrderBy, -1, eDest, iParm, iCont, iBreak, 0); if( rc ){ rc = 1; @@ -1623,18 +1628,16 @@ */ tab1 = pParse->nTab++; tab2 = pParse->nTab++; - if( p->pOrderBy && matchOrderbyToColumn(pParse,p,p->pOrderBy,tab1,1) ){ + if( pOrderBy && matchOrderbyToColumn(pParse,p,pOrderBy,tab1,1) ){ rc = 1; goto multi_select_end; } + createSortingIndex(pParse, p, pOrderBy); - addr = sqlite3VdbeAddOp(v, OP_OpenTemp, tab1, 0); - rc = multiSelectOpenTempAddr(p, addr); - if( rc!=SQLITE_OK ){ - goto multi_select_end; - } - assert( nAddraddrOpenVirt[0] == -1 ); + p->addrOpenVirt[0] = addr; + p->pRightmost->usesVirt = 1; assert( p->pEList ); /* Code the SELECTs to our left into temporary table "tab1". @@ -1646,13 +1649,9 @@ /* Code the current SELECT into temporary table "tab2" */ - addr = sqlite3VdbeAddOp(v, OP_OpenTemp, tab2, 0); - rc = multiSelectOpenTempAddr(p, addr); - if( rc!=SQLITE_OK ){ - goto multi_select_end; - } - assert( nAddraddrOpenVirt[1] == -1 ); + p->addrOpenVirt[1] = addr; p->pPrior = 0; pLimit = p->pLimit; p->pLimit = 0; @@ -1681,7 +1680,7 @@ iStart = sqlite3VdbeAddOp(v, OP_RowKey, tab1, 0); sqlite3VdbeAddOp(v, OP_NotFound, tab2, iCont); rc = selectInnerLoop(pParse, p, p->pEList, tab1, p->pEList->nExpr, - p->pOrderBy, -1, eDest, iParm, + pOrderBy, -1, eDest, iParm, iCont, iBreak, 0); if( rc ){ rc = 1; @@ -1710,9 +1709,8 @@ /* Set the number of columns in temporary tables */ nCol = p->pEList->nExpr; - while( nAddr>0 ){ - nAddr--; - sqlite3VdbeChangeP2(v, aAddr[nAddr], nCol); + while( nSetP2 ){ + sqlite3VdbeChangeP2(v, aSetP2[--nSetP2], nCol); } /* Compute collating sequences used by either the ORDER BY clause or @@ -1725,12 +1723,15 @@ ** SELECT might also skip this part if it has no ORDER BY clause and ** no temp tables are required. */ - if( p->pOrderBy || (pOpenTemp && pOpenTemp->nId>0) ){ + if( pOrderBy || p->usesVirt ){ int i; /* Loop counter */ KeyInfo *pKeyInfo; /* Collating sequence for the result set */ + Select *pLoop; /* For looping through SELECT statements */ + CollSeq **apColl; + CollSeq **aCopy; - assert( p->ppOpenTemp == &pOpenTemp ); - pKeyInfo = sqliteMalloc(sizeof(*pKeyInfo)+nCol*sizeof(CollSeq*)); + assert( p->pRightmost==p ); + pKeyInfo = sqliteMalloc(sizeof(*pKeyInfo)+nCol*2*sizeof(CollSeq*) + nCol); if( !pKeyInfo ){ rc = SQLITE_NOMEM; goto multi_select_end; @@ -1739,46 +1740,61 @@ pKeyInfo->enc = pParse->db->enc; pKeyInfo->nField = nCol; - for(i=0; iaColl[i] = multiSelectCollSeq(pParse, p, i); - if( !pKeyInfo->aColl[i] ){ - pKeyInfo->aColl[i] = pParse->db->pDfltColl; + for(i=0, apColl=pKeyInfo->aColl; idb->pDfltColl; } } - for(i=0; pOpenTemp && inId; i++){ - int p3type = (i==0?P3_KEYINFO_HANDOFF:P3_KEYINFO); - int addr = pOpenTemp->a[i].idx; - sqlite3VdbeChangeP3(v, addr, (char *)pKeyInfo, p3type); + for(pLoop=p; pLoop; pLoop=pLoop->pPrior){ + for(i=0; i<2; i++){ + int addr = pLoop->addrOpenVirt[i]; + if( addr<0 ){ + /* If [0] is unused then [1] is also unused. So we can + ** always safely abort as soon as the first unused slot is found */ + assert( pLoop->addrOpenVirt[1]<0 ); + break; + } + sqlite3VdbeChangeP2(v, addr, nCol); + sqlite3VdbeChangeP3(v, addr, (char*)pKeyInfo, P3_KEYINFO); + } } - if( p->pOrderBy ){ - struct ExprList_item *pOrderByTerm = p->pOrderBy->a; - for(i=0; ipOrderBy->nExpr; i++, pOrderByTerm++){ - Expr *pExpr = pOrderByTerm->pExpr; - char *zName = pOrderByTerm->zName; + if( pOrderBy ){ + struct ExprList_item *pOTerm = pOrderBy->a; + int nExpr = pOrderBy->nExpr; + int addr; + u8 *pSortOrder; + + aCopy = (CollSeq**)&pKeyInfo[1]; + pSortOrder = pKeyInfo->aSortOrder = (u8*)&aCopy[nExpr]; + memcpy(aCopy, pKeyInfo->aColl, nCol*sizeof(CollSeq*)); + apColl = pKeyInfo->aColl; + for(i=0; inExpr; i++, pOTerm++, apColl++, pSortOrder++){ + Expr *pExpr = pOTerm->pExpr; + char *zName = pOTerm->zName; assert( pExpr->op==TK_COLUMN && pExpr->iColumnpColl ); */ if( zName ){ - pExpr->pColl = sqlite3LocateCollSeq(pParse, zName, -1); + *apColl = sqlite3LocateCollSeq(pParse, zName, -1); }else{ - pExpr->pColl = pKeyInfo->aColl[pExpr->iColumn]; + *apColl = aCopy[pExpr->iColumn]; } + *pSortOrder = pOTerm->sortOrder; } + assert( p->pRightmost==p ); + assert( p->addrOpenVirt[2]>=0 ); + addr = p->addrOpenVirt[2]; + sqlite3VdbeChangeP2(v, addr, p->pEList->nExpr+2); + sqlite3VdbeChangeP3(v, addr, (char*)pKeyInfo, P3_KEYINFO_HANDOFF); + pKeyInfo = 0; generateSortTail(pParse, p, v, p->pEList->nExpr, eDest, iParm); } - if( !pOpenTemp ){ - /* This happens for UNION ALL ... ORDER BY */ - sqliteFree(pKeyInfo); - } + sqliteFree(pKeyInfo); } multi_select_end: - if( pOpenTemp ){ - sqlite3IdListDelete(pOpenTemp); - } - p->ppOpenTemp = 0; return rc; } #endif /* SQLITE_OMIT_COMPOUND_SELECT */ @@ -2182,9 +2198,8 @@ /* If the output is destined for a temporary table, open that table. */ - if( eDest==SRT_TempTable ){ - sqlite3VdbeAddOp(v, OP_OpenTemp, iParm, 0); - sqlite3VdbeAddOp(v, OP_SetNumColumns, iParm, 1); + if( eDest==SRT_VirtualTab ){ + sqlite3VdbeAddOp(v, OP_OpenVirtual, iParm, 1); } /* Generating code to find the min or the max. Basically all we have @@ -2293,6 +2308,7 @@ ExprList *pEList; /* Result set. */ int i; /* For-loop variable used in multiple places */ NameContext sNC; /* Local name-context */ + ExprList *pGroupBy; /* The group by clause */ /* If this routine has run before, return immediately. */ if( p->isResolved ){ @@ -2336,18 +2352,6 @@ sNC.pSrcList = p->pSrc; sNC.pNext = pOuterNC; - /* NameContext.nDepth stores the depth of recursion for this query. For - ** an outer query (e.g. SELECT * FROM sqlite_master) this is 1. For - ** a subquery it is 2. For a subquery of a subquery, 3. And so on. - ** Parse.nMaxDepth is the maximum depth for any subquery resolved so - ** far. This is used to determine the number of aggregate contexts - ** required at runtime. - */ - sNC.nDepth = (pOuterNC?pOuterNC->nDepth+1:1); - if( sNC.nDepth>pParse->nMaxDepth ){ - pParse->nMaxDepth = sNC.nDepth; - } - /* Resolve names in the result set. */ pEList = p->pEList; if( !pEList ) return SQLITE_ERROR; @@ -2362,7 +2366,8 @@ ** expression, do not allow aggregates in any of the other expressions. */ assert( !p->isAgg ); - if( p->pGroupBy || sNC.hasAgg ){ + pGroupBy = p->pGroupBy; + if( pGroupBy || sNC.hasAgg ){ p->isAgg = 1; }else{ sNC.allowAgg = 0; @@ -2370,7 +2375,7 @@ /* If a HAVING clause is present, then there must be a GROUP BY clause. */ - if( p->pHaving && !p->pGroupBy ){ + if( p->pHaving && !pGroupBy ){ sqlite3ErrorMsg(pParse, "a GROUP BY clause is required before HAVING"); return SQLITE_ERROR; } @@ -2387,49 +2392,131 @@ if( sqlite3ExprResolveNames(&sNC, p->pWhere) || sqlite3ExprResolveNames(&sNC, p->pHaving) || processOrderGroupBy(&sNC, p->pOrderBy, "ORDER") || - processOrderGroupBy(&sNC, p->pGroupBy, "GROUP") + processOrderGroupBy(&sNC, pGroupBy, "GROUP") ){ return SQLITE_ERROR; } + /* Make sure the GROUP BY clause does not contain aggregate functions. + */ + if( pGroupBy ){ + struct ExprList_item *pItem; + + for(i=0, pItem=pGroupBy->a; inExpr; i++, pItem++){ + if( ExprHasProperty(pItem->pExpr, EP_Agg) ){ + sqlite3ErrorMsg(pParse, "aggregate functions are not allowed in " + "the GROUP BY clause"); + return SQLITE_ERROR; + } + } + } + return SQLITE_OK; } /* -** An instance of the following struct is used by sqlite3Select() -** to save aggregate related information from the Parse object -** at the start of each call and to restore it at the end. See -** saveAggregateInfo() and restoreAggregateInfo(). -*/ -struct AggregateInfo { - int nAgg; - AggExpr *aAgg; -}; -typedef struct AggregateInfo AggregateInfo; +** Reset the aggregate accumulator. +** +** The aggregate accumulator is a set of memory cells that hold +** intermediate results while calculating an aggregate. This +** routine simply stores NULLs in all of those memory cells. +*/ +static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){ + Vdbe *v = pParse->pVdbe; + int i; + int addr; + struct AggInfo_func *pFunc; + if( pAggInfo->nFunc+pAggInfo->nColumn==0 ){ + return; + } + sqlite3VdbeAddOp(v, OP_Null, 0, 0); + for(i=0; inColumn; i++){ + addr = sqlite3VdbeAddOp(v, OP_MemStore, pAggInfo->aCol[i].iMem, 0); + } + for(pFunc=pAggInfo->aFunc, i=0; inFunc; i++, pFunc++){ + addr = sqlite3VdbeAddOp(v, OP_MemStore, pFunc->iMem, 0); + if( pFunc->iDistinct>=0 ){ + Expr *pE = pFunc->pExpr; + if( pE->pList==0 || pE->pList->nExpr!=1 ){ + sqlite3ErrorMsg(pParse, "DISTINCT in aggregate must be followed " + "by an expression"); + pFunc->iDistinct = -1; + }else{ + KeyInfo *pKeyInfo = keyInfoFromExprList(pParse, pE->pList); + sqlite3VdbeOp3(v, OP_OpenVirtual, pFunc->iDistinct, 0, + (char*)pKeyInfo, P3_KEYINFO_HANDOFF); + } + } + } + sqlite3VdbeChangeP2(v, addr, 1); +} -/* -** Copy aggregate related information from the Parse structure -** into the AggregateInfo structure. Zero the aggregate related -** values in the Parse struct. +/* +** Invoke the OP_AggFinalize opcode for every aggregate function +** in the AggInfo structure. */ -static void saveAggregateInfo(Parse *pParse, AggregateInfo *pInfo){ - pInfo->aAgg = pParse->aAgg; - pInfo->nAgg = pParse->nAgg; - pParse->aAgg = 0; - pParse->nAgg = 0; +static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){ + Vdbe *v = pParse->pVdbe; + int i; + struct AggInfo_func *pF; + for(i=0, pF=pAggInfo->aFunc; inFunc; i++, pF++){ + ExprList *pList = pF->pExpr->pList; + sqlite3VdbeOp3(v, OP_AggFinal, pF->iMem, pList ? pList->nExpr : 0, + (void*)pF->pFunc, P3_FUNCDEF); + } } /* -** Copy aggregate related information from the AggregateInfo struct -** back into the Parse structure. The aggregate related information -** currently stored in the Parse structure is deleted. +** Update the accumulator memory cells for an aggregate based on +** the current cursor position. */ -static void restoreAggregateInfo(Parse *pParse, AggregateInfo *pInfo){ - sqliteFree(pParse->aAgg); - pParse->aAgg = pInfo->aAgg; - pParse->nAgg = pInfo->nAgg; +static void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){ + Vdbe *v = pParse->pVdbe; + int i; + struct AggInfo_func *pF; + struct AggInfo_col *pC; + + pAggInfo->directMode = 1; + for(i=0, pF=pAggInfo->aFunc; inFunc; i++, pF++){ + int nArg; + int addrNext = 0; + ExprList *pList = pF->pExpr->pList; + if( pList ){ + nArg = pList->nExpr; + sqlite3ExprCodeExprList(pParse, pList); + }else{ + nArg = 0; + } + if( pF->iDistinct>=0 ){ + addrNext = sqlite3VdbeMakeLabel(v); + assert( nArg==1 ); + codeDistinct(v, pF->iDistinct, addrNext, 1, 2); + } + if( pF->pFunc->needCollSeq ){ + CollSeq *pColl = 0; + struct ExprList_item *pItem; + int j; + for(j=0, pItem=pList->a; !pColl && jnExpr; j++, pItem++){ + pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr); + } + if( !pColl ){ + pColl = pParse->db->pDfltColl; + } + sqlite3VdbeOp3(v, OP_CollSeq, 0, 0, (char *)pColl, P3_COLLSEQ); + } + sqlite3VdbeOp3(v, OP_AggStep, pF->iMem, nArg, (void*)pF->pFunc, P3_FUNCDEF); + if( addrNext ){ + sqlite3VdbeResolveLabel(v, addrNext); + } + } + for(i=0, pC=pAggInfo->aCol; inAccumulator; i++, pC++){ + sqlite3ExprCode(pParse, pC->pExpr); + sqlite3VdbeAddOp(v, OP_MemStore, pC->iMem, 1); + } + pAggInfo->directMode = 0; } - + + /* ** Generate code for the given SELECT statement. ** @@ -2492,9 +2579,9 @@ int *pParentAgg, /* True if pParent uses aggregate functions */ char *aff /* If eDest is SRT_Union, the affinity string */ ){ - int i; - WhereInfo *pWInfo; - Vdbe *v; + int i, j; /* Loop counters */ + WhereInfo *pWInfo; /* Return from sqlite3WhereBegin() */ + Vdbe *v; /* The virtual machine under construction */ int isAgg; /* True for select lists like "count(*)" */ ExprList *pEList; /* List of columns to extract. */ SrcList *pTabList; /* List of tables to select from */ @@ -2505,22 +2592,29 @@ int isDistinct; /* True if the DISTINCT keyword is present */ int distinct; /* Table to use for the distinct set */ int rc = 1; /* Value to return from this function */ - AggregateInfo sAggInfo; + int addrSortIndex; /* Address of an OP_OpenVirtual instruction */ + AggInfo sAggInfo; /* Information used by aggregate queries */ if( sqlite3_malloc_failed || pParse->nErr || p==0 ) return 1; if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1; + memset(&sAggInfo, 0, sizeof(sAggInfo)); #ifndef SQLITE_OMIT_COMPOUND_SELECT /* If there is are a sequence of queries, do the earlier ones first. */ if( p->pPrior ){ + if( p->pRightmost==0 ){ + Select *pLoop; + for(pLoop=p; pLoop; pLoop=pLoop->pPrior){ + pLoop->pRightmost = p; + } + } return multiSelect(pParse, p, eDest, iParm, aff); } #endif - saveAggregateInfo(pParse, &sAggInfo); pOrderBy = p->pOrderBy; - if( eDest==SRT_Union || eDest==SRT_Except || eDest==SRT_Discard ){ + if( IgnorableOrderby(eDest) ){ p->pOrderBy = 0; } if( sqlite3SelectResolve(pParse, p, 0) ){ @@ -2559,14 +2653,8 @@ /* ORDER BY is ignored for some destinations. */ - switch( eDest ){ - case SRT_Union: - case SRT_Except: - case SRT_Discard: - pOrderBy = 0; - break; - default: - break; + if( IgnorableOrderby(eDest) ){ + pOrderBy = 0; } /* Begin generating code. @@ -2587,23 +2675,24 @@ for(i=0; inSrc; i++){ const char *zSavedAuthContext = 0; int needRestoreContext; + struct SrcList_item *pItem = &pTabList->a[i]; - if( pTabList->a[i].pSelect==0 ) continue; - if( pTabList->a[i].zName!=0 ){ + if( pItem->pSelect==0 ) continue; + if( pItem->zName!=0 ){ zSavedAuthContext = pParse->zAuthContext; - pParse->zAuthContext = pTabList->a[i].zName; + pParse->zAuthContext = pItem->zName; needRestoreContext = 1; }else{ needRestoreContext = 0; } - sqlite3Select(pParse, pTabList->a[i].pSelect, SRT_TempTable, - pTabList->a[i].iCursor, p, i, &isAgg, 0); + sqlite3Select(pParse, pItem->pSelect, SRT_VirtualTab, + pItem->iCursor, p, i, &isAgg, 0); if( needRestoreContext ){ pParse->zAuthContext = zSavedAuthContext; } pTabList = p->pSrc; pWhere = p->pWhere; - if( eDest!=SRT_Union && eDest!=SRT_Except && eDest!=SRT_Discard ){ + if( !IgnorableOrderby(eDest) ){ pOrderBy = p->pOrderBy; } pGroupBy = p->pGroupBy; @@ -2632,18 +2721,32 @@ #endif /* If there is an ORDER BY clause, resolve any collation sequences - ** names that have been explicitly specified. + ** names that have been explicitly specified and create a sorting index. + ** + ** This sorting index might end up being unused if the data can be + ** extracted in pre-sorted order. If that is the case, then the + ** OP_OpenVirtual instruction will be changed to an OP_Noop once + ** we figure out that the sorting index is not needed. The addrSortIndex + ** variable is used to facilitate that change. */ if( pOrderBy ){ - for(i=0; inExpr; i++){ - if( pOrderBy->a[i].zName ){ - pOrderBy->a[i].pExpr->pColl = - sqlite3LocateCollSeq(pParse, pOrderBy->a[i].zName, -1); + struct ExprList_item *pTerm; + KeyInfo *pKeyInfo; + for(i=0, pTerm=pOrderBy->a; inExpr; i++, pTerm++){ + if( pTerm->zName ){ + pTerm->pExpr->pColl = sqlite3LocateCollSeq(pParse, pTerm->zName, -1); } } if( pParse->nErr ){ goto select_end; } + pKeyInfo = keyInfoFromExprList(pParse, pOrderBy); + pOrderBy->iECursor = pParse->nTab++; + p->addrOpenVirt[2] = addrSortIndex = + sqlite3VdbeOp3(v, OP_OpenVirtual, pOrderBy->iECursor, pOrderBy->nExpr+2, + (char*)pKeyInfo, P3_KEYINFO_HANDOFF); + }else{ + addrSortIndex = -1; } /* Set the limiter. @@ -2652,80 +2755,11 @@ /* If the output is destined for a temporary table, open that table. */ - if( eDest==SRT_TempTable ){ - sqlite3VdbeAddOp(v, OP_OpenTemp, iParm, 0); - sqlite3VdbeAddOp(v, OP_SetNumColumns, iParm, pEList->nExpr); + if( eDest==SRT_VirtualTab ){ + sqlite3VdbeAddOp(v, OP_OpenVirtual, iParm, pEList->nExpr); } - /* Do an analysis of aggregate expressions. - */ - if( isAgg || pGroupBy ){ - NameContext sNC; - memset(&sNC, 0, sizeof(sNC)); - sNC.pParse = pParse; - sNC.pSrcList = pTabList; - assert( pParse->nAgg==0 ); - isAgg = 1; - for(i=0; inExpr; i++){ - if( sqlite3ExprAnalyzeAggregates(&sNC, pEList->a[i].pExpr) ){ - goto select_end; - } - } - if( pGroupBy ){ - for(i=0; inExpr; i++){ - if( sqlite3ExprAnalyzeAggregates(&sNC, pGroupBy->a[i].pExpr) ){ - goto select_end; - } - } - } - if( pHaving && sqlite3ExprAnalyzeAggregates(&sNC, pHaving) ){ - goto select_end; - } - if( pOrderBy ){ - for(i=0; inExpr; i++){ - if( sqlite3ExprAnalyzeAggregates(&sNC, pOrderBy->a[i].pExpr) ){ - goto select_end; - } - } - } - } - - /* Reset the aggregator - */ - if( isAgg ){ - int addr = sqlite3VdbeAddOp(v, OP_AggReset, (pGroupBy?0:1), pParse->nAgg); - for(i=0; inAgg; i++){ - FuncDef *pFunc; - if( (pFunc = pParse->aAgg[i].pFunc)!=0 && pFunc->xFinalize!=0 ){ - int nExpr = 0; -#ifdef SQLITE_SSE - Expr *pAggExpr = pParse->aAgg[i].pExpr; - if( pAggExpr && pAggExpr->pList ){ - nExpr = pAggExpr->pList->nExpr; - } -#endif - sqlite3VdbeOp3(v, OP_AggInit, nExpr, i, (char*)pFunc, P3_FUNCDEF); - } - } - if( pGroupBy ){ - int sz = sizeof(KeyInfo) + pGroupBy->nExpr*sizeof(CollSeq*); - KeyInfo *pKey = (KeyInfo *)sqliteMalloc(sz); - if( 0==pKey ){ - goto select_end; - } - pKey->enc = pParse->db->enc; - pKey->nField = pGroupBy->nExpr; - for(i=0; inExpr; i++){ - pKey->aColl[i] = sqlite3ExprCollSeq(pParse, pGroupBy->a[i].pExpr); - if( !pKey->aColl[i] ){ - pKey->aColl[i] = pParse->db->pDfltColl; - } - } - sqlite3VdbeChangeP3(v, addr, (char *)pKey, P3_KEYINFO_HANDOFF); - } - } - /* Initialize the memory cell to NULL for SRT_Mem or 0 for SRT_Exists */ if( eDest==SRT_Mem || eDest==SRT_Exists ){ @@ -2733,105 +2767,292 @@ sqlite3VdbeAddOp(v, OP_MemStore, iParm, 1); } - /* Open a temporary table to use for the distinct set. + /* Open a virtual index to use for the distinct set. */ if( isDistinct ){ + KeyInfo *pKeyInfo; distinct = pParse->nTab++; - openTempIndex(pParse, p, distinct); + pKeyInfo = keyInfoFromExprList(pParse, p->pEList); + sqlite3VdbeOp3(v, OP_OpenVirtual, distinct, 0, + (char*)pKeyInfo, P3_KEYINFO_HANDOFF); }else{ distinct = -1; } - /* Begin the database scan - */ - pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, - pGroupBy ? 0 : &pOrderBy); - if( pWInfo==0 ) goto select_end; + /* Aggregate and non-aggregate queries are handled differently */ + if( !isAgg && pGroupBy==0 ){ + /* This case is for non-aggregate queries + ** Begin the database scan + */ + pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, &pOrderBy); + if( pWInfo==0 ) goto select_end; - /* Use the standard inner loop if we are not dealing with - ** aggregates - */ - if( !isAgg ){ + /* If sorting index that was created by a prior OP_OpenVirtual + ** instruction ended up not being needed, then change the OP_OpenVirtual + ** into an OP_Noop. + */ + if( addrSortIndex>=0 && pOrderBy==0 ){ + uncreateSortingIndex(pParse, addrSortIndex); + p->addrOpenVirt[2] = -1; + } + + /* Use the standard inner loop + */ if( selectInnerLoop(pParse, p, pEList, 0, 0, pOrderBy, distinct, eDest, iParm, pWInfo->iContinue, pWInfo->iBreak, aff) ){ goto select_end; } - } - /* If we are dealing with aggregates, then do the special aggregate - ** processing. - */ - else{ - AggExpr *pAgg; - int lbl1 = 0; - pParse->fillAgg = 1; - if( pGroupBy ){ - for(i=0; inExpr; i++){ - sqlite3ExprCode(pParse, pGroupBy->a[i].pExpr); - } - /* No affinity string is attached to the following OP_MakeRecord - ** because we do not need to do any coercion of datatypes. */ - sqlite3VdbeAddOp(v, OP_MakeRecord, pGroupBy->nExpr, 0); - lbl1 = sqlite3VdbeMakeLabel(v); - sqlite3VdbeAddOp(v, OP_AggFocus, 0, lbl1); + /* End the database scan loop. + */ + sqlite3WhereEnd(pWInfo); + }else{ + /* This is the processing for aggregate queries */ + NameContext sNC; /* Name context for processing aggregate information */ + int iAMem; /* First Mem address for storing current GROUP BY */ + int iBMem; /* First Mem address for previous GROUP BY */ + int iUseFlag; /* Mem address holding flag indicating that at least + ** one row of the input to the aggregator has been + ** processed */ + int iAbortFlag; /* Mem address which causes query abort if positive */ + int groupBySort; /* Rows come from source in GROUP BY order */ + + + /* The following variables hold addresses or labels for parts of the + ** virtual machine program we are putting together */ + int addrOutputRow; /* Start of subroutine that outputs a result row */ + int addrSetAbort; /* Set the abort flag and return */ + int addrInitializeLoop; /* Start of code that initializes the input loop */ + int addrTopOfLoop; /* Top of the input loop */ + int addrGroupByChange; /* Code that runs when any GROUP BY term changes */ + int addrProcessRow; /* Code to process a single input row */ + int addrEnd; /* End of all processing */ + int addrSortingIdx; /* The OP_OpenVirtual for the sorting index */ + + addrEnd = sqlite3VdbeMakeLabel(v); + + /* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in + ** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the + ** SELECT statement. + */ + memset(&sNC, 0, sizeof(sNC)); + sNC.pParse = pParse; + sNC.pSrcList = pTabList; + sNC.pAggInfo = &sAggInfo; + sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr+1 : 0; + sAggInfo.pGroupBy = pGroupBy; + if( sqlite3ExprAnalyzeAggList(&sNC, pEList) ){ + goto select_end; } - for(i=0, pAgg=pParse->aAgg; inAgg; i++, pAgg++){ - if( pAgg->isAgg ) continue; - sqlite3ExprCode(pParse, pAgg->pExpr); - sqlite3VdbeAddOp(v, OP_AggSet, 0, i); + if( sqlite3ExprAnalyzeAggList(&sNC, pOrderBy) ){ + goto select_end; } - pParse->fillAgg = 0; - if( lbl1<0 ){ - sqlite3VdbeResolveLabel(v, lbl1); + if( pHaving && sqlite3ExprAnalyzeAggregates(&sNC, pHaving) ){ + goto select_end; } - for(i=0, pAgg=pParse->aAgg; inAgg; i++, pAgg++){ - Expr *pE; - int nExpr; - FuncDef *pDef; - if( !pAgg->isAgg ) continue; - assert( pAgg->pFunc!=0 ); - assert( pAgg->pFunc->xStep!=0 ); - pDef = pAgg->pFunc; - pE = pAgg->pExpr; - assert( pE!=0 ); - assert( pE->op==TK_AGG_FUNCTION ); - nExpr = sqlite3ExprCodeExprList(pParse, pE->pList); - sqlite3VdbeAddOp(v, OP_Integer, i, 0); - if( pDef->needCollSeq ){ - CollSeq *pColl = 0; - int j; - for(j=0; !pColl && jpList->a[j].pExpr); + sAggInfo.nAccumulator = sAggInfo.nColumn; + for(i=0; ipList) ){ + goto select_end; + } + } + if( sqlite3_malloc_failed ) goto select_end; + + /* Processing for aggregates with GROUP BY is very different and + ** much more complex tha aggregates without a GROUP BY. + */ + if( pGroupBy ){ + KeyInfo *pKeyInfo; /* Keying information for the group by clause */ + + /* Create labels that we will be needing + */ + + addrInitializeLoop = sqlite3VdbeMakeLabel(v); + addrGroupByChange = sqlite3VdbeMakeLabel(v); + addrProcessRow = sqlite3VdbeMakeLabel(v); + + /* If there is a GROUP BY clause we might need a sorting index to + ** implement it. Allocate that sorting index now. If it turns out + ** that we do not need it after all, the OpenVirtual instruction + ** will be converted into a Noop. + */ + sAggInfo.sortingIdx = pParse->nTab++; + pKeyInfo = keyInfoFromExprList(pParse, pGroupBy); + addrSortingIdx = + sqlite3VdbeOp3(v, OP_OpenVirtual, sAggInfo.sortingIdx, + sAggInfo.nSortingColumn, + (char*)pKeyInfo, P3_KEYINFO_HANDOFF); + + /* Initialize memory locations used by GROUP BY aggregate processing + */ + iUseFlag = pParse->nMem++; + iAbortFlag = pParse->nMem++; + iAMem = pParse->nMem; + pParse->nMem += pGroupBy->nExpr; + iBMem = pParse->nMem; + pParse->nMem += pGroupBy->nExpr; + sqlite3VdbeAddOp(v, OP_Integer, 0, 0); + sqlite3VdbeAddOp(v, OP_MemStore, iAbortFlag, 0); + sqlite3VdbeAddOp(v, OP_MemStore, iUseFlag, 1); + sqlite3VdbeAddOp(v, OP_Null, 0, 0); + sqlite3VdbeAddOp(v, OP_MemStore, iAMem, 1); + sqlite3VdbeAddOp(v, OP_Goto, 0, addrInitializeLoop); + + /* Generate a subroutine that outputs a single row of the result + ** set. This subroutine first looks at the iUseFlag. If iUseFlag + ** is less than or equal to zero, the subroutine is a no-op. If + ** the processing calls for the query to abort, this subroutine + ** increments the iAbortFlag memory location before returning in + ** order to signal the caller to abort. + */ + addrSetAbort = sqlite3VdbeCurrentAddr(v); + sqlite3VdbeAddOp(v, OP_MemIncr, iAbortFlag, 0); + sqlite3VdbeAddOp(v, OP_Return, 0, 0); + addrOutputRow = sqlite3VdbeCurrentAddr(v); + sqlite3VdbeAddOp(v, OP_IfMemPos, iUseFlag, addrOutputRow+2); + sqlite3VdbeAddOp(v, OP_Return, 0, 0); + finalizeAggFunctions(pParse, &sAggInfo); + if( pHaving ){ + sqlite3ExprIfFalse(pParse, pHaving, addrOutputRow+1, 1); + } + rc = selectInnerLoop(pParse, p, p->pEList, 0, 0, pOrderBy, + distinct, eDest, iParm, + addrOutputRow+1, addrSetAbort, aff); + if( rc ){ + goto select_end; + } + sqlite3VdbeAddOp(v, OP_Return, 0, 0); + + /* Begin a loop that will extract all source rows in GROUP BY order. + ** This might involve two separate loops with an OP_Sort in between, or + ** it might be a single loop that uses an index to extract information + ** in the right order to begin with. + */ + sqlite3VdbeResolveLabel(v, addrInitializeLoop); + pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, &pGroupBy); + if( pWInfo==0 ) goto select_end; + if( pGroupBy==0 ){ + /* The optimizer is able to deliver rows in group by order so + ** we do not have to sort. The OP_OpenVirtual table will be + ** cancelled later because we still need to use the pKeyInfo + */ + pGroupBy = p->pGroupBy; + groupBySort = 0; + }else{ + /* Rows are coming out in undetermined order. We have to push + ** each row into a sorting index, terminate the first loop, + ** then loop over the sorting index in order to get the output + ** in sorted order + */ + groupBySort = 1; + sqlite3ExprCodeExprList(pParse, pGroupBy); + sqlite3VdbeAddOp(v, OP_Sequence, sAggInfo.sortingIdx, 0); + j = pGroupBy->nExpr+1; + for(i=0; iiSorterColumniColumn<0 ){ + sqlite3VdbeAddOp(v, OP_Rowid, pCol->iTable, 0); + }else{ + sqlite3VdbeAddOp(v, OP_Column, pCol->iTable, pCol->iColumn); + } + j++; } - if( !pColl ) pColl = pParse->db->pDfltColl; - sqlite3VdbeOp3(v, OP_CollSeq, 0, 0, (char *)pColl, P3_COLLSEQ); + sqlite3VdbeAddOp(v, OP_MakeRecord, j, 0); + sqlite3VdbeAddOp(v, OP_IdxInsert, sAggInfo.sortingIdx, 0); + sqlite3WhereEnd(pWInfo); + sqlite3VdbeAddOp(v, OP_Sort, sAggInfo.sortingIdx, addrEnd); + sAggInfo.useSortingIdx = 1; } - sqlite3VdbeOp3(v, OP_AggFunc, 0, nExpr, (char*)pDef, P3_FUNCDEF); - } - } - /* End the database scan loop. - */ - sqlite3WhereEnd(pWInfo); + /* Evaluate the current GROUP BY terms and store in b0, b1, b2... + ** (b0 is memory location iBMem+0, b1 is iBMem+1, and so forth) + ** Then compare the current GROUP BY terms against the GROUP BY terms + ** from the previous row currently stored in a0, a1, a2... + */ + addrTopOfLoop = sqlite3VdbeCurrentAddr(v); + for(j=0; jnExpr; j++){ + if( groupBySort ){ + sqlite3VdbeAddOp(v, OP_Column, sAggInfo.sortingIdx, j); + }else{ + sAggInfo.directMode = 1; + sqlite3ExprCode(pParse, pGroupBy->a[j].pExpr); + } + sqlite3VdbeAddOp(v, OP_MemStore, iBMem+j, jnExpr-1); + } + for(j=pGroupBy->nExpr-1; j>=0; j--){ + if( jnExpr-1 ){ + sqlite3VdbeAddOp(v, OP_MemLoad, iBMem+j, 0); + } + sqlite3VdbeAddOp(v, OP_MemLoad, iAMem+j, 0); + if( j==0 ){ + sqlite3VdbeAddOp(v, OP_Eq, 0, addrProcessRow); + }else{ + sqlite3VdbeAddOp(v, OP_Ne, 0x100, addrGroupByChange); + } + sqlite3VdbeChangeP3(v, -1, (void*)pKeyInfo->aColl[j], P3_COLLSEQ); + } - /* If we are processing aggregates, we need to set up a second loop - ** over all of the aggregate values and process them. - */ - if( isAgg ){ - int endagg = sqlite3VdbeMakeLabel(v); - int startagg; - startagg = sqlite3VdbeAddOp(v, OP_AggNext, 0, endagg); - if( pHaving ){ - sqlite3ExprIfFalse(pParse, pHaving, startagg, 1); + /* Generate code that runs whenever the GROUP BY changes. + ** Change in the GROUP BY are detected by the previous code + ** block. If there were no changes, this block is skipped. + ** + ** This code copies current group by terms in b0,b1,b2,... + ** over to a0,a1,a2. It then calls the output subroutine + ** and resets the aggregate accumulator registers in preparation + ** for the next GROUP BY batch. + */ + sqlite3VdbeResolveLabel(v, addrGroupByChange); + for(j=0; jnExpr; j++){ + sqlite3VdbeAddOp(v, OP_MemLoad, iBMem+j, 0); + sqlite3VdbeAddOp(v, OP_MemStore, iAMem+j, 1); + } + sqlite3VdbeAddOp(v, OP_Gosub, 0, addrOutputRow); + sqlite3VdbeAddOp(v, OP_IfMemPos, iAbortFlag, addrEnd); + resetAccumulator(pParse, &sAggInfo); + + /* Update the aggregate accumulators based on the content of + ** the current row + */ + sqlite3VdbeResolveLabel(v, addrProcessRow); + updateAccumulator(pParse, &sAggInfo); + sqlite3VdbeAddOp(v, OP_MemIncr, iUseFlag, 0); + + /* End of the loop + */ + if( groupBySort ){ + sqlite3VdbeAddOp(v, OP_Next, sAggInfo.sortingIdx, addrTopOfLoop); + }else{ + sqlite3WhereEnd(pWInfo); + uncreateSortingIndex(pParse, addrSortingIdx); + } + + /* Output the final row of result + */ + sqlite3VdbeAddOp(v, OP_Gosub, 0, addrOutputRow); + + } /* endif pGroupBy */ + else { + /* This case runs if the aggregate has no GROUP BY clause. The + ** processing is much simpler since there is only a single row + ** of output. + */ + resetAccumulator(pParse, &sAggInfo); + pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0); + if( pWInfo==0 ) goto select_end; + updateAccumulator(pParse, &sAggInfo); + sqlite3WhereEnd(pWInfo); + finalizeAggFunctions(pParse, &sAggInfo); + pOrderBy = 0; + if( pHaving ){ + sqlite3ExprIfFalse(pParse, pHaving, addrEnd, 1); + } + selectInnerLoop(pParse, p, p->pEList, 0, 0, 0, -1, + eDest, iParm, addrEnd, addrEnd, aff); } - if( selectInnerLoop(pParse, p, pEList, 0, 0, pOrderBy, distinct, eDest, - iParm, startagg, endagg, aff) ){ - goto select_end; - } - sqlite3VdbeAddOp(v, OP_Goto, 0, startagg); - sqlite3VdbeResolveLabel(v, endagg); - sqlite3VdbeAddOp(v, OP_Noop, 0, 0); - } + sqlite3VdbeResolveLabel(v, addrEnd); + + } /* endif aggregate query */ /* If there is an ORDER BY clause, then we need to sort the results ** and send them to the callback one by one. @@ -2863,6 +3084,7 @@ ** successful coding of the SELECT. */ select_end: - restoreAggregateInfo(pParse, &sAggInfo); + sqliteFree(sAggInfo.aCol); + sqliteFree(sAggInfo.aFunc); return rc; } ======================================================================== --- sqlite/sqlite3.h 97fec5750fa71f8b162c9571a7e08413de9886ed +++ sqlite/sqlite3.h d1ab08a3d92270801782adad0dad0f31d6df7761 @@ -12,7 +12,7 @@ ** This header file defines the interface that the SQLite library ** presents to client programs. ** -** @(#) $Id: sqlite.h.in,v 1.136 2005/06/12 22:12:39 drh Exp $ +** @(#) $Id: sqlite.h.in,v 1.141 2005/09/08 10:58:52 drh Exp $ */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ @@ -31,7 +31,7 @@ #ifdef SQLITE_VERSION # undef SQLITE_VERSION #endif -#define SQLITE_VERSION "3.2.2" +#define SQLITE_VERSION "3.2.6" /* ** The format of the version string is "X.Y.Z", where @@ -48,7 +48,7 @@ #ifdef SQLITE_VERSION_NUMBER # undef SQLITE_VERSION_NUMBER #endif -#define SQLITE_VERSION_NUMBER 3002002 +#define SQLITE_VERSION_NUMBER 3002006 /* ** The version string is also compiled into the library so that a program @@ -158,7 +158,7 @@ */ #define SQLITE_OK 0 /* Successful result */ #define SQLITE_ERROR 1 /* SQL error or missing database */ -#define SQLITE_INTERNAL 2 /* An internal logic error in SQLite */ +#define SQLITE_INTERNAL 2 /* NOT USED. Internal logic error in SQLite */ #define SQLITE_PERM 3 /* Access permission denied */ #define SQLITE_ABORT 4 /* Callback routine requested an abort */ #define SQLITE_BUSY 5 /* The database file is locked */ @@ -168,13 +168,13 @@ #define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/ #define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ #define SQLITE_CORRUPT 11 /* The database disk image is malformed */ -#define SQLITE_NOTFOUND 12 /* (Internal Only) Table or record not found */ +#define SQLITE_NOTFOUND 12 /* NOT USED. Table or record not found */ #define SQLITE_FULL 13 /* Insertion failed because database is full */ #define SQLITE_CANTOPEN 14 /* Unable to open the database file */ #define SQLITE_PROTOCOL 15 /* Database lock protocol error */ #define SQLITE_EMPTY 16 /* Database is empty */ #define SQLITE_SCHEMA 17 /* The database schema changed */ -#define SQLITE_TOOBIG 18 /* Too much data for one row of a table */ +#define SQLITE_TOOBIG 18 /* NOT USED. Too much data for one row */ #define SQLITE_CONSTRAINT 19 /* Abort due to contraint violation */ #define SQLITE_MISMATCH 20 /* Data type mismatch */ #define SQLITE_MISUSE 21 /* Library used incorrectly */ @@ -260,7 +260,6 @@ int sqlite3_complete_last(const char *sql, const char **last); int sqlite3_complete16(const void *sql); - /* ** This routine identifies a callback function that is invoked ** whenever an attempt is made to open a database table that is @@ -375,8 +374,9 @@ ** ** We can use this text in an SQL statement as follows: ** -** sqlite3_exec_printf(db, "INSERT INTO table VALUES('%q')", -** callback1, 0, 0, zText); +** char *z = sqlite3_mprintf("INSERT INTO TABLES('%q')", zText); +** sqlite3_exec(db, z, callback1, 0, 0); +** sqlite3_free(z); ** ** Because the %q format string is used, the '\'' character in zText ** is escaped and the SQL generated is as follows: @@ -454,6 +454,7 @@ #define SQLITE_DETACH 25 /* Database Name NULL */ #define SQLITE_ALTER_TABLE 26 /* Database Name Table Name */ #define SQLITE_REINDEX 27 /* Index Name NULL */ +#define SQLITE_ANALYZE 28 /* Table Name NULL */ /* @@ -465,11 +466,18 @@ #define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */ /* -** Register a function that is called at every invocation of sqlite3_exec() -** or sqlite3_prepare(). This function can be used (for example) to generate -** a log file of all SQL executed against a database. +** Register a function for tracing SQL command evaluation. The function +** registered by sqlite3_trace() is invoked at the first sqlite3_step() +** for the evaluation of an SQL statement. The function registered by +** sqlite3_profile() runs at the end of each SQL statement and includes +** information on how long that statement ran. +** +** The sqlite3_profile() API is currently considered experimental and +** is subject to change. */ void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); +void *sqlite3_profile(sqlite3*, + void(*xProfile)(void*,const char*,sqlite_uint64), void*); /* ** This routine configures a callback function - the progress callback - that @@ -1004,10 +1012,9 @@ void *sqlite3_aggregate_context(sqlite3_context*, int nBytes); /* -** The pUserData parameter to the sqlite3_create_function() and -** sqlite3_create_aggregate() routines used to register user functions -** is available to the implementation of the function using this -** call. +** The pUserData parameter to the sqlite3_create_function() +** routine used to register user functions is available to +** the implementation of the function using this call. */ void *sqlite3_user_data(sqlite3_context*); ======================================================================== --- sqlite/sqliteInt.h 0722b47bae7acb182bf43be3585537027c63f741 +++ sqlite/sqliteInt.h e78a7c53a97a2e5d8d6370b6836b2921124ac26f @@ -11,12 +11,23 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.387 2005/06/12 21:35:52 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.419 2005/09/17 15:20:27 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ /* +** Many people are failing to set -DNDEBUG=1 when compiling SQLite. +** Setting NDEBUG makes the code smaller and run faster. So the following +** lines are added to automatically set NDEBUG unless the -DSQLITE_DEBUG=1 +** option is set. Thus NDEBUG becomes an opt-in rather than an opt-out +** feature. +*/ +#if !defined(NDEBUG) && !defined(SQLITE_DEBUG) +# define NDEBUG 1 +#endif + +/* ** These #defines should enable >2GB file support on Posix if the ** underlying operating system supports it. If the OS lacks ** large file support, or if the OS is windows, these should be no-ops. @@ -209,6 +220,7 @@ struct BusyHandler { int (*xFunc)(void *,int); /* The busy callback */ void *pArg; /* First arg to busy callback */ + int nBusy; /* Incremented with each busy call */ }; /* @@ -298,30 +310,30 @@ /* ** Forward references to structures */ +typedef struct AggInfo AggInfo; +typedef struct AuthContext AuthContext; +typedef struct CollSeq CollSeq; typedef struct Column Column; -typedef struct Table Table; -typedef struct Index Index; +typedef struct Db Db; typedef struct Expr Expr; typedef struct ExprList ExprList; -typedef struct Parse Parse; -typedef struct Token Token; +typedef struct FKey FKey; +typedef struct FuncDef FuncDef; typedef struct IdList IdList; -typedef struct SrcList SrcList; -typedef struct WhereInfo WhereInfo; -typedef struct WhereLevel WhereLevel; -typedef struct Select Select; -typedef struct AggExpr AggExpr; -typedef struct FuncDef FuncDef; -typedef struct Trigger Trigger; -typedef struct TriggerStep TriggerStep; -typedef struct TriggerStack TriggerStack; -typedef struct FKey FKey; -typedef struct Db Db; -typedef struct AuthContext AuthContext; +typedef struct Index Index; typedef struct KeyClass KeyClass; -typedef struct CollSeq CollSeq; typedef struct KeyInfo KeyInfo; typedef struct NameContext NameContext; +typedef struct Parse Parse; +typedef struct Select Select; +typedef struct SrcList SrcList; +typedef struct Table Table; +typedef struct Token Token; +typedef struct TriggerStack TriggerStack; +typedef struct TriggerStep TriggerStep; +typedef struct Trigger Trigger; +typedef struct WhereInfo WhereInfo; +typedef struct WhereLevel WhereLevel; /* ** Each database file to be accessed by the system is an instance @@ -420,8 +432,10 @@ } init; struct Vdbe *pVdbe; /* List of active virtual machines */ int activeVdbeCnt; /* Number of vdbes currently executing */ - void (*xTrace)(void*,const char*); /* Trace function */ - void *pTraceArg; /* Argument to the trace function */ + void (*xTrace)(void*,const char*); /* Trace function */ + void *pTraceArg; /* Argument to the trace function */ + void (*xProfile)(void*,const char*,u64); /* Profiling function */ + void *pProfileArg; /* Argument to profile function */ void *pCommitArg; /* Argument to xCommitCallback() */ int (*xCommitCallback)(void*);/* Invoked at every commit. */ void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*); @@ -496,18 +510,25 @@ ** points to a linked list of these structures. */ struct FuncDef { - char *zName; /* SQL name of the function */ - int nArg; /* Number of arguments. -1 means unlimited */ + i16 nArg; /* Number of arguments. -1 means unlimited */ u8 iPrefEnc; /* Preferred text encoding (SQLITE_UTF8, 16LE, 16BE) */ + u8 needCollSeq; /* True if sqlite3GetFuncCollSeq() might be called */ + u8 flags; /* Some combination of SQLITE_FUNC_* */ void *pUserData; /* User data parameter */ FuncDef *pNext; /* Next function with same name */ void (*xFunc)(sqlite3_context*,int,sqlite3_value**); /* Regular function */ void (*xStep)(sqlite3_context*,int,sqlite3_value**); /* Aggregate step */ void (*xFinalize)(sqlite3_context*); /* Aggregate finializer */ - u8 needCollSeq; /* True if sqlite3GetFuncCollSeq() might be called */ + char zName[1]; /* SQL name of the function. MUST BE LAST */ }; /* +** Possible values for FuncDef.flags +*/ +#define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */ +#define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */ + +/* ** information about each column of an SQL table is held in an instance ** of this structure. */ @@ -545,11 +566,20 @@ struct CollSeq { char *zName; /* Name of the collating sequence, UTF-8 encoded */ u8 enc; /* Text encoding handled by xCmp() */ + u8 type; /* One of the SQLITE_COLL_... values below */ void *pUser; /* First argument to xCmp() */ int (*xCmp)(void*,int, const void*, int, const void*); }; /* +** Allowed values of CollSeq flags: +*/ +#define SQLITE_COLL_BINARY 1 /* The default memcmp() collating sequence */ +#define SQLITE_COLL_NOCASE 2 /* The built-in NOCASE collating sequence */ +#define SQLITE_COLL_REVERSE 3 /* The built-in REVERSE collating sequence */ +#define SQLITE_COLL_USER 0 /* Any other user-defined collating sequence */ + +/* ** A sort order can be either ASC or DESC. */ #define SQLITE_SO_ASC 0 /* Sort in ascending order */ @@ -745,6 +775,7 @@ char *zName; /* Name of this index */ int nColumn; /* Number of columns in the table used by this index */ int *aiColumn; /* Which columns are used by this index. 1st is 0 */ + unsigned *aiRowEst; /* Result of ANALYZE: Est. rows selected by each column */ Table *pTable; /* The SQL table being indexed */ int tnum; /* Page containing root of this index in database file */ u8 onError; /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */ @@ -770,6 +801,49 @@ }; /* +** An instance of this structure contains information needed to generate +** code for a SELECT that contains aggregate functions. +** +** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a +** pointer to this structure. The Expr.iColumn field is the index in +** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate +** code for that node. +** +** AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the +** original Select structure that describes the SELECT statement. These +** fields do not need to be freed when deallocating the AggInfo structure. +*/ +struct AggInfo { + u8 directMode; /* Direct rendering mode means take data directly + ** from source tables rather than from accumulators */ + u8 useSortingIdx; /* In direct mode, reference the sorting index rather + ** than the source table */ + int sortingIdx; /* Cursor number of the sorting index */ + ExprList *pGroupBy; /* The group by clause */ + int nSortingColumn; /* Number of columns in the sorting index */ + struct AggInfo_col { /* For each column used in source tables */ + int iTable; /* Cursor number of the source table */ + int iColumn; /* Column number within the source table */ + int iSorterColumn; /* Column number in the sorting index */ + int iMem; /* Memory location that acts as accumulator */ + Expr *pExpr; /* The original expression */ + } *aCol; + int nColumn; /* Number of used entries in aCol[] */ + int nColumnAlloc; /* Number of slots allocated for aCol[] */ + int nAccumulator; /* Number of columns that show through to the output. + ** Additional columns are used only as parameters to + ** aggregate functions */ + struct AggInfo_func { /* For each aggregate function */ + Expr *pExpr; /* Expression encoding the function */ + FuncDef *pFunc; /* The aggregate function implementation */ + int iMem; /* Memory location that acts as accumulator */ + int iDistinct; /* Virtual table used to enforce DISTINCT */ + } *aFunc; + int nFunc; /* Number of entries in aFunc[] */ + int nFuncAlloc; /* Number of slots allocated for aFunc[] */ +}; + +/* ** Each node of an expression in the parse tree is an instance ** of this structure. ** @@ -828,9 +902,8 @@ Token span; /* Complete text of the expression */ int iTable, iColumn; /* When op==TK_COLUMN, then this expr node means the ** iColumn-th field of the iTable-th table. */ - int iAgg; /* When op==TK_COLUMN and pParse->fillAgg==FALSE, pull - ** result from the iAgg-th element of the aggregator */ - int iAggCtx; /* The value to pass as P1 of OP_AggGet. */ + AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ + int iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */ Select *pSelect; /* When the expression is a sub-select. Also the ** right side of " IN (