PCLT-DB (empty) → 0.1
raw patch · 27 files changed
+3818/−0 lines, 27 filesdep +HDBCdep +HDBC-postgresqldep +PCLTsetup-changedbinary-added
Dependencies added: HDBC, HDBC-postgresql, PCLT, base, bytestring, containers, convertible, mtl
Files
- COPYING +502/−0
- COPYRIGHT +18/−0
- Data/MyHelpers.hs +18/−0
- Data/MyHelpers_.hs +300/−0
- Database/PCLT.hs +15/−0
- Database/PCLT/InterfaceWithDB.hs +274/−0
- Database/PCLT/InterfaceWithDB__.hs +101/−0
- Database/PCLT/UpdatableCatalog.hs +148/−0
- Database/ReadableFromDB.hs +136/−0
- Database/ReadableFromDB__.hs +104/−0
- PCLT-DB.cabal +105/−0
- Setup.hs +4/−0
- db/data.sql +616/−0
- db/db_inst.sh +15/−0
- db/local_test/tests.sql +2/−0
- db/pclt.sql +507/−0
- db/pclt_meta.sql +67/−0
- db/view.sql +87/−0
- doinst.sh +19/−0
- examples/HelloWorld/HelloWorld.PCLTCatalog.ods binary
- examples/HelloWorld/HelloWorld.hs +266/−0
- examples/HelloWorld/HelloWorld.sql +138/−0
- examples/HelloWorld/HelloWorld_Data.hs +47/−0
- examples/HelloWorld/HelloWorld__.hs +329/−0
- initial_data/PCLT-DB.PCLTCatalog.ods binary
- models/PCLT-DB.ERD.v0.1.odg binary
- models/PCLT-DB.ERD.v0.1.odg.png binary
+ COPYING view
@@ -0,0 +1,502 @@+ GNU LESSER GENERAL PUBLIC LICENSE+ Version 2.1, February 1999++ Copyright (C) 1991, 1999 Free Software Foundation, Inc.+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA+ Everyone is permitted to copy and distribute verbatim copies+ of this license document, but changing it is not allowed.++[This is the first released version of the Lesser GPL. It also counts+ as the successor of the GNU Library Public License, version 2, hence+ the version number 2.1.]++ Preamble++ The licenses for most software are designed to take away your+freedom to share and change it. By contrast, the GNU General Public+Licenses are intended to guarantee your freedom to share and change+free software--to make sure the software is free for all its users.++ This license, the Lesser General Public License, applies to some+specially designated software packages--typically libraries--of the+Free Software Foundation and other authors who decide to use it. You+can use it too, but we suggest you first think carefully about whether+this license or the ordinary General Public License is the better+strategy to use in any particular case, based on the explanations below.++ When we speak of free software, we are referring to freedom of use,+not price. Our General Public Licenses are designed to make sure that+you have the freedom to distribute copies of free software (and charge+for this service if you wish); that you receive source code or can get+it if you want it; that you can change the software and use pieces of+it in new free programs; and that you are informed that you can do+these things.++ To protect your rights, we need to make restrictions that forbid+distributors to deny you these rights or to ask you to surrender these+rights. These restrictions translate to certain responsibilities for+you if you distribute copies of the library or if you modify it.++ For example, if you distribute copies of the library, whether gratis+or for a fee, you must give the recipients all the rights that we gave+you. You must make sure that they, too, receive or can get the source+code. If you link other code with the library, you must provide+complete object files to the recipients, so that they can relink them+with the library after making changes to the library and recompiling+it. And you must show them these terms so they know their rights.++ We protect your rights with a two-step method: (1) we copyright the+library, and (2) we offer you this license, which gives you legal+permission to copy, distribute and/or modify the library.++ To protect each distributor, we want to make it very clear that+there is no warranty for the free library. Also, if the library is+modified by someone else and passed on, the recipients should know+that what they have is not the original version, so that the original+author's reputation will not be affected by problems that might be+introduced by others.++ Finally, software patents pose a constant threat to the existence of+any free program. We wish to make sure that a company cannot+effectively restrict the users of a free program by obtaining a+restrictive license from a patent holder. Therefore, we insist that+any patent license obtained for a version of the library must be+consistent with the full freedom of use specified in this license.++ Most GNU software, including some libraries, is covered by the+ordinary GNU General Public License. This license, the GNU Lesser+General Public License, applies to certain designated libraries, and+is quite different from the ordinary General Public License. We use+this license for certain libraries in order to permit linking those+libraries into non-free programs.++ When a program is linked with a library, whether statically or using+a shared library, the combination of the two is legally speaking a+combined work, a derivative of the original library. The ordinary+General Public License therefore permits such linking only if the+entire combination fits its criteria of freedom. The Lesser General+Public License permits more lax criteria for linking other code with+the library.++ We call this license the "Lesser" General Public License because it+does Less to protect the user's freedom than the ordinary General+Public License. It also provides other free software developers Less+of an advantage over competing non-free programs. These disadvantages+are the reason we use the ordinary General Public License for many+libraries. However, the Lesser license provides advantages in certain+special circumstances.++ For example, on rare occasions, there may be a special need to+encourage the widest possible use of a certain library, so that it becomes+a de-facto standard. To achieve this, non-free programs must be+allowed to use the library. A more frequent case is that a free+library does the same job as widely used non-free libraries. In this+case, there is little to gain by limiting the free library to free+software only, so we use the Lesser General Public License.++ In other cases, permission to use a particular library in non-free+programs enables a greater number of people to use a large body of+free software. For example, permission to use the GNU C Library in+non-free programs enables many more people to use the whole GNU+operating system, as well as its variant, the GNU/Linux operating+system.++ Although the Lesser General Public License is Less protective of the+users' freedom, it does ensure that the user of a program that is+linked with the Library has the freedom and the wherewithal to run+that program using a modified version of the Library.++ The precise terms and conditions for copying, distribution and+modification follow. Pay close attention to the difference between a+"work based on the library" and a "work that uses the library". The+former contains code derived from the library, whereas the latter must+be combined with the library in order to run.++ GNU LESSER GENERAL PUBLIC LICENSE+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION++ 0. This License Agreement applies to any software library or other+program which contains a notice placed by the copyright holder or+other authorized party saying it may be distributed under the terms of+this Lesser General Public License (also called "this License").+Each licensee is addressed as "you".++ A "library" means a collection of software functions and/or data+prepared so as to be conveniently linked with application programs+(which use some of those functions and data) to form executables.++ The "Library", below, refers to any such software library or work+which has been distributed under these terms. A "work based on the+Library" means either the Library or any derivative work under+copyright law: that is to say, a work containing the Library or a+portion of it, either verbatim or with modifications and/or translated+straightforwardly into another language. (Hereinafter, translation is+included without limitation in the term "modification".)++ "Source code" for a work means the preferred form of the work for+making modifications to it. For a library, complete source code means+all the source code for all modules it contains, plus any associated+interface definition files, plus the scripts used to control compilation+and installation of the library.++ Activities other than copying, distribution and modification are not+covered by this License; they are outside its scope. The act of+running a program using the Library is not restricted, and output from+such a program is covered only if its contents constitute a work based+on the Library (independent of the use of the Library in a tool for+writing it). Whether that is true depends on what the Library does+and what the program that uses the Library does.++ 1. You may copy and distribute verbatim copies of the Library's+complete source code as you receive it, in any medium, provided that+you conspicuously and appropriately publish on each copy an+appropriate copyright notice and disclaimer of warranty; keep intact+all the notices that refer to this License and to the absence of any+warranty; and distribute a copy of this License along with the+Library.++ You may charge a fee for the physical act of transferring a copy,+and you may at your option offer warranty protection in exchange for a+fee.++ 2. You may modify your copy or copies of the Library or any portion+of it, thus forming a work based on the Library, and copy and+distribute such modifications or work under the terms of Section 1+above, provided that you also meet all of these conditions:++ a) The modified work must itself be a software library.++ b) You must cause the files modified to carry prominent notices+ stating that you changed the files and the date of any change.++ c) You must cause the whole of the work to be licensed at no+ charge to all third parties under the terms of this License.++ d) If a facility in the modified Library refers to a function or a+ table of data to be supplied by an application program that uses+ the facility, other than as an argument passed when the facility+ is invoked, then you must make a good faith effort to ensure that,+ in the event an application does not supply such function or+ table, the facility still operates, and performs whatever part of+ its purpose remains meaningful.++ (For example, a function in a library to compute square roots has+ a purpose that is entirely well-defined independent of the+ application. Therefore, Subsection 2d requires that any+ application-supplied function or table used by this function must+ be optional: if the application does not supply it, the square+ root function must still compute square roots.)++These requirements apply to the modified work as a whole. If+identifiable sections of that work are not derived from the Library,+and can be reasonably considered independent and separate works in+themselves, then this License, and its terms, do not apply to those+sections when you distribute them as separate works. But when you+distribute the same sections as part of a whole which is a work based+on the Library, the distribution of the whole must be on the terms of+this License, whose permissions for other licensees extend to the+entire whole, and thus to each and every part regardless of who wrote+it.++Thus, it is not the intent of this section to claim rights or contest+your rights to work written entirely by you; rather, the intent is to+exercise the right to control the distribution of derivative or+collective works based on the Library.++In addition, mere aggregation of another work not based on the Library+with the Library (or with a work based on the Library) on a volume of+a storage or distribution medium does not bring the other work under+the scope of this License.++ 3. You may opt to apply the terms of the ordinary GNU General Public+License instead of this License to a given copy of the Library. To do+this, you must alter all the notices that refer to this License, so+that they refer to the ordinary GNU General Public License, version 2,+instead of to this License. (If a newer version than version 2 of the+ordinary GNU General Public License has appeared, then you can specify+that version instead if you wish.) Do not make any other change in+these notices.++ Once this change is made in a given copy, it is irreversible for+that copy, so the ordinary GNU General Public License applies to all+subsequent copies and derivative works made from that copy.++ This option is useful when you wish to copy part of the code of+the Library into a program that is not a library.++ 4. You may copy and distribute the Library (or a portion or+derivative of it, under Section 2) in object code or executable form+under the terms of Sections 1 and 2 above provided that you accompany+it with the complete corresponding machine-readable source code, which+must be distributed under the terms of Sections 1 and 2 above on a+medium customarily used for software interchange.++ If distribution of object code is made by offering access to copy+from a designated place, then offering equivalent access to copy the+source code from the same place satisfies the requirement to+distribute the source code, even though third parties are not+compelled to copy the source along with the object code.++ 5. A program that contains no derivative of any portion of the+Library, but is designed to work with the Library by being compiled or+linked with it, is called a "work that uses the Library". Such a+work, in isolation, is not a derivative work of the Library, and+therefore falls outside the scope of this License.++ However, linking a "work that uses the Library" with the Library+creates an executable that is a derivative of the Library (because it+contains portions of the Library), rather than a "work that uses the+library". The executable is therefore covered by this License.+Section 6 states terms for distribution of such executables.++ When a "work that uses the Library" uses material from a header file+that is part of the Library, the object code for the work may be a+derivative work of the Library even though the source code is not.+Whether this is true is especially significant if the work can be+linked without the Library, or if the work is itself a library. The+threshold for this to be true is not precisely defined by law.++ If such an object file uses only numerical parameters, data+structure layouts and accessors, and small macros and small inline+functions (ten lines or less in length), then the use of the object+file is unrestricted, regardless of whether it is legally a derivative+work. (Executables containing this object code plus portions of the+Library will still fall under Section 6.)++ Otherwise, if the work is a derivative of the Library, you may+distribute the object code for the work under the terms of Section 6.+Any executables containing that work also fall under Section 6,+whether or not they are linked directly with the Library itself.++ 6. As an exception to the Sections above, you may also combine or+link a "work that uses the Library" with the Library to produce a+work containing portions of the Library, and distribute that work+under terms of your choice, provided that the terms permit+modification of the work for the customer's own use and reverse+engineering for debugging such modifications.++ You must give prominent notice with each copy of the work that the+Library is used in it and that the Library and its use are covered by+this License. You must supply a copy of this License. If the work+during execution displays copyright notices, you must include the+copyright notice for the Library among them, as well as a reference+directing the user to the copy of this License. Also, you must do one+of these things:++ a) Accompany the work with the complete corresponding+ machine-readable source code for the Library including whatever+ changes were used in the work (which must be distributed under+ Sections 1 and 2 above); and, if the work is an executable linked+ with the Library, with the complete machine-readable "work that+ uses the Library", as object code and/or source code, so that the+ user can modify the Library and then relink to produce a modified+ executable containing the modified Library. (It is understood+ that the user who changes the contents of definitions files in the+ Library will not necessarily be able to recompile the application+ to use the modified definitions.)++ b) Use a suitable shared library mechanism for linking with the+ Library. A suitable mechanism is one that (1) uses at run time a+ copy of the library already present on the user's computer system,+ rather than copying library functions into the executable, and (2)+ will operate properly with a modified version of the library, if+ the user installs one, as long as the modified version is+ interface-compatible with the version that the work was made with.++ c) Accompany the work with a written offer, valid for at+ least three years, to give the same user the materials+ specified in Subsection 6a, above, for a charge no more+ than the cost of performing this distribution.++ d) If distribution of the work is made by offering access to copy+ from a designated place, offer equivalent access to copy the above+ specified materials from the same place.++ e) Verify that the user has already received a copy of these+ materials or that you have already sent this user a copy.++ For an executable, the required form of the "work that uses the+Library" must include any data and utility programs needed for+reproducing the executable from it. However, as a special exception,+the materials to be distributed need not include anything that is+normally distributed (in either source or binary form) with the major+components (compiler, kernel, and so on) of the operating system on+which the executable runs, unless that component itself accompanies+the executable.++ It may happen that this requirement contradicts the license+restrictions of other proprietary libraries that do not normally+accompany the operating system. Such a contradiction means you cannot+use both them and the Library together in an executable that you+distribute.++ 7. You may place library facilities that are a work based on the+Library side-by-side in a single library together with other library+facilities not covered by this License, and distribute such a combined+library, provided that the separate distribution of the work based on+the Library and of the other library facilities is otherwise+permitted, and provided that you do these two things:++ a) Accompany the combined library with a copy of the same work+ based on the Library, uncombined with any other library+ facilities. This must be distributed under the terms of the+ Sections above.++ b) Give prominent notice with the combined library of the fact+ that part of it is a work based on the Library, and explaining+ where to find the accompanying uncombined form of the same work.++ 8. You may not copy, modify, sublicense, link with, or distribute+the Library except as expressly provided under this License. Any+attempt otherwise to copy, modify, sublicense, link with, or+distribute the Library is void, and will automatically terminate your+rights under this License. However, parties who have received copies,+or rights, from you under this License will not have their licenses+terminated so long as such parties remain in full compliance.++ 9. You are not required to accept this License, since you have not+signed it. However, nothing else grants you permission to modify or+distribute the Library or its derivative works. These actions are+prohibited by law if you do not accept this License. Therefore, by+modifying or distributing the Library (or any work based on the+Library), you indicate your acceptance of this License to do so, and+all its terms and conditions for copying, distributing or modifying+the Library or works based on it.++ 10. Each time you redistribute the Library (or any work based on the+Library), the recipient automatically receives a license from the+original licensor to copy, distribute, link with or modify the Library+subject to these terms and conditions. You may not impose any further+restrictions on the recipients' exercise of the rights granted herein.+You are not responsible for enforcing compliance by third parties with+this License.++ 11. If, as a consequence of a court judgment or allegation of patent+infringement or for any other reason (not limited to patent issues),+conditions are imposed on you (whether by court order, agreement or+otherwise) that contradict the conditions of this License, they do not+excuse you from the conditions of this License. If you cannot+distribute so as to satisfy simultaneously your obligations under this+License and any other pertinent obligations, then as a consequence you+may not distribute the Library at all. For example, if a patent+license would not permit royalty-free redistribution of the Library by+all those who receive copies directly or indirectly through you, then+the only way you could satisfy both it and this License would be to+refrain entirely from distribution of the Library.++If any portion of this section is held invalid or unenforceable under any+particular circumstance, the balance of the section is intended to apply,+and the section as a whole is intended to apply in other circumstances.++It is not the purpose of this section to induce you to infringe any+patents or other property right claims or to contest validity of any+such claims; this section has the sole purpose of protecting the+integrity of the free software distribution system which is+implemented by public license practices. Many people have made+generous contributions to the wide range of software distributed+through that system in reliance on consistent application of that+system; it is up to the author/donor to decide if he or she is willing+to distribute software through any other system and a licensee cannot+impose that choice.++This section is intended to make thoroughly clear what is believed to+be a consequence of the rest of this License.++ 12. If the distribution and/or use of the Library is restricted in+certain countries either by patents or by copyrighted interfaces, the+original copyright holder who places the Library under this License may add+an explicit geographical distribution limitation excluding those countries,+so that distribution is permitted only in or among countries not thus+excluded. In such case, this License incorporates the limitation as if+written in the body of this License.++ 13. The Free Software Foundation may publish revised and/or new+versions of the Lesser General Public License from time to time.+Such new versions will be similar in spirit to the present version,+but may differ in detail to address new problems or concerns.++Each version is given a distinguishing version number. If the Library+specifies a version number of this License which applies to it and+"any later version", you have the option of following the terms and+conditions either of that version or of any later version published by+the Free Software Foundation. If the Library does not specify a+license version number, you may choose any version ever published by+the Free Software Foundation.++ 14. If you wish to incorporate parts of the Library into other free+programs whose distribution conditions are incompatible with these,+write to the author to ask for permission. For software which is+copyrighted by the Free Software Foundation, write to the Free+Software Foundation; we sometimes make exceptions for this. Our+decision will be guided by the two goals of preserving the free status+of all derivatives of our free software and of promoting the sharing+and reuse of software generally.++ NO WARRANTY++ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.++ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH+DAMAGES.++ END OF TERMS AND CONDITIONS++ How to Apply These Terms to Your New Libraries++ If you develop a new library, and you want it to be of the greatest+possible use to the public, we recommend making it free software that+everyone can redistribute and change. You can do so by permitting+redistribution under these terms (or, alternatively, under the terms of the+ordinary General Public License).++ To apply these terms, attach the following notices to the library. It is+safest to attach them to the start of each source file to most effectively+convey the exclusion of warranty; and each file should have at least the+"copyright" line and a pointer to where the full notice is found.++ <one line to give the library's name and a brief idea of what it does.>+ Copyright (C) <year> <name of author>++ This library is free software; you can redistribute it and/or+ modify it under the terms of the GNU Lesser General Public+ License as published by the Free Software Foundation; either+ version 2.1 of the License, or (at your option) any later version.++ This library is distributed in the hope that it will be useful,+ but WITHOUT ANY WARRANTY; without even the implied warranty of+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+ Lesser General Public License for more details.++ You should have received a copy of the GNU Lesser General Public+ License along with this library; if not, write to the Free Software+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA++Also add information on how to contact you by electronic and paper mail.++You should also get your employer (if you work as a programmer) or your+school, if any, to sign a "copyright disclaimer" for the library, if+necessary. Here is a sample; alter the names:++ Yoyodyne, Inc., hereby disclaims all copyright interest in the+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.++ <signature of Ty Coon>, 1 April 1990+ Ty Coon, President of Vice++That's all there is to it!
+ COPYRIGHT view
@@ -0,0 +1,18 @@+Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru>++ This library is free software; you can redistribute it and/or+ modify it under the terms of the GNU Lesser General Public+ License as published by the Free Software Foundation; either+ version 2.1 of the License, or (at your option) any later version.++ This library is distributed in the hope that it will be useful,+ but WITHOUT ANY WARRANTY; without even the implied warranty of+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+ Lesser General Public License for more details.++ You should have received a copy of the GNU Lesser General Public+ License along with this library; if not, write to the Free Software+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA++Please see COPYING for the license.+
+ Data/MyHelpers.hs view
@@ -0,0 +1,18 @@+{-+Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru>++All rights reserved.++For license and copyright information, see the file COPYRIGHT+-}++--------------------------------------------------------------------------+--------------------------------------------------------------------------++module Data.MyHelpers (+ module Data.MyHelpers_+ , module Debug.Trace+ ) where++import Data.MyHelpers_+import Debug.Trace
+ Data/MyHelpers_.hs view
@@ -0,0 +1,300 @@+{-+Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru>++All rights reserved.++For license and copyright information, see the file COPYRIGHT+-}++--------------------------------------------------------------------------+--------------------------------------------------------------------------++module Data.MyHelpers_ where++import qualified Data.ByteString.Lazy.UTF8.Unified as Lazy (ByteString)+import qualified Data.ByteString.Lazy.UTF8.Unified as B hiding (ByteString)+import Data.Char+import Data.Int+import Data.List+import qualified Data.Map as M+import Data.Map (Map, (!))+import Data.Maybe++import System.IO+import System.IO.Unsafe+type ErrorMessage = String++infixr 1 <<+(<<) :: Monad m => m b -> m a -> m b+f << x = x >> f++fst3 :: (a,b,c) -> a+snd3 :: (a,b,c) -> b+thrd3 :: (a,b,c) -> c+fst3 (a,_,_) = a+snd3 (_,b,_) = b+thrd3 (_,_,c) = c++apFor2ple :: (a -> a -> a, b -> b -> b) -> (a,b) -> (a,b) -> (a,b)+apFor2ple (af,bf) (a1,b1) (a2,b2) = (af a1 a2, bf b1 b2)++liftTuple :: Monad m => (m a, m b) -> m (a, b)+lift2ple :: Monad m => (m a, m b) -> m (a, b)+lift3ple :: Monad m => (m a, m b, m c) -> m (a, b, c)+lift4ple :: Monad m => (m a, m b, m c, m d) -> m (a, b, c, d)+liftTuple (ma, mb) = do a <- ma+ b <- mb+ return (a,b)+lift2ple = liftTuple+lift3ple (ma, mb, mc) = do a <- ma+ b <- mb+ c <- mc+ return (a,b,c)+lift4ple (ma, mb, mc, md) = do a <- ma+ b <- mb+ c <- mc+ d <- md+ return (a,b,c,d)++ap22ple :: (a, a) -> (a -> b) -> (b, b)+ap22ple (a1,a2) fa = (fa a1, fa a2)+ap22pleM :: Monad m => (a, a) -> (a -> m b) -> m (b, b)+ap22pleM ple f = lift2ple $ ap22ple ple f+ap23ple :: (a, a, a) -> (a -> b) -> (b, b, b)+ap23ple (a1,a2,a3) fa = (fa a1, fa a2, fa a3)+ap23pleM :: Monad m => (a, a, a) -> (a -> m b) -> m (b, b, b)+ap23pleM ple f = lift3ple $ ap23ple ple f+ap24ple :: (a, a, a, a) -> (a -> b) -> (b, b, b, b)+ap24ple (a1,a2,a3,a4) fa = (fa a1, fa a2, fa a3, fa a3)+ap24pleM :: Monad m => (a, a, a, a) -> (a -> m b) -> m (b, b, b, b)+ap24pleM ple f = lift4ple $ ap24ple ple f++apFrom2ple :: ((a -> b), (a -> c)) -> a -> (b, c)+apFrom2ple (f1,f2) a = (f1 a, f2 a)+apFrom3ple :: ((a -> b), (a -> c), (a -> d)) -> a -> (b, c, d)+apFrom3ple (f1,f2,f3) a = (f1 a, f2 a, f3 a)+apFrom4ple :: ((a -> b), (a -> c), (a -> d), (a -> e)) -> a -> (b, c, d, e)+apFrom4ple (f1,f2,f3,f4) a = (f1 a, f2 a, f3 a, f4 a)++liftEither6 :: Either er a -> Either er b -> Either er c -> Either er d -> Either er e -> Either er f -> Either er (a,b,c,d,e,f)+liftEither6 er_or_a er_or_b er_or_c er_or_d er_or_e er_or_f =+ case er_or_a of+ Left er -> Left er+ Right a ->+ case er_or_b of+ Left er -> Left er+ Right b ->+ case er_or_c of+ Left er -> Left er+ Right c ->+ case er_or_d of+ Left er -> Left er+ Right d ->+ case er_or_e of+ Left er -> Left er+ Right e ->+ case er_or_f of+ Left er -> Left er+ Right f -> Right (a,b,c,d,e,f)++liftEither5 :: Either er a -> Either er b -> Either er c -> Either er d -> Either er e -> Either er (a,b,c,d,e)+liftEither5 er_or_a er_or_b er_or_c er_or_d er_or_e =+ case er_or_a of+ Left er -> Left er+ Right a ->+ case er_or_b of+ Left er -> Left er+ Right b ->+ case er_or_c of+ Left er -> Left er+ Right c ->+ case er_or_d of+ Left er -> Left er+ Right d ->+ case er_or_e of+ Left er -> Left er+ Right e -> Right (a,b,c,d,e)++liftEither2 :: Either er a -> Either er b -> Either er (a,b)+liftEither2 er_or_a er_or_b =+ case er_or_a of+ Left er -> Left er+ Right a ->+ case er_or_b of+ Left er -> Left er+ Right b -> Right (a,b)++isLeft :: Either a b -> Bool+isLeft (Left _) = True+isLeft _ = False++isRight :: Either a b -> Bool+isRight = not . isLeft++fromLeft :: Either a b -> a+fromLeft (Left a) = a+fromLeft _ = error "Error occurred, when applied fromLeft to Right!"++fromRight :: Either a b -> b+fromRight (Right b) = b+fromRight _ = error "Error occurred, when applied fromLeft to Right!"++takeFromMap :: Ord k => k -> Map k a -> (Maybe a, Map k a)+takeFromMap k m =+ let mb_a = M.lookup k m+ in ( mb_a+ , case isJust mb_a of+ True -> M.delete k m+ False -> m+ )++partition_2 :: Ord k => (a -> Bool) -> (a -> b, a -> c) -> Map k a -> (Map k b, Map k c)+partition_2 p (true_f, false_f) m =+ M.foldWithKey+ (\ k a (true_map, false_map) ->+ case p a of+ True -> (M.insert k (true_f a) true_map, false_map)+ False -> (true_map, M.insert k (false_f a) false_map)+ )+ (M.empty, M.empty)+ m++unionWithKey_2 :: Ord k => (k -> (a, a) -> (a, b)) -> (b -> c -> c) -> c -> Map k a -> Map k a -> (Map k a, c)+unionWithKey_2 unifier side_result_accum_f accum_start m1 m2 =+ foldr (\ (k, a1) (m_accum, side_result_accum) ->+ case takeFromMap k m_accum of+ (Nothing, _) -> (M.insert k a1 m_accum, side_result_accum)+ (Just a2, rest_of_accum_map) ->+ let (ar, side_result_add) = unifier k (a1, a2)+ in (M.insert k ar rest_of_accum_map, side_result_accum_f side_result_add side_result_accum)+ )+ (m2, accum_start)+ (M.toList m1)++unionWithKey_3 :: Ord k => (k -> (Maybe a, Maybe b) -> (c, d)) -> (d -> d -> d) -> d -> Map k a -> Map k b -> (Map k c, d)+unionWithKey_3 unifierF sideResultAccumF accum_start m1 m2 =+ let (m1_result, accum1, m2_cut) = foldr+ (\ (k, a) (m_accum, side_result_accum, m2_cut) ->+ let (mb_b, new_m2_cut) = takeFromMap k m2_cut+ (c, d) = unifierF k (Just a, mb_b)+ new_side_result_accum = sideResultAccumF side_result_accum d+ in (M.insert k c m_accum, new_side_result_accum, new_m2_cut)+ )+ (M.empty, accum_start, m2)+ (M.toList m1)+ (m2_result, accum2) = foldr+ (\ (k, b) (m_accum, side_result_accum) ->+ let (c, d) = unifierF k (Nothing, Just b)+ new_side_result_accum = sideResultAccumF side_result_accum d+ in (M.insert k c m_accum, new_side_result_accum)+ )+ (m1_result, accum1)+ (M.toList m2_cut)+ in (m2_result, accum2)++unionWithKey_4 :: Ord k => (k -> (Maybe a, Maybe b) -> (Maybe c, d)) -> (d -> d -> d) -> d -> Map k a -> Map k b -> (Map k c, d)+unionWithKey_4 unifierF sideResultAccumF accum_start m1 m2 =+ let (m1_result, accum1, m2_cut) = foldr+ (\ (k, a) (m_accum, side_result_accum, m2_cut) ->+ let (mb_b, new_m2_cut) = takeFromMap k m2_cut+ (mb_c, d) = unifierF k (Just a, mb_b)+ new_side_result_accum = sideResultAccumF side_result_accum d+ in ( case mb_c of+ Just c -> M.insert k c m_accum+ Nothing -> m_accum+ , new_side_result_accum, new_m2_cut+ )+ )+ (M.empty, accum_start, m2)+ (M.toList m1)+ (m2_result, accum2) = foldr+ (\ (k, b) (m_accum, side_result_accum) ->+ let (mb_c, d) = unifierF k (Nothing, Just b)+ new_side_result_accum = sideResultAccumF side_result_accum d+ in ( case mb_c of+ Just c -> M.insert k c m_accum+ Nothing -> m_accum+ , new_side_result_accum+ )+ )+ (m1_result, accum1)+ (M.toList m2_cut)+ in (m2_result, accum2)++lookupDeleteFromList :: Eq a => a -> [a] -> (Bool, [a])+lookupDeleteFromList e l =+ let mship = elem e l+ in ( mship+ , case mship of+ True -> delete e l+ False -> l+ )++from2DList :: Ord k => [(k, a)] -> M.Map k [a]+from2DList l = foldl (\ accum_map (k, e) -> M.unionWith (++) accum_map (M.singleton k [e])) M.empty l++str2Numeric :: (Num a, Ord a) => String -> Maybe a+str2Numeric s = _str2Numeric s 0+ where+ _str2Numeric [] i = Just i+ _str2Numeric (sh:st) i | isDigit sh = let nexti = (i*10) + (fromIntegral $ digitToInt sh)+ in case i > nexti of+ False -> _str2Numeric st nexti+ True -> Nothing+ | otherwise = Nothing++cons2' :: Char -> Char -> Lazy.ByteString -> Lazy.ByteString+cons2' c1 c2 s = B.cons' c1 (B.cons' c2 s)++cons3' :: Char -> Char -> Char -> Lazy.ByteString -> Lazy.ByteString+cons3' c1 c2 c3 s = B.cons' c1 (cons2' c2 c3 s)++truncLiterary :: String -> Int -> String+truncLiterary str n = case length str > n of+ True -> take (n - 3) str ++ "..."+ False -> str++truncLiteraryLBS :: Lazy.ByteString -> Int64 -> Lazy.ByteString+truncLiteraryLBS str n = case B.length str > n of+ True -> B.concat [B.take (n - 3) str, B.pack "..."]+ False -> str++-----------------------------+-- few public helpers++dump :: Show a => a -> Int -> IO ()+dump a i = do+ h <- openFile ("./dump.out" ++ show i ++ ".hs") WriteMode+ hPutStr h $ show a+ hClose h++invDump :: Show a => Int -> a -> a+invDump i a = unsafePerformIO $ do+ dump a i+ return a++watch :: Show a => a -> a+watch a = unsafePerformIO $ do+ putStrLn_paged 22 $ show a+ return a++watchCond :: Show a => Bool -> a -> a+watchCond cond = if cond then watch else id++putStrLn_paged :: Int -> String -> IO ()+putStrLn_paged page_size s = f $ lines s+ where+ f lines_list =+ let (to_print, to_next_itera) = splitAt page_size lines_list+ in do putStrLn (concat $ intersperse "\n" to_print)+ case null to_next_itera of+ True -> return ()+ False -> f to_next_itera << hGetChar stdin << putStrLn "\n-------Press any key to continue...-------"++traceShowPaged :: Show a => Int -> a -> b -> b+traceShowPaged n a b = unsafePerformIO $ do+ putStrLn_paged n $ show a+ return b++traceCond :: Show a => Bool -> Int -> a -> b -> b+traceCond cond n a b = if cond then traceShowPaged n a b else b
+ Database/PCLT.hs view
@@ -0,0 +1,15 @@+{- +Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru> + +All rights reserved. + +For license and copyright information, see the file COPYRIGHT +-} + +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- + +module Database.PCLT (module Database.PCLT.UpdatableCatalog, module Database.PCLT.InterfaceWithDB) where + +import Database.PCLT.InterfaceWithDB +import Database.PCLT.UpdatableCatalog
+ Database/PCLT/InterfaceWithDB.hs view
@@ -0,0 +1,274 @@+{- +Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru> + +All rights reserved. + +For license and copyright information, see the file COPYRIGHT +-} + +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- + +{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances, DeriveDataTypeable #-} + +-- | Some instances of 'Database.ReadableFromDB.ReadableFromDB' for reading +-- PCLT catalog and related objects from DB. +-- +-- DBMS is PostgreSQL v8.4. Not earlier, since PCLT-DB relies on a feature that +-- appeared in PostgresSQL only in v8.4. - the @WITH@ clause for @SELECT@ query +-- (also @WITH RECURSIVE@). +module Database.PCLT.InterfaceWithDB where + +import Control.Exception +import Control.Monad +import Data.Char +import Data.List +import qualified Data.Map as M +import Data.Map (Map, (!)) +import Data.Maybe (isNothing) +import Data.MyHelpers +import Data.Either +import Data.Typeable +import Database.HDBC +import Database.HDBC.PostgreSQL +import Database.ReadableFromDB +import Text.PCLT +import Text.PCLT.Config -- for Haddock +import Text.PCLT.MakeCatalog +import Text.PCLT.CatalogFromHSRT +import System.IO +import System.IO.Unsafe + +-- * Instances of ReadableFromDB + +instance ReadableFromDB PCLT_InnerConfig PCLT_CatalogID where + readFromDB db_conn cat_id = handleSql + (\ exc -> return $ wrapParseResult_Nrows cat_id $ liftInList $ Left $ RecieveError_RFDBE (exc :: SqlError)) + (do stmt <- prepare db_conn "SELECT * FROM sch_pcltcatalogs.by_catalog_used_config(?)" + i <- execute stmt [toSql cat_id] + raw_rows <- fetchAllRowsMap' stmt + mapM (parseDBrow db_conn cat_id) raw_rows + ) + parseDBrow db_conn cat_id _row_map = liftM (wrapParseResult_1row cat_id) $ do + let so_f_name = "StrictOrient_ofParamsAndCmpsts_onDfltLngTplsSets" + let loc_takeFieldValue f = takeUFieldValue f (uppercaseMapKeys _row_map) + excpt_or_so <- try (evaluate $ read $ loc_takeFieldValue so_f_name) + return $ case excpt_or_so of + Left e -> Left $ RowParseError_RFDBE $ SomeException $ ErrorCall ("Field '" ++ so_f_name ++ "' of Text.PCLT.Config.PCLT_InnerConfig row parse failed! Lower level exception: " ++ show (e :: SomeException)) + Right so -> Right $ + defaultPCLTInnerConfig { + pcsInnerConfigID = loc_takeFieldValue "tplscat_inner_config_id" + , pcsCompositePlaceholderWrapper = loc_takeFieldValue "CompositePlaceholderWrapper" + , pcsParameterPlaceholderWrapper = loc_takeFieldValue "ParameterPlaceholderWrapper" + , pcsInsuficientDetLevelPlaceholder = loc_takeFieldValue "InsuficientDetLevelPlaceholder" + , pcsMarkingErrorPlaceholderWrapper = loc_takeFieldValue "MarkingErrorPlaceholderWrapper" + , pcsStrictOrient_ofParamsAndCmpsts_onDfltLngTplsSets + = so + , pcsAllowUntemplatedMessages = loc_takeFieldValue "AllowUntemplatedMessages" + , pcsAllowUntemplatedLocalizationsOfMessages + = loc_takeFieldValue "AllowUntemplatedLocalizationsOfMessages" + , pcsShowAdhocParamsInResultOfUntemplated + = loc_takeFieldValue "ShowAdhocParamsInResultOfUntemplated" + , pcsDefaultLanguage = loc_takeFieldValue "DefaultLanguage" + , pcsReparsingDepthMax = loc_takeFieldValue "ReparsingDepthMax" + , pcsReparseParameterContentMaxSize = loc_takeFieldValue "ReparseParameterContentMaxSize" + , pcsInstaniationResultMaxSize = loc_takeFieldValue "InstaniationResultMaxSize" + , pcsAllowEmptySDL_parseItByModusMargin + = loc_takeFieldValue "AllowEmptySDL_parseItByModusMargin" + , pcsAllowUnreadableSDL_parseIdByModusMargin + = loc_takeFieldValue "AllowUnreadableSDL_parseIdByModusMargin" + , pcsNewlineLBS = loc_takeFieldValue "Newline" + } + +-- | Container for data, that is read from DB, that goes on input to +-- catalog formation routine. +newtype RawCatalogDataReadFromDBResult = RawCatalogDataReadFromDBResult (PCLT_RawCatalogData, [AddPCLT_toPCLT_Error]) deriving (Show, Typeable) +instance ReadableFromDB RawCatalogDataReadFromDBResult (PCLT_CatalogID, PCLT_InnerConfig) where + readFromDB db_conn (cat_id, cfg) = handleSql + (\ exc -> return $ wrapParseResult_Nrows cat_id $ liftInList $ Left $ RecieveError_RFDBE (exc :: SqlError)) $ + do let query = "SELECT pclt_id,tpl_req_sdl,lng,structured_text FROM sch_pcltcatalogs.in_catalog_localized_tpls_with_their_sdls(?) ORDER BY pclt_id" + stmt <- prepare db_conn query -- ORDER BY pclt_id is obligate + i <- execute stmt [toSql cat_id] + raw_rows <- fetchAllRowsMap stmt + let f remaining_rows (tpls_accum, errs_accum) = + case remaining_rows of + [] -> (tpls_accum, errs_accum) + (h:t) -> + let tpl_id = takeFieldValue "pclt_id" h + req_sdl = str2PCLT_SDL Required_SDLM (takeFieldValue "tpl_req_sdl" h) cfg + (rows_by_tpl_id, new_remaining_rows) = span (\ _row -> takeFieldValue "pclt_id" _row == tpl_id) t + (of_wrong_sdls, raw_localizations) = partitionEithers $ map --traceCond (tpl_id == "HW" || tpl_id == "E_PCLT_P2TE") 5 "***" $ watchCond (tpl_id == "HW" || tpl_id == "E_PCLT_P2TE") $ + (\ _row -> let sdl2_raw = takeFieldValue "tpl_req_sdl" _row + sdl2 = str2PCLT_SDL Required_SDLM sdl2_raw cfg + in case req_sdl == sdl2 of + True -> Right ( takeFieldValue "lng" _row, takeFieldValue "structured_text" _row ) + False -> Left sdl2 + ) + (h : rows_by_tpl_id) + in f new_remaining_rows + ( M.insert tpl_id (M.fromList raw_localizations, req_sdl) tpls_accum + , errs_accum ++ map (\ sdl2 -> DifferentSDLs_APTTPTE $ DifferentSDLs_PCLTE tpl_id (req_sdl, sdl2) ) of_wrong_sdls + ) + let (raw_data_map, errs) = f raw_rows (M.empty, []) + return $ liftInList $ wrapParseResult_1row (cat_id, cfg) $ Right $ RawCatalogDataReadFromDBResult (PCLT_RawCatalogData raw_data_map, errs) + + parseDBrow _ _ _ = undefined -- doesn't fit for complex cases... + +-- | Container for PCLT catalog, that is read from DB. +newtype CatalogReadFromDBResult = CatalogReadFromDBResult (PCLT_Catalog, [ErrorWithPCSCatalog ReadPCSCatalogError], [AddPCLT_toPCLT_Error]) deriving (Show, Typeable) +instance ReadableFromDB CatalogReadFromDBResult PCLT_CatalogID where + readFromDB db_conn cat_id = do + err_or_inner_cfg <- readOneFromDB db_conn cat_id True + case err_or_inner_cfg of + Left err -> return [wrapParseResult_1row cat_id $ Left $ SubReadError_RFDBE err] + Right inner_cfg -> do + err_or_raw_cat_data <- readOneFromDB db_conn (cat_id, inner_cfg) True + return $ liftInList $ wrapParseResult_1row cat_id $ + case err_or_raw_cat_data of + Left err -> Left $ SubReadError_RFDBE err + Right (RawCatalogDataReadFromDBResult (raw_cat_data, collection_errors)) -> Right $ + let (cat, parse_errs) = readPCLTCatalog inner_cfg cat_id raw_cat_data + in CatalogReadFromDBResult (cat, parse_errs, collection_errors) + parseDBrow _ _ _ = undefined -- doesn't fit for complex cases... + +------------------------------------------------------------------------ +------------------------------------------------------------------------ +------------------------------------------------------------------------ + +-- | Container for a flag, that is read from DB. +-- +-- For each catalog in DB there is stored a special flag \"catalog data +-- or config changed\". The flag gets raised by an army of triggers, +-- that watches every table, and is thought to get dropped by a program, +-- which uses DB catalog. Drop the flag right before catalog update +-- from DB. +-- +-- Unfortunately, the current implementation of this flagging system +-- constraints the number of agents that update their catalogs from DB +-- by only one (because, when agent updates it's catalog, it drops +-- the flag, and other agents don't know that flag was risen, so they +-- can't know if version of catalog in their operative memory is older +-- then in DB or is it not). +-- +-- But this limitation removal is planned as a first ToDo in the next +-- version of PCLT-DB. +newtype CatalogNeedsToBeUpdated_DoesIt = CatalogNeedsToBeUpdated_DoesIt Bool deriving (Typeable,Show) +instance ReadableFromDB CatalogNeedsToBeUpdated_DoesIt PCLT_CatalogID where + readFromDB db_conn cat_id = handleSql + (\ exc -> return $ wrapParseResult_Nrows cat_id $ liftInList $ Left $ RecieveError_RFDBE (exc :: SqlError)) + (do stmt <- prepare db_conn "SELECT cat_new_version_available FROM sch_pcltcatalogs.tpls_catalogs WHERE tpls_catalog_id = ?" + i <- execute stmt [toSql cat_id] + raw_rows <- fetchAllRowsMap' stmt + mapM (parseDBrow db_conn cat_id) raw_rows + ) + parseDBrow db_conn cat_id row_map = + return $ wrapParseResult_1row cat_id $ Right $ CatalogNeedsToBeUpdated_DoesIt $ (takeFieldValue "cat_new_version_available" row_map) + +-- * Drop flag \"catalog data or config changed\" in DB + +-- | Errors that may occur, when performing 'dropFlag_CatalogNeedsToBeUpdated'. +data DropFlag_CatalogNeedsToBeUpdated_Error = + NotModified_DFCNTBUE + | DBError_DFCNTBUE SqlError + deriving (Show, Typeable) +-- | Wrapper around 'DropFlag_CatalogNeedsToBeUpdated_Error', +-- added 'PCLT_CatalogID', for which \"drop flag\" operation failed. +data AddressedDropFlag_CatalogNeedsToBeUpdated_Error = AddressedDropFlag_CatalogNeedsToBeUpdated_Error DropFlag_CatalogNeedsToBeUpdated_Error PCLT_CatalogID deriving (Show, Typeable) + +-- | Drop that flag in DB. +dropFlag_CatalogNeedsToBeUpdated :: Connection -> PCLT_CatalogID -> IO (Maybe AddressedDropFlag_CatalogNeedsToBeUpdated_Error) +dropFlag_CatalogNeedsToBeUpdated db_conn cat_id = + handleSql + (\ exc -> return $ Just $ AddressedDropFlag_CatalogNeedsToBeUpdated_Error (DBError_DFCNTBUE (exc :: SqlError)) cat_id ) + (do r <- run db_conn "UPDATE sch_pcltcatalogs.tpls_catalogs SET cat_new_version_available = FALSE WHERE tpls_catalog_id = ?" [toSql cat_id] + commit db_conn + return $ case r > 0 of + True -> Nothing + False -> Just $ AddressedDropFlag_CatalogNeedsToBeUpdated_Error NotModified_DFCNTBUE cat_id + ) + +-- * Consider catalog update + +-- | The container for all types of errors that may result, when trying +-- to update a catalog from DB. +data CatalogUpdateFromDBErrors = + CatalogUpdateFromDBErrors { + cueDropCNTBUFlag :: Maybe AddressedDropFlag_CatalogNeedsToBeUpdated_Error + , cueARFDBE :: Maybe AddressedReadFromDBError + , cueCatReadErrs :: [ErrorWithPCSCatalog ReadPCSCatalogError] + , cueCollectionErrs :: [AddPCLT_toPCLT_Error] + , cueCatalogID :: PCLT_CatalogID + , cueCatalogRead :: Bool + } + deriving (Show, Typeable) + +-- | Checks if catalog is read without a single error. +emptyCUE :: CatalogUpdateFromDBErrors -> Bool +emptyCUE cue = foldr (\ p_f accum -> accum && p_f cue) True [isNothing . cueDropCNTBUFlag, isNothing . cueARFDBE, null . cueCatReadErrs, null . cueCollectionErrs, cueCatalogRead] + +-- | An empty form to be filled. +defaultCatalogUpdateFromDBErrors :: PCLT_CatalogID -> CatalogUpdateFromDBErrors +defaultCatalogUpdateFromDBErrors cat_id = CatalogUpdateFromDBErrors { + cueDropCNTBUFlag = Nothing + , cueARFDBE = Nothing + , cueCatReadErrs = [] + , cueCollectionErrs = [] + , cueCatalogID = cat_id + , cueCatalogRead = False + } + +-- | There is a one way relation from +-- 'Text.PCLT.CatalogFromHSRT.CatalogFromHSRTInitErrors' +-- to 'CatalogUpdateFromDBErrors'. That's because subject operations are +-- similar it their abstractions. +cfhie2cue :: CatalogFromHSRTInitErrors -> CatalogUpdateFromDBErrors +cfhie2cue cfhie = (defaultCatalogUpdateFromDBErrors $ cfhieCatalogID cfhie) { + cueCatReadErrs = cfhieCatReadErrs cfhie + , cueCollectionErrs = cfhieCollectionErrs cfhie + , cueCatalogRead = True + } + +___always_update = False + +-- | Check if the flag \"catalog data or config changed\" is up in DB. +-- If so, drop it and try to read from DB +-- +-- (1) 'Text.PCLT.Config.PCLT_InnerConfig' +-- +-- (2) 'RawCatalogDataReadFromDBResult' +-- +-- (3) 'CatalogReadFromDBResult' +considerCatalogUpdate :: Connection -> PCLT_CatalogID -> IO (Maybe PCLT_Catalog, Maybe CatalogUpdateFromDBErrors) +considerCatalogUpdate db_conn cat_id = do + err_or_newversion_thereis <- readOneFromDB db_conn cat_id True + case err_or_newversion_thereis of + Left arfdbe -> return (Nothing, Just $ ((defaultCatalogUpdateFromDBErrors cat_id) { cueARFDBE = Just arfdbe })) + Right (CatalogNeedsToBeUpdated_DoesIt newversion_thereis) -> + case newversion_thereis || ___always_update of + False -> return (Nothing, Nothing) + True -> do + mb_err <- dropFlag_CatalogNeedsToBeUpdated db_conn cat_id + let mb_cue = case mb_err of + Just dropflag_err -> Just $ ((defaultCatalogUpdateFromDBErrors cat_id) { cueDropCNTBUFlag = mb_err }) + Nothing -> Nothing + readCat mb_cue + where + readCat mb_cue = do + err_or_cat <- readOneFromDB db_conn cat_id True + return $ case err_or_cat of + Left arfdbe -> + ( Nothing + , liftM (\ cue -> cue { cueARFDBE = Just arfdbe } ) $ Just $ maybe (defaultCatalogUpdateFromDBErrors cat_id) id mb_cue + ) + Right (CatalogReadFromDBResult (cat, cat_read_errs_list, collection_errs)) -> + ( Just cat + , case null cat_read_errs_list && null collection_errs of + True -> (\ cue -> cue { cueCatalogRead = True } ) `liftM` mb_cue + False -> liftM (\ cue -> cue { cueCatalogRead = True + , cueCatReadErrs = cat_read_errs_list + , cueCollectionErrs = collection_errs + } + ) + (Just $ maybe (defaultCatalogUpdateFromDBErrors cat_id) id mb_cue) + ) +
+ Database/PCLT/InterfaceWithDB__.hs view
@@ -0,0 +1,101 @@+{- +Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru> + +All rights reserved. + +For license and copyright information, see the file COPYRIGHT +-} + +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- + +{-# OPTIONS_HADDOCK hide #-} + +module Database.PCLT.InterfaceWithDB__ where + +import qualified Data.ByteString.Lazy.UTF8.Unified as Lazy (ByteString) +import qualified Data.ByteString.Lazy.UTF8.Unified as B hiding (ByteString) +import qualified Data.Map as M +import Data.Map (Map, (!)) +import Text.PCLT.SH__ +import Database.ReadableFromDB__ +import Database.PCLT.InterfaceWithDB + +instance ShowAsPCSI AddressedDropFlag_CatalogNeedsToBeUpdated_Error where + showAsPCSI (AddressedDropFlag_CatalogNeedsToBeUpdated_Error dfcntbue cat_id) = + thePCSI "E_PCLTC_DFCNTBUE" [("pclt_dfcntbue_err_details", PCSI_PV err_pcsi), ("cat_id", PlainText_PV $ show cat_id)] + where + err_pcsi = + case dfcntbue of + NotModified_DFCNTBUE -> + empPCSI "E_PCLTC_DFCNTBUE_NOMODIFY" + DBError_DFCNTBUE sql_err -> + addToPCSI + [showAsPCSI sql_err] + (empPCSI "E_PCLTC_DFCNTBUE_DBERR") + +instance HasStaticRawPCLTs AddressedDropFlag_CatalogNeedsToBeUpdated_Error where + getStaticRawPCLTs inner_cfg _ = flip (,) [] $ + PCLT_RawCatalogData $ M.fromList + [ + ("E_PCLTC_DFCNTBUE", (M.fromList [("rus", B.pack "##|E_PCLTC_DFCNTBUE_PREFIX##|@@|pclt_dfcntbue_err_details@@|."), ("eng", B.pack "##|E_PCLTC_DFCNTBUE_PREFIX##|@@|pclt_dfcntbue_err_details@@|.")], str2PCLT_SDL Required_SDLM "##|LLEXCPT##|" inner_cfg)) + , ("E_PCLTC_DFCNTBUE_PREFIX", (M.fromList [("rus", B.pack "Произошла ошибка при попытке спустить флаг сигнализирующий о том, что доступна новая версия каталога [ИД: @@|cat_id@@|]: "), ("eng", B.pack "An error occured when trying to drop flag, which signalizes, that there is a new catalog [ID: @@|cat_id@@|] version is available:")], str2PCLT_SDL Required_SDLM "##|E_PCLTC_DFCNTBUE##|" inner_cfg)) + , ("E_PCLTC_DFCNTBUE_NOMODIFY", (M.fromList [("rus", B.pack "запрос в БД на изменение таблицы содержащей флаг выполнен без ошибок, но и СУДБ отметила, что никакие данные не подвергались изменениям"), ("eng", B.pack "modifying DB query was executed without errors, however DBMS returned, that no row was actually modified")], str2PCLT_SDL Required_SDLM "##|E_PCLTC_DFCNTBUE##|" inner_cfg)) + , ("E_PCLTC_DFCNTBUE_DBERR", (M.fromList [("rus", B.pack "##|DB_ERROR##|"), ("eng", B.pack "##|DB_ERROR##|")], str2PCLT_SDL Required_SDLM "##|E_PCLTC_DFCNTBUE##|" inner_cfg)) + ] + +--------------------------------- + +instance ShowAsPCSI CatalogUpdateFromDBErrors where + showAsPCSI cue = + thePCSI + "E_PCLTC_CUE" + [ ("pclt_cue_err_details", PCSIList_PV err_pcsi_list Nothing_PV) + , ("cat_id" , PlainText_PV $ show $ cueCatalogID cue) + , ("cat_read_wasit" , PCSI_PV $ showAsPCSI $ cueCatalogRead cue) + ] + where + err_pcsi_arfdbe = case cueARFDBE cue of + Nothing -> [] + Just arfdbe -> [thePCSI "E_PCLTC_CUE_ARFDBE" [("arfdbe", Indented_PV 4 $ PCSI_PV $ showAsPCSI arfdbe)]] + err_pcsi_dfcntbue = case cueDropCNTBUFlag cue of + Nothing -> [] + Just dfcntbue -> [thePCSI "E_PCLTC_CUE_DFCNTBUE" [("dfcntbue", Indented_PV 4 $ PCSI_PV $ showAsPCSI dfcntbue)]] + err_pcsi_rpcsce_l = case cueCatReadErrs cue of + [] -> [] + l -> [thePCSI "E_PCLTC_CUE_RLATCE_L" [("cre_list", Indented_PV 4 $ PCSIList_PV (map showAsPCSI l) usualSeparatorInPCSIList)]] + err_pcsi_cole_l = case cueCollectionErrs cue of + [] -> [] + l -> [thePCSI "E_PCLTC_CUE_APTTPTE_L" [("cole_list", Indented_PV 4 $ PCSIList_PV (map showAsPCSI l) usualSeparatorInPCSIList)]] + err_pcsi_list = err_pcsi_arfdbe ++ err_pcsi_dfcntbue ++ err_pcsi_cole_l ++ err_pcsi_rpcsce_l + +instance HasStaticRawPCLTs CatalogUpdateFromDBErrors where + getStaticRawPCLTs inner_cfg _ = flip (,) [] $ + PCLT_RawCatalogData $ M.fromList + [ + ("E_PCLTC_CUE", (M.fromList [("rus", B.pack "##|E_PCLTC_CUE_PREFIX##| @@|pclt_cue_err_details@@|\n##|E_PCLTC_CUE_POSTFIX##|"), ("eng", B.pack "##|E_PCLTC_CUE_PREFIX##|@@|pclt_cue_err_details@@|\n##|E_PCLTC_CUE_POSTFIX##|")], str2PCLT_SDL Required_SDLM "##|LLEXCPT##|" inner_cfg)) + , ("E_PCLTC_CUE_PREFIX", (M.fromList [("rus", B.pack "Произошла одна или несколько ошибок при попытке обновить оперативную версию каталога [ИД: @@|cat_id@@|] (исторник обновления: БД): "), ("eng", B.pack "One or more errors occurred when trying to update operative version of catalog [ID: @@|cat_id@@|] (update source: DB):")], str2PCLT_SDL Required_SDLM "##|E_PCLTC_CUE##|" inner_cfg)) + , ("E_PCLTC_CUE_ARFDBE", (M.fromList [("rus", B.pack "\n ** Ошибка чтения из БД: @@|arfdbe@@|"), ("eng", B.pack "\n ** An error, when reading from DB: @@|arfdbe@@|")], str2PCLT_SDL Required_SDLM "##|E_PCLTC_CUE##|" inner_cfg)) + , ("E_PCLTC_CUE_DFCNTBUE", (M.fromList [("rus", B.pack "\n ** Ошибка сброса флага новой версии каталога: @@|dfcntbue@@|"), ("eng", B.pack "\n ** An error, when dropping a flag of a new catalog version: @@|dfcntbue@@|")], str2PCLT_SDL Required_SDLM "##|E_PCLTC_CUE##|" inner_cfg)) + , ("E_PCLTC_CUE_RLATCE_L", (M.fromList [("rus", B.pack "\n ** Ошибки чтения и формирования каталога: @@|cre_list@@|"), ("eng", B.pack "\n ** Catalog parsing errors: @@|cre_list@@|")], str2PCLT_SDL Required_SDLM "##|E_PCLTC_CUE##|" inner_cfg)) + , ("E_PCLTC_CUE_APTTPTE_L", (M.fromList [("rus", B.pack "\n ** Ошибки сборки множества шаблонов, из которых необходимо сформировать каталог: @@|cole_list@@|"), ("eng", B.pack "\n ** Errors of collecting templates for catalog formation input: @@|cole_list@@|")], str2PCLT_SDL Required_SDLM "##|E_PCLTC_CUE##|" inner_cfg)) + , ("E_PCLTC_CUE_POSTFIX", (M.fromList [("rus", B.pack "Каталог считан: @@|cat_read_wasit@@|"), ("eng", B.pack "Catalog loaded: @@|cat_read_wasit@@|")], str2PCLT_SDL Required_SDLM "##|E_PCLTC_CUE##|" inner_cfg)) + + -- These \/ templates ar not for content but for representation requirement referencing that determines "ARFDBE" group templates requirements + , ("ARFDBE_SDLR.Text.PCLT.Config.PCLT_InnerConfig", (M.fromList [("rus", B.empty), ("eng", B.empty)], str2PCLT_SDL Required_SDLM "##|E_PCLTC_CUE_ARFDBE##|" inner_cfg)) + , ("ARFDBE_SDLR.Database.PCLT.InterfaceWithDB.RawCatalogDataReadFromDBResult", (M.fromList [("rus", B.empty), ("eng", B.empty)], str2PCLT_SDL Required_SDLM "##|E_PCLTC_CUE_ARFDBE##|" inner_cfg)) + , ("ARFDBE_SDLR.Database.PCLT.InterfaceWithDB.CatalogReadFromDBResult", (M.fromList [("rus", B.empty), ("eng", B.empty)], str2PCLT_SDL Required_SDLM "##|E_PCLTC_CUE_ARFDBE##|" inner_cfg)) + , ("ARFDBE_SDLR.Database.PCLT.InterfaceWithDB.CatalogNeedsToBeUpdated_DoesIt", (M.fromList [("rus", B.empty), ("eng", B.empty)], str2PCLT_SDL Required_SDLM "##|E_PCLTC_CUE_ARFDBE##|" inner_cfg)) + ] + +data PCLTRawCatalog__Database_PCLT_InterfaceWithDB = PCLTRawCatalog__Database_PCLT_InterfaceWithDB +instance HasStaticRawPCLTs PCLTRawCatalog__Database_PCLT_InterfaceWithDB where + widenessOfStaticRawPCLTsSet _ = Module_RPSW + getStaticRawPCLTs inner_cfg _ = + mergeRawCatalogDataSets2 True + [ + getStaticRawPCLTs inner_cfg (undefined :: AddressedDropFlag_CatalogNeedsToBeUpdated_Error) + , getStaticRawPCLTs inner_cfg (undefined :: CatalogUpdateFromDBErrors) + , getStaticRawPCLTs inner_cfg (undefined :: PCLTRawCatalog__Database_ReadableFromDB) + ] +
+ Database/PCLT/UpdatableCatalog.hs view
@@ -0,0 +1,148 @@+{- +Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru> + +All rights reserved. + +For license and copyright information, see the file COPYRIGHT +-} + +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- + +-- | A module around a thread that considers updating catalog, when commanded +-- to do so. +module Database.PCLT.UpdatableCatalog where + +import Control.Concurrent +import Control.Exception +import Data.List +import qualified Data.Map as M +import Data.Map (Map, (!)) +import Data.Maybe +import Data.MyHelpers +import Data.Either +import Database.HDBC +import Database.HDBC.PostgreSQL +import Database.PCLT.InterfaceWithDB +import Text.PCLT +import Text.PCLT.Catalog +import Text.PCLT.Config + +import Database.ReadableFromDB__ +import Database.PCLT.InterfaceWithDB__ +import Text.PCLT.HasStaticRawPCLTs +import Text.PCLT.InitialDefaultCatalog (PCLTRawCatalog__Text_PCLT_InitialDefaultCatalog) + +-- | This type is a special instance of 'HasStaticRawPCLTs' - it accumulates +-- all other instances of 'HasStaticRawPCLTs' from the whole PCLT-DB package, +-- and also from PCLT package. +-- +-- This instance is best to be used as an intial input for the catalog +-- formation in your applications. +data PCLTRawCatalog__Database_PCLT_UpdatableCatalog = PCLTRawCatalog__Database_PCLT_UpdatableCatalog +instance HasStaticRawPCLTs PCLTRawCatalog__Database_PCLT_UpdatableCatalog where + widenessOfStaticRawPCLTsSet _ = Package_RPSW + getStaticRawPCLTs inner_cfg _ = + mergeRawCatalogDataSets2 True + [ getStaticRawPCLTs inner_cfg (undefined :: PCLTRawCatalog__Text_PCLT_InitialDefaultCatalog) + , getStaticRawPCLTs inner_cfg (undefined :: PCLTRawCatalog__Database_PCLT_InterfaceWithDB) + , getStaticRawPCLTs inner_cfg (undefined :: PCLTRawCatalog__Database_ReadableFromDB) + ] + +-- | Input contains current catalog version. If the update failed +-- and returned no new catalog version, or if update isn't needed, +-- then current catalog version is returned. +-- +-- If there appeared any errors, they get acted with. The action is +-- specified by user. +catalogUpdatorIteration :: Connection -> PCLT_CatalogID -> (PCLT_Catalog -> CatalogUpdateFromDBErrors -> IO ()) -> PCLT_Catalog -> IO (Maybe PCLT_Catalog) +catalogUpdatorIteration db_conn cat_id errorsReporter old_cat = do + (mb_new_catalog, mb_cu_errors) <- considerCatalogUpdate db_conn cat_id + case mb_cu_errors of + Just cue -> + case emptyCUE cue of -- double work here with "maybe empty ..."; well... lazy to reduce it + False -> errorsReporter (maybe old_cat id mb_new_catalog) cue + True -> return () + Nothing -> return () + return mb_new_catalog + +-- | Type alias used by 'runCatalogUpdatorService'. +type DisconnectDBConnWhenFinished_shouldwe = Bool +-- | Type alias used by 'runCatalogUpdatorService'. +type MakeIterationAndContinueCycle_shouldwe = Bool + +-- | The first version of catalog, that service forms is always +-- from nonDB source, but is from specified in the first triple +-- /(catalog ID, config and some instance of HasStaticRawPCLTs)/. +-- That way, even if DB never responds, service always +-- has at least this version of catalog available. +-- +-- In the 3rd argument user specifies action, that has a role of errors +-- processor (reporter). +-- +-- The 4th argument is a @Chan@, which this service listens to. +-- +-- * If @True@ comes, service makes iteration (reads catalog from DB if needed, +-- and writes new version into the MVar), and continues cycle. +-- +-- * If @False@ comes, service stops. +-- +-- The returned MVar is created by service itself and is a container, +-- where it keeps last version of catalog. +runCatalogUpdatorService + :: HasStaticRawPCLTs a + => (PCLT_CatalogID, PCLT_InnerConfig, a) + -> (Connection, DisconnectDBConnWhenFinished_shouldwe) + -> (PCLT_Catalog -> CatalogUpdateFromDBErrors -> IO ()) + -> Chan MakeIterationAndContinueCycle_shouldwe + -> IO (MVar PCLT_Catalog, ThreadId) +runCatalogUpdatorService + (cat_id, inner_config, instance_of_hasStaticRawPCLTs) + (db_conn, disconnectDBConWhenFinished_shouldwe) + errorsReporter + aliveChan = do + cat_mv <- let (cat, cfhie) = initCatalogFromHSRT instance_of_hasStaticRawPCLTs inner_config cat_id + cue = cfhie2cue cfhie + in newMVar cat << case emptyCUE cue of + False -> errorsReporter cat cue + True -> return () + updator_TID <- forkIO $ do + let dbFinalizer = + case disconnectDBConWhenFinished_shouldwe of + True -> disconnect db_conn + False -> return () + let serviceCycle :: IO () + serviceCycle = do + continue_shouldwe <- readChan aliveChan + case continue_shouldwe of + False -> return () -- service finish + True -> do + old_cat <- readMVar cat_mv + mb_new_cat <- catalogUpdatorIteration db_conn cat_id errorsReporter old_cat + case mb_new_cat of + Just new_catalog -> modifyMVar_ cat_mv (\ _ -> return new_catalog) + Nothing -> return () + serviceCycle + finally serviceCycle dbFinalizer + return (cat_mv, updator_TID) + +-- | Wrapper around 'runCatalogUpdatorService'. The service starts from +-- default config ('Text.PCLT.Config.defaultPCLTInnerConfig') and +-- default set of templates ('PCLTRawCatalog__Database_PCLT_UpdatableCatalog'). +-- But updates from DB orienting on given 'Text.PCLT.Catalog.PCLT_CatalogID', +-- which may be different set of templates and different config. +runCatalogUpdatorService_wDefaultInitial + :: PCLT_CatalogID + -> (Connection, DisconnectDBConnWhenFinished_shouldwe) + -> (PCLT_Catalog -> CatalogUpdateFromDBErrors -> IO ()) + -> Chan MakeIterationAndContinueCycle_shouldwe + -> IO (MVar PCLT_Catalog, ThreadId) +runCatalogUpdatorService_wDefaultInitial cat_id (db_conn, disconnectDBConWhenFinished_shouldwe) errorsReporter aliveChan = + runCatalogUpdatorService + ( cat_id + , defaultPCLTInnerConfig + , PCLTRawCatalog__Database_PCLT_UpdatableCatalog + ) + (db_conn, disconnectDBConWhenFinished_shouldwe) + errorsReporter + aliveChan
+ Database/ReadableFromDB.hs view
@@ -0,0 +1,136 @@+{- +Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru> + +All rights reserved. + +For license and copyright information, see the file COPYRIGHT +-} + +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- + +{-# LANGUAGE MultiParamTypeClasses, DeriveDataTypeable, FlexibleContexts #-} + +-- | An attemt of generalization of \"read from DB\" operation. +module Database.ReadableFromDB where + +import Control.Exception +import Data.Convertible +import Data.Char +import qualified Data.Map as M +import Data.Map (Map, (!)) +import Data.MyHelpers +import Data.Typeable +import Database.HDBC +import Database.HDBC.PostgreSQL + +-- * ReadableFromDB + +type FieldName = String +-- | Type aliase for use by 'readOneFromDB'. +type NoMoreThanOne_shoulditbe = Bool + +-- | It's recommended to use newtypes for subject type variable (\"readable\"), +-- when it is composite (like tuple, Either, Map or other). Reason for that +-- is described near the 'ShowAsPCSI' instaniation +-- for 'AddressedReadFromDBError'. +class (Typeable readable, Show pk) => ReadableFromDB readable pk where + -- | Read rows from DB and parse each at once + -- using 'parseDBrow' class method + readFromDB :: Connection -> pk -> IO [Either AddressedReadFromDBError readable] + parseDBrow :: Connection -> pk -> Map FieldName SqlValue -> IO (Either AddressedReadFromDBError readable) + -- | Class method derived from 'readFromDB' and 'parseDBrow'. + -- No need to overload it, if not for special cases. + readOneFromDB :: Connection -> pk -> NoMoreThanOne_shoulditbe -> IO (Either AddressedReadFromDBError readable) + readOneFromDB db_conn pk nomorethanone_shoulditbe = do + results_list <- readFromDB db_conn pk + return $ + case results_list of + [] -> wrapParseResult_1row pk $ Left NotFoundInDB_RFDBE + err_or_readable : [] -> err_or_readable + err_or_readable : _ -> case nomorethanone_shoulditbe of + True -> wrapParseResult_1row pk $ Left $ TooManyResultsFoundInDB_RFDBE 1 + False -> err_or_readable + +-- | Type aliase for use by 'TooManyResultsFoundInDB_RFDBE'. +type AllowedMaximumOfRowsCount = Int +-- | What kind of errors are possible in the result +-- of \"read from DB\" operation +data ReadFromDBError = + RecieveError_RFDBE SqlError + | NotFoundInDB_RFDBE + | TooManyResultsFoundInDB_RFDBE AllowedMaximumOfRowsCount + | RowParseError_RFDBE SomeException + | SubReadError_RFDBE AddressedReadFromDBError + deriving (Show, Typeable) + +-- | A wrapper around 'ReadFromDBError', added information about type of +-- read subject and by showing the primary key. +-- +-- ___________ +-- +-- If PCLT is to be used for representation of 'AddressedReadFromDBError' +-- then user must declare an additional localizable template in his PCLT +-- catalog with ID of form: +-- +-- @\"ARFDBE_SDLR.\" ++ (show $ 'arfdbeEntityType' err)@ +-- +-- , where the @show 'arfdbeEntityType'@ will include full modules path +-- of type. The templete content if not important - leave it empty, but what +-- is important - is it's SDL requirement. This SDL requirement wil be in +-- effect for the representation of 'AddressedReadFromDBError'. +-- +-- For more information on that, see description for @ShowAsPCSI@ instance for +-- 'AddressedReadFromDBError' - in module "Database.ReadableFromDB__". +data AddressedReadFromDBError = AddressedReadFromDBError { + arfdbeEntityType :: TypeRep + , arfdbePK :: String + , arfdbeErr :: ReadFromDBError + } deriving (Show, Typeable) + +-- | In case of error it wraps it 'ReadFromDBError' +-- into 'AddressedReadFromDBError'. +wrapParseResult_1row :: (Typeable readable, Show pk) => pk -> Either ReadFromDBError readable -> Either AddressedReadFromDBError readable +wrapParseResult_1row pk err_or_readable = + case err_or_readable of + Right readable -> Right readable + Left err -> Left AddressedReadFromDBError { + arfdbeEntityType = rightType_formReadResOrErr err_or_readable + , arfdbePK = show pk + , arfdbeErr = err + } + +-- | Wrapper around 'wrapParseResult_1row'. +wrapParseResult_Nrows :: (Typeable a, Show pk) => pk -> [Either ReadFromDBError a] -> [Either AddressedReadFromDBError a] +wrapParseResult_Nrows pk err_or_a__list = map (wrapParseResult_1row pk) err_or_a__list + +----------------------------------------------- +-- * Helpers + +-- | Return the 'TypeRep' of what can be under @Right@ in @Either@ +rightType_formReadResOrErr :: (Typeable left, Typeable right) => Either left right -> TypeRep +rightType_formReadResOrErr left_or_right = let _ : right_type : [] = typeRepArgs (typeOf left_or_right) in right_type + +-- | This is better than @row ! field_name@, because if an error occurs +-- (field not found), then it returns in error message this field name. +takeFieldValue :: Convertible SqlValue a => FieldName -> Map FieldName SqlValue -> a +takeFieldValue f_name row_map = + let mb_sqlv = M.lookup f_name row_map + in case mb_sqlv of + Just v -> fromSql v + Nothing -> error ("Function 'takeFieldValue' failed!\nField '" ++ f_name ++ "' not found.\nRow: " ++ show row_map) + +-- | Uppercase given field name, and apply it with 'takeFieldValue'. +takeUFieldValue :: Convertible SqlValue a => FieldName -> Map FieldName SqlValue -> a +takeUFieldValue f_name row_map = takeFieldValue (map toUpper f_name) row_map + +-- | WARNING !!! +-- HDBC lowercases field names, when using @fetchAllRowsMap@. +uppercaseMapKeys :: Map String a -> Map String a +uppercaseMapKeys = M.mapKeys (map toUpper) + +-- | +-- +-- > liftInList a = a : [] +liftInList :: a -> [a] +liftInList a = a : []
+ Database/ReadableFromDB__.hs view
@@ -0,0 +1,104 @@+{- +Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru> + +All rights reserved. + +For license and copyright information, see the file COPYRIGHT +-} + +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- + +-- | For representation of 'AddressedReadFromDBError' a special trick is used. +-- SDL requirements for representation of error is referenced to be +-- the same as specified for template with such ID: +-- +-- @\"ARFDBE_SDLR.\" ++ (show \$ 'arfdbeEntityType' err)@ +-- +-- So, whenever an instance of 'Database.ReadableFromDB.ReadableFromDB' +-- is declared, in order to make 'AddressedReadFromDBError' show correctly, +-- developer must also add an empty template with corresponding ID to PCLT +-- catalog. +-- +-- For example, template with ID +-- @\"ARFDBE_SDLR.Text.PCLT.Config.PCLT_InnerConfig\"@ is to be added, when +-- @PCLT_InnerConfig@ is made an instance of +-- 'Database.ReadableFromDB.ReadableFromDB'. +-- The content of this template is not important - just leave it empty, it's +-- never shown. Only it's SDL requirement is important and is used. +-- +-- In order to keep @(show \$ 'arfdbeEntityType' err)@ string as short +-- as possible it's recommended to use @newtype@, when type is composite, +-- like tuple, Either, Map etc. +module Database.ReadableFromDB__ where + +import qualified Data.ByteString.Lazy.UTF8.Unified as Lazy (ByteString) +import qualified Data.ByteString.Lazy.UTF8.Unified as B hiding (ByteString) +import qualified Data.Map as M +import Data.Map (Map, (!)) +import Data.Typeable +import Database.HDBC +import Database.HDBC.PostgreSQL +import Database.ReadableFromDB +import Text.PCLT.SH__ +import Text.PCLT.ShowAsPCSI__ + +instance ShowAsPCSI SqlError where + showAsPCSI e = + thePCSI + "DB_ERROR" + [ ("seState" , PlainText_PV $ seState e) + , ("seNativeError", PlainText_PV $ show $ seNativeError e) + , ("seErrorMsg" , PlainText_PV $ seErrorMsg e) + ] + +instance ShowAsPCSI AddressedReadFromDBError where + showAsPCSI err = + let err_pcsi = + case arfdbeErr err of + RecieveError_RFDBE e -> + addToPCSI [showAsPCSI e] (empPCSI "ARFDBE_DET_RCVERR") + NotFoundInDB_RFDBE -> + empPCSI "ARFDBE_DET_NOTFND" + TooManyResultsFoundInDB_RFDBE max_rows_count -> + thePCSI "ARFDBE_DET_TOOMUCHRES" [("max_rows_count", PlainText_PV $ show max_rows_count)] + RowParseError_RFDBE e -> + addToPCSI [showAsPCSI e] (empPCSI "ARFDBE_DET_PARSERR") + SubReadError_RFDBE arfdbe -> + thePCSI "ARFDBE_DET_SUBREADE" [("sub_arfdbe", PCSI_PV $ showAsPCSI arfdbe)] + ------------------------------------- + sdl_reference = ("sdl_reference", PCSI_PV $ empPCSI $ (++) "ARFDBE_SDLR." $ show $ arfdbeEntityType err) + -- Some thoughts about usage of (Show TypeRep) here: + -- 1) Remember. It ignores type synonyms. F.e. no String, but [Char] must be used, orelse (even better) wrap it into newtype + -- 2) Making PCSI ID "ARFDBE_SDLR.(Type1, Type2)" is WRONG - tuple is shown with no whitespace after comma + -- 3) Nonptelude types are shown with module path. So template ID "ARFDBE_SDLR.AddressedReadFromDBError" is wrong - it must be "ARFDBE_SDLR.Database.ReadableFromDB.AddressedReadFromDBError" + -- 4) Assumming (1) and (3), it's highly recommended to use newtypes for complex target types of ReadFromDB, like tuples or others. + in thePCSI + "ARFDBE" + [ ("read_object_type" , PlainText_PV $ show $ arfdbeEntityType err) + , ("arfdbe_err_details", PCSI_PV $ addPVs2PCSI [sdl_reference] err_pcsi) -- << notice: have to duplicate sdl_reference, since PCSI_PV separates valuespaces of paremeters + , ("obj_pk" , PlainText_PV $ arfdbePK err) + , sdl_reference + ] + + + +data PCLTRawCatalog__Database_ReadableFromDB = PCLTRawCatalog__Database_ReadableFromDB +instance HasStaticRawPCLTs PCLTRawCatalog__Database_ReadableFromDB where + getStaticRawPCLTs inner_cfg _ = flip (,) [] $ + PCLT_RawCatalogData $ M.fromList + [ + ("DB_ERROR", (M.fromList [("rus", B.pack "Провал операции в связи с БД. Состояние: \"@@|seState@@|\". Уровень: @@|seNativeError@@|. Сообщение: \"@@|seErrorMsg@@|\"."), ("eng", B.pack "Operation with DB failed. State: \"@@|seState@@|\". Layer: @@|seNativeError@@|. Message: \"@@|seErrorMsg@@|\".")], str2PCLT_SDL Required_SDLM "##|LLEXCPT##|" inner_cfg)) + + , ("ARFDBE", (M.fromList [("rus", B.pack "Ошибка при чтении объекта из БД. ##|ARFDBE_OBJ_TYPE##| ##|ARFDBE_OBJ_PK##| ##|ARFDBE_DET##|"), ("eng", B.pack "An error occurred, when tried to read an object from DB. ##|ARFDBE_OBJ_TYPE##| ##|ARFDBE_OBJ_PK##| ##|ARFDBE_DET##|")], str2PCLT_SDL Required_SDLM "##|ARFDBE_DET##|" inner_cfg)) + , ("ARFDBE_OBJ_TYPE", (M.fromList [("rus", B.pack "Тип объекта: @@|read_object_type@@|."), ("eng", B.pack "Object type: @@|read_object_type@@|.")], str2PCLT_SDL Required_SDLM "##|ARFDBE##|" inner_cfg)) + , ("ARFDBE_SDLR", (M.fromList [("rus", B.pack "@@|sdl_reference@@|"), ("eng", B.pack "@@|sdl_reference@@|")], str2PCLT_SDL Required_SDLM "@@|sdl_reference@@|" inner_cfg)) + , ("ARFDBE_OBJ_PK", (M.fromList [("rus", B.pack "Первичный ключ: @@|obj_pk@@|."), ("eng", B.pack "Object primary key: @@|obj_pk@@|.")], str2PCLT_SDL Required_SDLM "##|ARFDBE_SDLR##|" inner_cfg)) + , ("ARFDBE_DET", (M.fromList [("rus", B.pack "@@|arfdbe_err_details@@|"), ("eng", B.pack "@@|arfdbe_err_details@@|")], str2PCLT_SDL Required_SDLM "##|ARFDBE_SDLR##|" inner_cfg)) + , ("ARFDBE_DET_RCVERR", (M.fromList [("rus", B.pack "##|DB_ERROR##|"), ("eng", B.pack "##|DB_ERROR##|")], str2PCLT_SDL Required_SDLM "##|DB_ERROR##|" inner_cfg)) + , ("ARFDBE_DET_NOTFND", (M.fromList [("rus", B.pack "Объект не найден!"), ("eng", B.pack "Object not found!")], str2PCLT_SDL Required_SDLM "##|ARFDBE_DET##|" inner_cfg)) + , ("ARFDBE_DET_TOOMUCHRES", (M.fromList [("rus", B.pack "Запрос к БД вернул слишком много результатов, при допустимом максимуме - @@|max_rows_count@@| строк."), ("eng", B.pack "DB query returned too many rows. Allowed rows count maximum is @@|max_rows_count@@|.")], str2PCLT_SDL Required_SDLM "##|ARFDBE_DET##|" inner_cfg)) + , ("ARFDBE_DET_PARSERR", (M.fromList [("rus", B.pack "Провал перевода данных из формата БД в оперативный формат: ##|LLEXCPT##|"), ("eng", B.pack "Failed to parse object data from DB format to operative one: ##|LLEXCPT##|")], str2PCLT_SDL Required_SDLM "##|ARFDBE_DET##|" inner_cfg)) + , ("ARFDBE_DET_SUBREADE", (M.fromList [("rus", B.pack "Провал подоперации, которая также связана с чтением из БД: @@|sub_arfdbe@@|"), ("eng", B.pack "Subroutine, that is also about reading from DB, failed: @@|sub_arfdbe@@|")], str2PCLT_SDL Required_SDLM "##|ARFDBE_DET##|" inner_cfg)) + ] + widenessOfStaticRawPCLTsSet _ = Module_RPSW
+ PCLT-DB.cabal view
@@ -0,0 +1,105 @@+Name: PCLT-DB+Synopsis: + An addon to PCLT package: enchance PCLT catalog with PostgreSQL powers.+Description:+ \"PCLT\" is an abbreviation for \"Parametric Composable Localizable + Templates\" - in fact it should also hold Detalizable. + Term \"Detailizable content (message)\" in this package + has a following meaning: some content, representing which + it is possible to regulate, in how much details it is represented.+ .+ Conceptually, this package is a powerful extension to the well known + Show class, that (extension) is thought to be embeded in any + Haskell program, which requires multilanguage support, and/or where + messages should be detailizable. + .+ For more information about PCLT, read in it's description in it's own + Cabal file.+ .+ _________+ .+ By the base package (PCLT) the templates are provided to be stored + statically in module declarations using + 'Text.PCLT.HasStaticRawPCLTs.HasStaticRawPCLTs' class instaniations. + .+ The PCST-DB package adds a possibility to store templates in DB + (under PostgreSQL v8.4. (not less)). + .+ The following units are storable in DB:+ .+ * localizable templates + .+ * localized templates+ .+ * languages+ .+ * collections of localizable templates + .+ * collections (of localizable templates) compositions+ .+ * catalogs+ .+ * configurations of PCLT catalogs+ .+ * localizable templates detalization policies + .+ For each catalog in DB there is stored a special flag \"catalog data+ or config changed\". The flag gets raised by an army of triggers, + that watches every table, and is thought to get dropped by a program, + which uses DB catalog. Drop the flag right before catalog update + from DB.+ .+ Unfortunately, the current implementation of this flagging system + constraints the number of agents that update their catalogs from DB + by only one (because, when agent updates it's catalog, it drops + the flag, and other agents don't know that flag was risen, so they + can't know if version of catalog in their operative memory is older + then in DB or not).+ .+ But this limitation removal is planned as a first ToDo in the next + version of PCLT-DB.+Version: 0.1+Copyright: Copyright (c) 2009 Andrejs Sisojevs+License: LGPL+License-File: COPYRIGHT+Author: Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru>+Maintainer: Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru>+Stability: alpha+Homepage: http://github.com/Andrey-Sisoyev/PCLT-DB+Category: Database+Tested-With: GHC == 6.10.4+Cabal-Version: >= 1.6+Build-Type: Simple++Extra-Source-Files:+ COPYRIGHT+ COPYING+ doinst.sh+ db/db_inst.sh+ db/data.sql+ db/pclt.sql+ db/pclt_meta.sql+ db/view.sql+ db/local_test/tests.sql+ initial_data/PCLT-DB.PCLTCatalog.ods+ models/PCLT-DB.ERD.v0.1.odg+ models/PCLT-DB.ERD.v0.1.odg.png + examples/HelloWorld/HelloWorld.hs+ examples/HelloWorld/HelloWorld__.hs+ examples/HelloWorld/HelloWorld_Data.hs+ examples/HelloWorld/HelloWorld.PCLTCatalog.ods+ examples/HelloWorld/HelloWorld.sql++Library+ Build-Depends:+ base >= 4 && < 5, bytestring, containers, convertible, mtl, HDBC, HDBC-postgresql, PCLT+ Exposed-Modules:+ Database.ReadableFromDB+ Database.ReadableFromDB__+ Database.PCLT+ Database.PCLT.InterfaceWithDB+ Database.PCLT.InterfaceWithDB__+ Database.PCLT.UpdatableCatalog+ Other-Modules:+ Data.MyHelpers+ Data.MyHelpers_
+ Setup.hs view
@@ -0,0 +1,4 @@+#!/usr/bin/env runghc++import Distribution.Simple+main = defaultMain
+ db/data.sql view
@@ -0,0 +1,616 @@+-- Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru> +-- +-- All rights reserved. +-- +-- For license and copyright information, see the file COPYRIGHT + +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- + +INSERT INTO tpls (pclt_id) VALUES('TRUE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'TRUE', 'ДА'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'TRUE', 'TRUE'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (1,'TRUE','one'); +INSERT INTO tpls (pclt_id) VALUES('FALSE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'FALSE', 'НЕТ'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'FALSE', 'FALSE'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (1,'FALSE','##|TRUE##|'); + +INSERT INTO tpls (pclt_id) VALUES('MAYBE_A'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'MAYBE_A', '@@|maybe_cnstr@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'MAYBE_A', '@@|maybe_cnstr@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (1,'MAYBE_A','##|TRUE##|'); +INSERT INTO tpls (pclt_id) VALUES('MAYBE_JUST'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'MAYBE_JUST', '@@|a@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'MAYBE_JUST', '@@|a@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (1,'MAYBE_JUST','##|MAYBE_A##|'); +INSERT INTO tpls (pclt_id) VALUES('MAYBE_NOTHING'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'MAYBE_NOTHING', 'ничего'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'MAYBE_NOTHING', 'nothing'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (1,'MAYBE_NOTHING','##|MAYBE_A##|'); + +INSERT INTO tpls (pclt_id) VALUES('LLEXCPT'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'LLEXCPT', 'Программное исключение, детали: "@@|excpt_msg@@|"'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'LLEXCPT', 'Program exception, details: "@@|excpt_msg@@|"'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (1,'LLEXCPT','1000'); + +INSERT INTO tpls (pclt_id) VALUES('EMAIL_RECEPIENT_NAME'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'EMAIL_RECEPIENT_NAME', 'Имя получателя: @@|recepient_name@@|. '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'EMAIL_RECEPIENT_NAME', 'Recepient name: @@|recepient_name@@|. '); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (3,'EMAIL_RECEPIENT_NAME','1000'); +INSERT INTO tpls (pclt_id) VALUES('EMAIL_RECEPIENT_EMADDR'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'EMAIL_RECEPIENT_EMADDR', 'Э-Почтовый адрес получателя: @@|recepient_addr@@|. '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'EMAIL_RECEPIENT_EMADDR', 'Recepient email address: @@|recepient_addr@@|. '); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (3,'EMAIL_RECEPIENT_EMADDR','##|EMAIL_RECEPIENT_NAME##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_P2TE_LIST'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_P2TE_LIST', '##|E_PCLT_P2TE_LIST_PREFIX##|\n@@|errors_list@@|\n##|E_PCLT_P2TE_LIST_POSTFIX##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_P2TE_LIST', '##|E_PCLT_P2TE_LIST_PREFIX##|\n@@|errors_list@@|\n##|E_PCLT_P2TE_LIST_POSTFIX##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_P2TE_LIST','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_P2TE_LIST_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_P2TE_LIST_PREFIX', '----СЛЕЛУЮЩИЕ-ОШИБКИ-ВОЗНИКЛИ-ПРИ-ГЕНЕРАЦИИ-СООБЩЕНИЙ ИЗ-ШАБЛОНОВ----\n'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_P2TE_LIST_PREFIX', '----FOLLOWING-ERRORS-OCCURED-WHEN-GENERATING-MESSAGES-FROM-TEMPLATES----------\n'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_P2TE_LIST_PREFIX','##|E_PCLT_P2TE_LIST##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_P2TE_LIST_POSTFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_P2TE_LIST_POSTFIX', '\n----------------\n----ОШИБКИ-ГЕНЕРАТОРА-СООБЩЕНИЙ-[END]----------\n'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_P2TE_LIST_POSTFIX', '\n----------------\n----MESSAGES-GENERATOR-ERRORS-[END]----------\n'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_P2TE_LIST_POSTFIX','##|E_PCLT_P2TE_LIST##|'); + +INSERT INTO tpls (pclt_id) VALUES('PARSER_SSM'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PARSER_SSM', '##|PARSER_SSM_PREFIX##|@@|parser_ssm_details@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PARSER_SSM', '##|PARSER_SSM_PREFIX##|@@|parser_ssm_details@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PARSER_SSM','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('PARSER_SSM_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PARSER_SSM_PREFIX', 'Маркер разделения секторов:'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PARSER_SSM_PREFIX', 'Sector separation marker: '); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PARSER_SSM_PREFIX','##|PARSER_SSM##|'); +INSERT INTO tpls (pclt_id) VALUES('PARSER_SSM_BEGIN'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PARSER_SSM_BEGIN', 'начало ввода'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PARSER_SSM_BEGIN', 'input beginning'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PARSER_SSM_BEGIN','##|PARSER_SSM##|'); +INSERT INTO tpls (pclt_id) VALUES('PARSER_SSM_EOF'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PARSER_SSM_EOF', 'конец ввода'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PARSER_SSM_EOF', 'input ending'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PARSER_SSM_EOF','##|PARSER_SSM##|'); +INSERT INTO tpls (pclt_id) VALUES('PARSER_SSM_INNER'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PARSER_SSM_INNER', 'маркер #@@|sm_idx@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PARSER_SSM_INNER', 'marker #@@|sm_idx@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PARSER_SSM_INNER','##|PARSER_SSM##|'); +INSERT INTO tpls (pclt_id) VALUES('PARSER_SSM_ERR'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PARSER_SSM_ERR', 'ошибка "@@|smse@@|"'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PARSER_SSM_ERR', 'error "@@|smse@@|"'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PARSER_SSM_ERR','##|PARSER_SSM##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_PARSER_SMSE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PARSER_SMSE', '##|E_PARSER_SMSE_PREFIX##|@@|parser_smse_err_details@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PARSER_SMSE', '##|E_PARSER_SMSE_PREFIX##|@@|parser_smse_err_details@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PARSER_SMSE','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PARSER_SMSE_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PARSER_SMSE_PREFIX', 'Произошла ошибка при грамматическом разборе маркированого текста. Ошибка маркирования:'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PARSER_SMSE_PREFIX', 'An error occured when parsing a marked text. Marking failed: '); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PARSER_SMSE_PREFIX','##|E_PARSER_SMSE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PARSER_SMSE_INPUTAFTEREOF'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PARSER_SMSE_INPUTAFTEREOF', 'ввод после конца ввода'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PARSER_SMSE_INPUTAFTEREOF', 'input is not allowed after EOF'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PARSER_SMSE_INPUTAFTEREOF','##|E_PARSER_SMSE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PARSER_SMSE_BEGINNIGINMID'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PARSER_SMSE_BEGINNIGINMID', 'начало вводе не в начале'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PARSER_SMSE_BEGINNIGINMID', 'beginning is allowed to occur only as the first input marker'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PARSER_SMSE_BEGINNIGINMID','##|E_PARSER_SMSE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PARSER_SMSE_OVERLAPMARK'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PARSER_SMSE_OVERLAPMARK', 'пересекающиеся маркированые регионы не допускаются'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PARSER_SMSE_OVERLAPMARK', 'the marking strategy doesn''t allow overlapping marked text chunks'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PARSER_SMSE_OVERLAPMARK','##|E_PARSER_SMSE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PARSER_SMSE_UNSUPMARKSEQ'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PARSER_SMSE_UNSUPMARKSEQ', 'неподдерживаемая последовательность маркеров (активный предыдущий маркер -> текущий маркер): @@|prev_active_sm@@| -> @@|cur_sm@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PARSER_SMSE_UNSUPMARKSEQ', 'the marking strategy does''t support markers sequence (active previous separator marker -> current separator marker): @@|prev_active_sm@@| -> @@|cur_sm@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PARSER_SMSE_UNSUPMARKSEQ','##|E_PARSER_SMSE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PARSER_SMSE_UNFINWHENEOF'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PARSER_SMSE_UNFINWHENEOF', 'ввод оканчивается незакрытым маркированым регионом (индекс маркера: @@|sm_idx@@|)'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PARSER_SMSE_UNFINWHENEOF', 'input ends with unclosed chunk of text (marker index: @@|sm_idx@@|)'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PARSER_SMSE_UNFINWHENEOF','##|E_PARSER_SMSE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PARSER_SMSE_BADCHAR'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PARSER_SMSE_BADCHAR', 'поток символов застопорился из-за недопустимого символа'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PARSER_SMSE_BADCHAR', 'input flow stopped due to occurrence of unallowed character'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PARSER_SMSE_BADCHAR','##|E_PARSER_SMSE##|'); + +INSERT INTO tpls (pclt_id) VALUES('PCLT_SDL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_SDL', '##|PCLT_SDL_PREFIX##|@@|pclt_sdl_details@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_SDL', '##|PCLT_SDL_PREFIX##|@@|pclt_sdl_details@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_SDL','5000'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_SDL_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_SDL_PREFIX', 'Уровень детализации отображения сообщения из шаблона: '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_SDL_PREFIX', 'Show detalization level from a message template:'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_SDL_PREFIX','##|PCLT_SDL##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_SDL_INFBIG'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_SDL_INFBIG', 'бесконечно большой ("@@|sdl_m@@|")'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_SDL_INFBIG', 'infinitely big ("@@|sdl_m@@|")'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_SDL_INFBIG','##|PCLT_SDL##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_SDL_ZERO'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_SDL_ZERO', 'ноль ("@@|sdl_m@@|")'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_SDL_ZERO', 'zero ("@@|sdl_m@@|")'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_SDL_ZERO','##|PCLT_SDL##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_SDL_ONE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_SDL_ONE', 'единица ("@@|sdl_m@@|")'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_SDL_ONE', 'one ("@@|sdl_m@@|")'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_SDL_ONE','##|PCLT_SDL##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_SDL_NUM'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_SDL_NUM', 'номер: "@@|sdl_m@@|"'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_SDL_NUM', 'numeric: "@@|sdl_m@@|"'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_SDL_NUM','##|PCLT_SDL##|'); + +INSERT INTO tpls (pclt_id) VALUES('PCLT_SDLM'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_SDLM', '##|PCLT_SDLM_PREFIX##|@@|pclt_sdlm_details@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_SDLM', '##|PCLT_SDLM_PREFIX##|@@|pclt_sdlm_details@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_SDLM','##|PCLT_SDL##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_SDLM_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_SDLM_PREFIX', 'Контекст уровня детализации отображения сообщения: '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_SDLM_PREFIX', 'Show detalization level usage:'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_SDLM_PREFIX','##|PCLT_SDLM##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_SDLM_ALLOC'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_SDLM_ALLOC', 'дозволенный получателю сообщения'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_SDLM_ALLOC', 'allowed to message reader'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_SDLM_ALLOC','##|PCLT_SDLM##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_SDLM_REQ'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_SDLM_REQ', 'требуемый для отоброжения'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_SDLM_REQ', 'required for message representation'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_SDLM_REQ','##|PCLT_SDLM##|'); + +INSERT INTO tpls (pclt_id) VALUES('PCLT_PSDL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_PSDL', '##|PCLT_PSDL_PREFIX##| @@|psdl@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_PSDL', '##|PCLT_PSDL_PREFIX##| @@|psdl@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_PSDL','##|PCLT_SDL##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_PSDL_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_PSDL_PREFIX', 'Уровень детализации отображения сообщения из шаблона (определённый при шаблоне, как минимальный необходимый для отображения сообщения): '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_PSDL_PREFIX', 'Show detalization level from a message template (specified by the template, as a required minimum for message representation):'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_PSDL_PREFIX','##|PCLT_PSDL##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_PSDL_SDL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_PSDL_SDL', '@@|sdl@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_PSDL_SDL', '@@|sdl@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_PSDL_SDL','##|PCLT_PSDL##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_PSDL_CMPST'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_PSDL_CMPST', 'такой же, как для шаблона ''@@|tpl_id@@|'''); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_PSDL_CMPST', 'the same, as specified for template ''@@|tpl_id@@|'''); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_PSDL_CMPST','##|PCLT_PSDL##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_PSDL_PARAMCMPST'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_PSDL_PARAMCMPST', 'такой же, как для шаблона, который должен быть под параметром ''@@|param_name@@|'''); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_PSDL_PARAMCMPST', 'the same, as specified for template, that is to be put under parameter ''@@|param_name@@|'''); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_PSDL_PARAMCMPST','##|PCLT_PSDL##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_PSDL_ERR'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_PSDL_ERR', 'ошибка определения уровня (''@@|err_details@@|'')'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_PSDL_ERR', 'SDL specification error (''@@|err_details@@|'')'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_PSDL_ERR','##|PCLT_PSDL##|'); + +INSERT INTO tpls (pclt_id) VALUES('PCLT_MARKER'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_MARKER', '##|PCLT_MARKER_PREFIX##|@@|pclt_marker_details@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_MARKER', '##|PCLT_MARKER_PREFIX##|@@|pclt_marker_details@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_MARKER','##|PARSER_SSM##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_MARKER_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_MARKER_PREFIX', 'PCST маркер:'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_MARKER_PREFIX', 'PCST marker: '); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_MARKER_PREFIX','##|PCLT_MARKER##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_MARKER_PLAINTXT'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_MARKER_PLAINTXT', 'обычный текст'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_MARKER_PLAINTXT', 'plain text'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_MARKER_PLAINTXT','##|PCLT_MARKER##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_MARKER_PARAM'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_MARKER_PARAM', 'параметр'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_MARKER_PARAM', 'parameter'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_MARKER_PARAM','##|PCLT_MARKER##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_MARKER_COMPOSITE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_MARKER_COMPOSITE', 'композит'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_MARKER_COMPOSITE', 'composite'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_MARKER_COMPOSITE','##|PCLT_MARKER##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_MARKER_UNSUP'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_MARKER_UNSUP', 'неподдерживаемый маркер "@@|ssm@@|"'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_MARKER_UNSUP', 'unsupported marker "@@|ssm@@|"'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_MARKER_UNSUP','##|PCLT_MARKER##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_PLLF'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_PLLF', '##|E_PCLT_PLLF_PREFIX##|@@|pclt_pllf_details@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_PLLF', '##|E_PCLT_PLLF_PREFIX##|@@|pclt_pllf_details@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_PLLF','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_PLLF_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_PLLF_PREFIX', 'Произошла ошибка в результате применения парсера, который разделяет обычный текст, параметры и композиты:'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_PLLF_PREFIX', 'An error occurred when applying parser, that separates plain text, parameters and composites: '); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_PLLF_PREFIX','##|E_PCLT_PLLF##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_PLLF_UNEXP'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_PLLF_UNEXP', 'парсер вернул ненормальное состояние "@@|parse_result_str@@|"'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_PLLF_UNEXP', 'parser returned an unexpected state "@@|parse_result_str@@|"'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_PLLF_UNEXP','##|E_PCLT_PLLF##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_PLLF_BADSSM'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_PLLF_BADSSM', 'плохой маркер у куска текста (позиция: @@|chunk_idx@@|): @@|ssm@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_PLLF_BADSSM', 'bad chunk marker (position: @@|chunk_idx@@|): @@|ssm@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_PLLF_BADSSM','##|E_PCLT_PLLF##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_DRLNE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_DRLNE', '##|E_PCLT_DRLNE_PREFIX##|@@|pclt_drlne_err_details@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_DRLNE', '##|E_PCLT_DRLNE_PREFIX##|@@|pclt_drlne_err_details@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_DRLNE','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_DRLNE_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_DRLNE_PREFIX', 'Произошла ошибка во время окончательной нормализации [требований к уровням детализации для отображения]: '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_DRLNE_PREFIX', 'An error occured during normalization of detalization level requirements (DRL) of message templetes:'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_DRLNE_PREFIX','##|E_PCLT_DRLNE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_DRLNE_CYCL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_DRLNE_CYCL', 'обнаружен ссылочный композиционный цикл. Буфер композитов: @@|buf@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_DRLNE_CYCL', 'compositional referential cycle detected. Composites buffer: @@|buf@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_DRLNE_CYCL','##|E_PCLT_DRLNE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_DRLNE_BADREF'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_DRLNE_BADREF', 'не получается определить требование к уровню детализации шаблона (ИД: @@|red_id@@|), на который ссылается шаблон, чей ИД - @@|rer_id@@|. Шаблон на который ссылка — отсутствует.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_DRLNE_BADREF', 'couldn''t determine the DRL of referenced template (ID: @@|red_id@@|), referenced by a composite (ID: @@|rer_id@@|) DRL. Referenced template is missing.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_DRLNE_BADREF','##|E_PCLT_DRLNE##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_COMMONS_CCYCL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_COMMONS_CCYCL', 'обнаружен композиционный цикл в шаблоне сообщения (ИД: @@|tpl_id@@|), буфер композиций: @@|buf@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_COMMONS_CCYCL', 'a composition cycle detected in a message template (ID: @@|tpl_id@@|), compositions path buffer: @@|buf@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_COMMONS_CCYCL','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_COMMONS_MISSINGCOMPST'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_COMMONS_MISSINGCOMPST', 'композит (ИД: @@|red_id@@|) в каталоге отсутствует'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_COMMONS_MISSINGCOMPST', 'a composite (ID: @@|red_id@@|) is missing in catalog'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_COMMONS_MISSINGCOMPST','##|E_PCLT_COMMONS_CCYCL##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_COMMONS_MISSINGCOMPSTBYRER'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_COMMONS_MISSINGCOMPSTBYRER', '##|E_PCLT_COMMONS_MISSINGCOMPST##|. На недостающий композит ссылается шаблон (ИД: @@|rer_id@@|)'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_COMMONS_MISSINGCOMPSTBYRER', '##|E_PCLT_COMMONS_MISSINGCOMPST##|. The missing composite is required by the message template (ID: @@|rer_id@@|)'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_COMMONS_MISSINGCOMPSTBYRER','##|E_PCLT_COMMONS_CCYCL##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_COMMONS_TDLIM'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_COMMONS_TDLIM', 'шаблон (ИД: @@|tpl_id@@|) на основном языке не дан, но дан для др. языков. ДЛЯ ВСЕХ ЯЗЫКОВ данный шаблон будет отвергнут'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_COMMONS_TDLIM', 'A message template (ID: @@|tpl_id@@|) in default language is missing (while persisting for other languages). FOR ALL LANGUAGES the message template will be discarded'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_COMMONS_TDLIM','##|E_PCLT_COMMONS_CCYCL##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_COMMONS_DLTCPSDFOON'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_COMMONS_DLTCPSDFOON', 'шаблон (ИД: @@|tpl_id@@|) - его множества параметров и композитов отличаются для основного языка и для НЕосновного языка «@@|lng@@|». Версия шаблона на НЕосновном языке отвергнута (если такая строгость вас неустраивает, подрегулируйте параметр <StrictOrient_ofParamsAndCmpsts_onDfltLngTplsSets> в конфигурации каталога)'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_COMMONS_DLTCPSDFOON', 'A message template''s (ID: @@|tpl_id@@|) sets of subcomposites and parameters differs for default and nondefault languages (''@@|lng@@|''). The template version for this nondefault language WILL BE DISCARDED (if such strictness doesn''t fit your needs, change catalog configuration parameter <StrictOrient_ofParamsAndCmpsts_onDfltLngTplsSets>)'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_COMMONS_DLTCPSDFOON','##|E_PCLT_COMMONS_CCYCL##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_COMMONS_UNIQUEVIOL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_COMMONS_UNIQUEVIOL', 'в локализуемом шаблоне (ИД: @@|tpl_id@@|), уже присутствует версия на языках @@|lng_list@@|, - языковые версии шаблона на этих языках добавить нельзя (не выкинув старые версии)'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_COMMONS_UNIQUEVIOL', 'the localizeble template (ID: @@|tpl_id@@|) is already localized in languages @@|lng_list@@|, - new localizations'' versions can''t be added (without throwing away old ones)'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_COMMONS_UNIQUEVIOL','##|E_PCLT_COMMONS_CCYCL##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_COMMONS_DIFFSDLS'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_COMMONS_DIFFSDLS', 'при сложении локализуемых шаблонов (ИД: @@|tpl_id@@|) обнаружено расхождение в их требованиях к уровню детализации необходимому для отображения. Требуемые уровни (прибавляемы шаблоном / шаблоном аккумулятором): @@|add_sdl@@|/@@|main_sdl@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_COMMONS_DIFFSDLS', 'when adding up two localizables of one ID ("@@|tpl_id@@|") an inconsistency shows up - required show-detalization-levels differs for them. Required levels (of added tpl / of accumulator tpl): @@|add_sdl@@|/@@|main_sdl@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_COMMONS_DIFFSDLS','##|E_PCLT_COMMONS_CCYCL##|'); + +INSERT INTO tpls (pclt_id) VALUES('PCLT_ESDL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_ESDL', '##|PCLT_ESDL_PREFIX##|@@|pclt_esdl_details@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_ESDL', '##|PCLT_ESDL_PREFIX##|@@|pclt_esdl_details@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_ESDL','##|PCLT_PSDL##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_ESDL_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_ESDL_PREFIX', 'Причина ошибочности данного уровня детализации отображения сообщения: '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_ESDL_PREFIX', 'Error in definition of level of detalization of representation:'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_ESDL_PREFIX','##|PCLT_ESDL##|'); +INSERT INTO tpls (pclt_id) VALUES('PCLT_ESDL_UNREAD'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'PCLT_ESDL_UNREAD', 'задан нечитаемый уровень. ##|PCLT_SDLM##| Текст заданого: "@@|sdle_raw_inp@@|" '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'PCLT_ESDL_UNREAD', 'unreadable level specified. ##|PCLT_SDLM##| Input: "@@|sdle_raw_inp@@|"'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'PCLT_ESDL_UNREAD','##|PCLT_ESDL##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_RPCSCE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_RPCSCE', '##|E_PCLT_RPCSCE_PREFIX##|@@|pclt_rpcsce_err_details@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_RPCSCE', '##|E_PCLT_RPCSCE_PREFIX##|@@|pclt_rpcsce_err_details@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_RPCSCE','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_RPCSCE_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_RPCSCE_PREFIX', 'Произошла ошибка при чтении/формировании каталога шаблонов стандартных локализуемых детализуемых сообщений: '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_RPCSCE_PREFIX', 'An error occured during formation of standard messages templates catalog:'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_RPCSCE_PREFIX','##|E_PCLT_RPCSCE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_RPCSCE_CCYCL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_RPCSCE_CCYCL', '##|E_PCLT_COMMONS_CCYCL##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_RPCSCE_CCYCL', '##|E_PCLT_COMMONS_CCYCL##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_RPCSCE_CCYCL','##|E_PCLT_RPCSCE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_RPCSCE_MISSINGCOMPST'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_RPCSCE_MISSINGCOMPST', '##|E_PCLT_COMMONS_MISSINGCOMPSTBYRER##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_RPCSCE_MISSINGCOMPST', '##|E_PCLT_COMMONS_MISSINGCOMPSTBYRER##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_RPCSCE_MISSINGCOMPST','##|E_PCLT_RPCSCE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_RPCSCE_UNPARSABLECOMPST'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_RPCSCE_UNPARSABLECOMPST', 'композит (ИД: @@|red_id@@|), на который ссылается шаблон (ИД: @@|rer_id@@|), наличествует во входе на формирование каталога, но (этот требуемый шаблон) не парсится'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_RPCSCE_UNPARSABLECOMPST', 'a composite (ID: @@|red_id@@|) required by the message template (ID: @@|rer_id@@|) is found in raw data for catalog, but parsing it failed'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_RPCSCE_UNPARSABLECOMPST','##|E_PCLT_RPCSCE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_RPCSCE_DFLTLNGPARSEFAIL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_RPCSCE_DFLTLNGPARSEFAIL', 'шаблон (ИД: @@|tpl_id@@|) на основном языке не парсится без ошибок. @@|if_not_parsed@@|Список ошибок выданый парсером: @@|ll_errs_list@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_RPCSCE_DFLTLNGPARSEFAIL', 'a message template (ID: @@|tpl_id@@|) in default language is parsed (separation on composites, parameters and plain text) with errors. @@|if_not_parsed@@|Parse error(s): @@|ll_errs_list@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_RPCSCE_DFLTLNGPARSEFAIL','##|E_PCLT_RPCSCE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_RPCSCE_DFLTLNGPARSEFAIL_C'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_RPCSCE_DFLTLNGPARSEFAIL_C', 'ДЛЯ ВСЕХ ЯЗЫКОВ данный шаблон будет отвергнут. '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_RPCSCE_DFLTLNGPARSEFAIL_C', 'FOR ALL LANGUAGES the message template will be discarded. '); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_RPCSCE_DFLTLNGPARSEFAIL_C','##|E_PCLT_RPCSCE_DFLTLNGPARSEFAIL##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_RPCSCE_TDLIM'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_RPCSCE_TDLIM', '##|E_PCLT_COMMONS_TDLIM##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_RPCSCE_TDLIM', '##|E_PCLT_COMMONS_TDLIM##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_RPCSCE_TDLIM','##|E_PCLT_RPCSCE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_RPCSCE_NDFLTLNGPARSEFAIL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_RPCSCE_NDFLTLNGPARSEFAIL', 'шаблон (ИД: @@|tpl_id@@|) на НЕосновном языке (''@@|lng@@|'') не парсится без ошибок. @@|if_not_parsed@@|Список ошибок выданый парсером: @@|ll_errs_list@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_RPCSCE_NDFLTLNGPARSEFAIL', 'a message template (ID: @@|tpl_id@@|) in nondefault language (''@@|lng@@|'') is parsed (separation on composites, parameters and plain text) with errors. @@|if_not_parsed@@|Parse error(s): @@|ll_errs_list@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_RPCSCE_NDFLTLNGPARSEFAIL','##|E_PCLT_RPCSCE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_RPCSCE_NDFLTLNGPARSEFAIL_C'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_RPCSCE_NDFLTLNGPARSEFAIL_C', 'Для данного языка этот шаблон будет отвергнут. '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_RPCSCE_NDFLTLNGPARSEFAIL_C', 'The message template for this language will be discarded. '); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_RPCSCE_NDFLTLNGPARSEFAIL_C','##|E_PCLT_RPCSCE_NDFLTLNGPARSEFAIL##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_RPCSCE_DLTCPSDFOON'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_RPCSCE_DLTCPSDFOON', '##|E_PCLT_COMMONS_DLTCPSDFOON##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_RPCSCE_DLTCPSDFOON', '##|E_PCLT_COMMONS_DLTCPSDFOON##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_RPCSCE_DLTCPSDFOON','##|E_PCLT_RPCSCE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_RPCSCE_DIFFSDLS'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_RPCSCE_DIFFSDLS', '##|E_PCLT_COMMONS_DIFFSDLS##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_RPCSCE_DIFFSDLS', '##|E_PCLT_COMMONS_DIFFSDLS##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_RPCSCE_DIFFSDLS','##|E_PCLT_RPCSCE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_RPCSCE_UNIQUEVIOL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_RPCSCE_UNIQUEVIOL', '##|E_PCLT_COMMONS_UNIQUEVIOL##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_RPCSCE_UNIQUEVIOL', '##|E_PCLT_COMMONS_UNIQUEVIOL##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_RPCSCE_UNIQUEVIOL','##|E_PCLT_RPCSCE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_RPCSCE_SDLPTRTONONEXIST'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_RPCSCE_SDLPTRTONONEXIST', 'необходимый для отображения (сообщения по шаблону ИД: @@|rer_id@@|)) уровень детализации определён быть таким же, как у композита [ИД: @@|red_id@@|], но последнего в каталоге нет'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_RPCSCE_SDLPTRTONONEXIST', 'for message template (ID: @@|rer_id@@|) representation required detailization level is referenced to be the same as of another composite, but referenced composite (ID: @@|red_id@@|) is missing'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_RPCSCE_SDLPTRTONONEXIST','##|E_PCLT_RPCSCE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_RPCSCE_DRLNE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_RPCSCE_DRLNE', '@@|drlne@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_RPCSCE_DRLNE', '@@|drlne@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_RPCSCE_DRLNE','##|E_PCLT_RPCSCE##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_AHS2PE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_AHS2PE', '##|E_PCLT_AHS2PE_PREFIX##|@@|pclt_ahs2pe_err_details@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_AHS2PE', '##|E_PCLT_AHS2PE_PREFIX##|@@|pclt_ahs2pe_err_details@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_AHS2PE','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_AHS2PE_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_AHS2PE_PREFIX', 'Произошла ошибка при чтении шаблона (параметризуемого сообщения) в тексте. Ошибка: '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_AHS2PE_PREFIX', 'An error occured in ad-hoc parsing of text, that''s supposed to be a template for message:'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_AHS2PE_PREFIX','##|E_PCLT_AHS2PE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_AHS2PE_MISSINGCOMPST'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_AHS2PE_MISSINGCOMPST', '##|E_PCLT_COMMONS_MISSINGCOMPST##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_AHS2PE_MISSINGCOMPST', '##|E_PCLT_COMMONS_MISSINGCOMPST##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_AHS2PE_MISSINGCOMPST','##|E_PCLT_AHS2PE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_AHS2PE_PARSEFAIL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_AHS2PE_PARSEFAIL', 'данный текст не парсится в шаблон без ошибок. Список ошибок выданый парсером: @@|ll_errs_list@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_AHS2PE_PARSEFAIL', 'the given text won''t parse into a template. Parse error(s): @@|ll_errs_list@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_AHS2PE_PARSEFAIL','##|E_PCLT_AHS2PE##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_APSTPTE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_APSTPTE', '##|E_PCLT_APSTPTE_PREFIX##|@@|pclt_apstpte_err_details@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_APSTPTE', '##|E_PCLT_APSTPTE_PREFIX##|@@|pclt_apstpte_err_details@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_APSTPTE','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_APSTPTE_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_APSTPTE_PREFIX', 'Произошла ошибка при прибавлен локализованой версии шаблона к локализуемому шаблону: '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_APSTPTE_PREFIX', 'An error occured when adding a localized template version to localizable template:'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_APSTPTE_PREFIX','##|E_PCLT_APSTPTE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_APSTPTE_TPLUNQVIOL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_APSTPTE_TPLUNQVIOL', '##|E_PCLT_COMMONS_UNIQUEVIOL##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_APSTPTE_TPLUNQVIOL', '##|E_PCLT_COMMONS_UNIQUEVIOL##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_APSTPTE_TPLUNQVIOL','##|E_PCLT_APSTPTE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_APSTPTE_DLTCPSDFOON'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_APSTPTE_DLTCPSDFOON', '##|E_PCLT_COMMONS_DLTCPSDFOON##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_APSTPTE_DLTCPSDFOON', '##|E_PCLT_COMMONS_DLTCPSDFOON##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_APSTPTE_DLTCPSDFOON','##|E_PCLT_APSTPTE##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_APTTPTE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_APTTPTE', '##|E_PCLT_APTTPTE_PREFIX##|@@|pclt_apttpte_err_details@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_APTTPTE', '##|E_PCLT_APTTPTE_PREFIX##|@@|pclt_apttpte_err_details@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_APTTPTE','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_APTTPTE_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_APTTPTE_PREFIX', 'Произошла ошибка при слиянии 2-ух наборов локалицаций в один шаблон: '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_APTTPTE_PREFIX', 'An error occured when when merging 2 localizations sets into one templatestructure:'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_APTTPTE_PREFIX','##|E_PCLT_APTTPTE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_APTTPTE_APSTPTE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_APTTPTE_APSTPTE', '##|E_PCLT_APSTPTE##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_APTTPTE_APSTPTE', '##|E_PCLT_APSTPTE##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_APTTPTE_APSTPTE','##|E_PCLT_APTTPTE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_APTTPTE_DIFFSDLS'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_APTTPTE_DIFFSDLS', '##|E_PCLT_COMMONS_DIFFSDLS##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_APTTPTE_DIFFSDLS', '##|E_PCLT_COMMONS_DIFFSDLS##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_APTTPTE_DIFFSDLS','##|E_PCLT_APTTPTE##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_P2TE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_P2TE', '##|E_PCLT_P2TE_PREFIX##|@@|pclt_p2te_err_details@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_P2TE', '##|E_PCLT_P2TE_PREFIX##|@@|pclt_p2te_err_details@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_P2TE','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_P2TE_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_P2TE_PREFIX', 'Произошла ошибка (@@|short_err_mark@@|) при реализации сообщения из шаблона: '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_P2TE_PREFIX', 'An error (@@|short_err_mark@@|) occurred, when trying to realize a message from a template: '); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_P2TE_PREFIX','##|E_PCLT_P2TE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_P2TE_MISSINGCOMPST'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_P2TE_MISSINGCOMPST', '##|E_PCLT_COMMONS_MISSINGCOMPSTBYRER##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_P2TE_MISSINGCOMPST', '##|E_PCLT_COMMONS_MISSINGCOMPSTBYRER##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_P2TE_MISSINGCOMPST','##|E_PCLT_P2TE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_P2TE_MISSINGLNGCOMPST'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_P2TE_MISSINGLNGCOMPST', '(для языка "@@|lng@@|") ##|E_PCLT_COMMONS_MISSINGCOMPSTBYRER##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_P2TE_MISSINGLNGCOMPST', '(for language "@@|lng@@|") ##|E_PCLT_COMMONS_MISSINGCOMPSTBYRER##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_P2TE_MISSINGLNGCOMPST','##|E_PCLT_P2TE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_P2TE_COMPCYCL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_P2TE_COMPCYCL', '##|E_PCLT_COMMONS_CCYCL##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_P2TE_COMPCYCL', '##|E_PCLT_COMMONS_CCYCL##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_P2TE_COMPCYCL','##|E_PCLT_P2TE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_P2TE_SDLDF'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_P2TE_SDLDF', '##|E_PCLT_SDLDF##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_P2TE_SDLDF', '##|E_PCLT_SDLDF##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_P2TE_SDLDF','##|E_PCLT_P2TE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_P2TE_USUPMARK'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_P2TE_USUPMARK', 'неизвестный маркер обнаружен в шаблоне [ИД: @@|tpl_id@@|; язык: "@@|lng@@|"]. @@|ssm@@| Содержимое под маркером: @@|contents@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_P2TE_USUPMARK', 'unsupported marker appeara in the template [ID: @@|tpl_id@@|; language: "@@|lng@@|"]. @@|ssm@@| Marked text chunk: @@|contents@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_P2TE_USUPMARK','##|E_PCLT_P2TE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_P2TE_NOPARAMVAL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_P2TE_NOPARAMVAL', 'для параметра "@@|param_id@@|" к реализации шаблона [ИД: @@|tpl_id@@|; язык: "@@|lng@@|"] не указано значение'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_P2TE_NOPARAMVAL', 'no value specified for parameter "@@|param_id@@|" of template [ID: @@|tpl_id@@|; lng: "@@|lng@@|"]'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_P2TE_NOPARAMVAL','##|E_PCLT_P2TE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_P2TE_REPRSFAIL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_P2TE_REPRSFAIL', 'произошла ошибка при репарсинге значения параметра "@@|param_id@@|" при реализации шаблона [ИД: @@|tpl_id@@|; язык: "@@|lng@@|"]. Ошибка: @@|rpcsce@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_P2TE_REPRSFAIL', 'an error occurred, when reparsing a value specified for parameter "@@|param_id@@|" of template [ID: @@|tpl_id@@|; lng: "@@|lng@@|"]: @@|rpcsce@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_P2TE_REPRSFAIL','##|E_PCLT_P2TE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_P2TE_REPRSDEPTH'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_P2TE_REPRSDEPTH', 'достигнута максимальная глубина репарсинга (@@|reparsing_depth@@|). Дальнейшее углубление остановлено на репарсинге значения параметра "@@|param_id@@|" при реализации шаблона [ИД: @@|tpl_id@@|; язык: "@@|lng@@|"]'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_P2TE_REPRSDEPTH', 'reparsing depth maximum (@@|reparsing_depth@@|) reached, - halted a reparsing of a value specified for parameter "@@|param_id@@|" of template [ID: @@|tpl_id@@|; lng: "@@|lng@@|"]'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_P2TE_REPRSDEPTH','##|E_PCLT_P2TE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_P2TE_REPRSLEN'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_P2TE_REPRSLEN', 'достигнута максимальная длина (@@|max_len@@|) сторки подготавливаемой к репарсингу, при репарсинге значения параметра "@@|param_id@@|" при реализации шаблона [ИД: @@|tpl_id@@|; язык: "@@|lng@@|"]'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_P2TE_REPRSLEN', 'the text, that is to be reparsed, length maximum (@@|max_len@@|) reached, when reparsing a value specified for parameter "@@|param_id@@|" of template [ID: @@|tpl_id@@|; lng: "@@|lng@@|"]'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_P2TE_REPRSLEN','##|E_PCLT_P2TE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_P2TE_INSTLEN'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_P2TE_INSTLEN', 'достигнута максимальная длина (@@|max_len@@|) реализации сообщения из шаблона [ИД: @@|tpl_id@@|; язык: "@@|lng@@|"]'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_P2TE_INSTLEN', 'the realization length maximum (@@|max_len@@|) is reached, when realizing template [ID: @@|tpl_id@@|; lng: "@@|lng@@|"]'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_P2TE_INSTLEN','##|E_PCLT_P2TE##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_SDLDF'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_SDLDF', '##|E_PCLT_SDLDF_PREFIX##|@@|pclt_sdldf_err_details@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_SDLDF', '##|E_PCLT_SDLDF_PREFIX##|@@|pclt_sdldf_err_details@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_SDLDF','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_SDLDF_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_SDLDF_PREFIX', 'Произошла ошибка при определении шаблоном {ИД: "@@|tpl_id@@|"} требуемого для отображения уровня детализации: '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_SDLDF_PREFIX', 'An error occured when trying to determine required by the template {ID: "@@|tpl_id@@|"} representation detalization level: '); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_SDLDF_PREFIX','##|E_PCLT_SDLDF##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_SDLDF_MISSCMPST'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_SDLDF_MISSCMPST', '##|E_PCLT_COMMONS_MISSINGCOMPSTBYRER##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_SDLDF_MISSCMPST', '##|E_PCLT_COMMONS_MISSINGCOMPSTBYRER##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_SDLDF_MISSCMPST','##|E_PCLT_SDLDF##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_SDLDF_CMPZPARAMREF'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_SDLDF_CMPZPARAMREF', 'необходимый уровень детализации для отображения шаблона [ИД: @@|tpl_id@@|], указан быть таким же, как у шаблона, который подставляется под параметр [ИД: @@|param_id@@|]'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_SDLDF_CMPZPARAMREF', 'of template (ID: @@|tpl_id@@|) for message representation required detailization level is referenced to be the same as is one of composite put behind parameter (ID: @@|param_id@@|)'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_SDLDF_CMPZPARAMREF','##|E_PCLT_SDLDF##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_SDLDF_MISSPARAM'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_SDLDF_MISSPARAM', '##|E_PCLT_SDLDF_CMPZPARAMREF##|, однако такой параметр вообще отсутствует на входе в реализацию шаблона'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_SDLDF_MISSPARAM', '##|E_PCLT_SDLDF_CMPZPARAMREF##|, but referenced parameter is missing in realization input'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_SDLDF_MISSPARAM','##|E_PCLT_SDLDF##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_SDLDF_WRNGPRMTYP'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_SDLDF_WRNGPRMTYP', '##|E_PCLT_SDLDF_CMPZPARAMREF##|, однако под параметр подставлен не шаблон'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_SDLDF_WRNGPRMTYP', '##|E_PCLT_SDLDF_CMPZPARAMREF##|, but referenced parameter value is not a template'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_SDLDF_WRNGPRMTYP','##|E_PCLT_SDLDF##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_SDLDF_WRNGPRMCMPST'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_SDLDF_WRNGPRMCMPST', '##|E_PCLT_SDLDF_CMPZPARAMREF##|, однако под параметр подставлен шаблон [ИД: @@|wrng_tpl_id@@|] - каталогу неизвестный'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_SDLDF_WRNGPRMCMPST', '##|E_PCLT_SDLDF_CMPZPARAMREF##|, but referenced parameter value is set to a template [ID: @@|wrng_tpl_id@@|], which is not in the catalog'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_SDLDF_WRNGPRMCMPST','##|E_PCLT_SDLDF##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_SDLDF_REFCYCL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_SDLDF_REFCYCL', 'у данного шаблона для отображения требуемый уровнь детализации такой же, как у указанного - при определении требуемого уровня детализации (остановлен на шаблоне [ИД: @@|tpl_id@@|]) обнаружен цикл таких ссылок. Буфер зацикленных шаблонов: @@|super_buf@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_SDLDF_REFCYCL', 'for message (of given template) representation required detailization level is referenced to be the same as is defined for the referenced template - in a group of such definitions a referential cycle is detected. Procedure of level requirements determination halted on template [ID: @@|tpl_id@@|]. Cycled tpls buffer: @@|super_buf@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_SDLDF_REFCYCL','##|E_PCLT_SDLDF##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLT_SDLDF_ESDL'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLT_SDLDF_ESDL', 'у шаблона [ИД: @@|tpl_id@@|] для отображения требуемый уровнь детализации ошибочен. @@|esdl_reason@@| Вместо определённого используется требование бесконечного уровня'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLT_SDLDF_ESDL', 'for message (of template [ИД: @@|tpl_id@@|]) representation required detailization level is errornous. @@|esdl_reason@@| The requirement of infinite level is used instead'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCLT_SDLDF_ESDL','##|E_PCLT_SDLDF##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_PCSC'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCSC', '##|E_PCSC_PREFIX##| @@|pclt_wpcsc_err_details@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCSC', '##|E_PCSC_PREFIX##| @@|pclt_wpcsc_err_details@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCSC','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCSC_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCSC_PREFIX', 'Произошла ошибка в связи с каталогом [ИД: @@|cat_id@@|] шаблонов стандартных локализуемых детализуемых сообщений. '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCSC_PREFIX', 'An error occured in context of messages templates catalog [ID: @@|cat_id@@|].'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCSC_PREFIX','##|E_PCSC##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_PCSC_CFHIE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCSC_CFHIE', '##|E_PCSC_CFHIE_PREFIX##| @@|pclt_cfhie_err_details@@|\n##|E_PCSC_CFHIE_POSTFIX##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCSC_CFHIE', '##|E_PCSC_CFHIE_PREFIX##| @@|pclt_cfhie_err_details@@|\n##|E_PCSC_CFHIE_POSTFIX##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCSC_CFHIE','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCSC_CFHIE_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCSC_CFHIE_PREFIX', 'Произошла одна или несколько ошибок при попытке инициализировать каталог [ИД: @@|cat_id@@|] из данных определённых через воплощение класса "HasStaticRawPCSTs": '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCSC_CFHIE_PREFIX', 'One on more errors occurred when trying to initialize a catalog [ID: @@|cat_id@@|] from an instance of class "HasStaticRawPCSTs": '); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCSC_CFHIE_PREFIX','##|E_PCSC_CFHIE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCSC_CFHIE_APTTPTE_L'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCSC_CFHIE_APTTPTE_L', '\n ** Ошибки сборки множества шаблонов, из которых необходимо сформировать каталог: @@|cole_list@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCSC_CFHIE_APTTPTE_L', '\n ** Errors of collecting templates for catalog formation input: @@|cole_list@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCSC_CFHIE_APTTPTE_L','##|E_PCSC_CFHIE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCSC_CFHIE_RPCSCE_L'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCSC_CFHIE_RPCSCE_L', '\n ** Ошибки чтения и формирования образа каталога: @@|cre_list@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCSC_CFHIE_RPCSCE_L', '\n ** Catalog parsing errors: @@|cre_list@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCSC_CFHIE_RPCSCE_L','##|E_PCSC_CFHIE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCSC_CFHIE_POSTFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCSC_CFHIE_POSTFIX', 'С упущениями, но всё же каталог (частично) считан.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCSC_CFHIE_POSTFIX', 'Despite of losses, the catalog is (partly) read.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (4,'E_PCSC_CFHIE_POSTFIX','##|E_PCSC_CFHIE##|'); + +------------------------------------------ +-- PCLT-DB templates + +INSERT INTO tpls (pclt_id) VALUES('DB_ERROR'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'DB_ERROR', 'Провал операции в связи с БД. Состояние: "@@|seState@@|". Уровень: @@|seNativeError@@|. Сообщение: "@@|seErrorMsg@@|".'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'DB_ERROR', 'Operation with DB failed. State: "@@|seState@@|". Layer: @@|seNativeError@@|. Message: "@@|seErrorMsg@@|".'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (2,'DB_ERROR','##|LLEXCPT##|'); + +INSERT INTO tpls (pclt_id) VALUES('ARFDBE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'ARFDBE', 'Ошибка при чтении объекта из БД. ##|ARFDBE_OBJ_TYPE##| ##|ARFDBE_OBJ_PK##| ##|ARFDBE_DET##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'ARFDBE', 'An error occurred, when tried to read an object from DB. ##|ARFDBE_OBJ_TYPE##| ##|ARFDBE_OBJ_PK##| ##|ARFDBE_DET##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (2,'ARFDBE','##|ARFDBE_DET##|'); +INSERT INTO tpls (pclt_id) VALUES('ARFDBE_OBJ_TYPE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'ARFDBE_OBJ_TYPE', 'Тип объекта: @@|read_object_type@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'ARFDBE_OBJ_TYPE', 'Object type: @@|read_object_type@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (2,'ARFDBE_OBJ_TYPE','##|ARFDBE##|'); +INSERT INTO tpls (pclt_id) VALUES('ARFDBE_SDLR'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'ARFDBE_SDLR', '@@|sdl_reference@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'ARFDBE_SDLR', '@@|sdl_reference@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (2,'ARFDBE_SDLR','@@|sdl_reference@@|'); +INSERT INTO tpls (pclt_id) VALUES('ARFDBE_OBJ_PK'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'ARFDBE_OBJ_PK', 'Первичный ключ: @@|obj_pk@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'ARFDBE_OBJ_PK', 'Object primary key: @@|obj_pk@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (2,'ARFDBE_OBJ_PK','##|ARFDBE_SDLR##|'); +INSERT INTO tpls (pclt_id) VALUES('ARFDBE_DET'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'ARFDBE_DET', '@@|arfdbe_err_details@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'ARFDBE_DET', '@@|arfdbe_err_details@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (2,'ARFDBE_DET','##|ARFDBE_SDLR##|'); +INSERT INTO tpls (pclt_id) VALUES('ARFDBE_DET_RCVERR'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'ARFDBE_DET_RCVERR', '##|DB_ERROR##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'ARFDBE_DET_RCVERR', '##|DB_ERROR##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (2,'ARFDBE_DET_RCVERR','##|DB_ERROR##|'); +INSERT INTO tpls (pclt_id) VALUES('ARFDBE_DET_NOTFND'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'ARFDBE_DET_NOTFND', 'Объект не найден!'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'ARFDBE_DET_NOTFND', 'Object not found!'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (2,'ARFDBE_DET_NOTFND','##|ARFDBE_DET##|'); +INSERT INTO tpls (pclt_id) VALUES('ARFDBE_DET_TOOMUCHRES'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'ARFDBE_DET_TOOMUCHRES', 'Запрос к БД вернул слишком много результатов, при допустимом максимуме - @@|max_rows_count@@| строк.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'ARFDBE_DET_TOOMUCHRES', 'DB query returned too many rows. Allowed rows count maximum is @@|max_rows_count@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (2,'ARFDBE_DET_TOOMUCHRES','##|ARFDBE_DET##|'); +INSERT INTO tpls (pclt_id) VALUES('ARFDBE_DET_PARSERR'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'ARFDBE_DET_PARSERR', 'Провал перевода данных из формата БД в оперативный формат: ##|LLEXCPT##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'ARFDBE_DET_PARSERR', 'Failed to parse object data from DB format to operative one: ##|LLEXCPT##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (2,'ARFDBE_DET_PARSERR','##|ARFDBE_DET##|'); +INSERT INTO tpls (pclt_id) VALUES('ARFDBE_DET_SUBREADE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'ARFDBE_DET_SUBREADE', 'Провал подоперации, которая также связана с чтением из БД: @@|sub_arfdbe@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'ARFDBE_DET_SUBREADE', 'Subroutine, that is also about reading from DB, failed: @@|sub_arfdbe@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (2,'ARFDBE_DET_SUBREADE','##|ARFDBE_DET##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_PCLTC_DFCNTBUE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLTC_DFCNTBUE', '##|E_PCLTC_DFCNTBUE_PREFIX##|@@|pclt_dfcntbue_err_details@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLTC_DFCNTBUE', '##|E_PCLTC_DFCNTBUE_PREFIX##|@@|pclt_dfcntbue_err_details@@|.'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (5,'E_PCLTC_DFCNTBUE','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLTC_DFCNTBUE_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLTC_DFCNTBUE_PREFIX', 'Произошла ошибка при попытке спустить флаг сигнализирующий о том, что доступна новая версия каталога [ИД: @@|cat_id@@|]: '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLTC_DFCNTBUE_PREFIX', 'An error occured when trying to drop flag, which signalizes, that there is a new catalog [ID: @@|cat_id@@|] version is available:'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (5,'E_PCLTC_DFCNTBUE_PREFIX','##|E_PCLTC_DFCNTBUE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLTC_DFCNTBUE_NOMODIFY'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLTC_DFCNTBUE_NOMODIFY', 'запрос в БД на изменение таблицы содержащей флаг выполнен без ошибок, но и СУДБ отметила, что никакие данные не подвергались изменениям'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLTC_DFCNTBUE_NOMODIFY', 'modifying DB query was executed without errors, however DBMS returned, that no row was actually modified'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (5,'E_PCLTC_DFCNTBUE_NOMODIFY','##|E_PCLTC_DFCNTBUE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLTC_DFCNTBUE_DBERR'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLTC_DFCNTBUE_DBERR', '##|DB_ERROR##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLTC_DFCNTBUE_DBERR', '##|DB_ERROR##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (5,'E_PCLTC_DFCNTBUE_DBERR','##|E_PCLTC_DFCNTBUE##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_PCLTC_CUE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLTC_CUE', '##|E_PCLTC_CUE_PREFIX##| @@|pclt_cue_err_details@@|\n##|E_PCLTC_CUE_POSTFIX##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLTC_CUE', '##|E_PCLTC_CUE_PREFIX##|@@|pclt_cue_err_details@@|\n##|E_PCLTC_CUE_POSTFIX##|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (5,'E_PCLTC_CUE','##|LLEXCPT##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLTC_CUE_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLTC_CUE_PREFIX', 'Произошла одна или несколько ошибок при попытке обновить оперативную версию каталога [ИД: @@|cat_id@@|] (исторник обновления: БД): '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLTC_CUE_PREFIX', 'One or more errors occurred when trying to update operative version of catalog [ID: @@|cat_id@@|] (update source: DB):'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (5,'E_PCLTC_CUE_PREFIX','##|E_PCLTC_CUE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLTC_CUE_ARFDBE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLTC_CUE_ARFDBE', '\n ** Ошибка чтения из БД: @@|arfdbe@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLTC_CUE_ARFDBE', '\n ** An error, when reading from DB: @@|arfdbe@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (5,'E_PCLTC_CUE_ARFDBE','##|E_PCLTC_CUE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLTC_CUE_DFCNTBUE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLTC_CUE_DFCNTBUE', '\n ** Ошибка сброса флага новой версии каталога: @@|dfcntbue@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLTC_CUE_DFCNTBUE', '\n ** An error, when dropping a flag of a new catalog version: @@|dfcntbue@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (5,'E_PCLTC_CUE_DFCNTBUE','##|E_PCLTC_CUE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLTC_CUE_RLATCE_L'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLTC_CUE_RLATCE_L', '\n ** Ошибки чтения и формирования каталога: @@|cre_list@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLTC_CUE_RLATCE_L', '\n ** Catalog parsing errors: @@|cre_list@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (5,'E_PCLTC_CUE_RLATCE_L','##|E_PCLTC_CUE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLTC_CUE_APTTPTE_L'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLTC_CUE_APTTPTE_L', '\n ** Ошибки сборки множества шаблонов, из которых необходимо сформировать каталог: @@|cole_list@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLTC_CUE_APTTPTE_L', '\n ** Errors of collecting templates for catalog formation input: @@|cole_list@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (5,'E_PCLTC_CUE_APTTPTE_L','##|E_PCLTC_CUE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_PCLTC_CUE_POSTFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_PCLTC_CUE_POSTFIX', 'Каталог считан: @@|cat_read_wasit@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_PCLTC_CUE_POSTFIX', 'Catalog loaded: @@|cat_read_wasit@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (5,'E_PCLTC_CUE_POSTFIX','##|E_PCLTC_CUE##|'); + +-- These templates ar not for content but for representation requirement referencing that determines "ARFDBE" group templates requirements +INSERT INTO tpls (pclt_id) VALUES('ARFDBE_SDLR.Text.PCLT.Config.LaT_InnerConfig'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (5,'ARFDBE_SDLR.Text.PCLT.Config.LaT_InnerConfig','##|E_PCLTC_CUE_ARFDBE##|'); +INSERT INTO tpls (pclt_id) VALUES('ARFDBE_SDLR.Database.PCLT.InterfaceWithDB.RawCatalogDataReadFromDBResult'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (5,'ARFDBE_SDLR.Database.PCLT.InterfaceWithDB.RawCatalogDataReadFromDBResult','##|E_PCLTC_CUE_ARFDBE##|'); +INSERT INTO tpls (pclt_id) VALUES('ARFDBE_SDLR.Database.PCLT.InterfaceWithDB.CatalogReadFromDBResult'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (5,'ARFDBE_SDLR.Database.PCLT.InterfaceWithDB.CatalogReadFromDBResult','##|E_PCLTC_CUE_ARFDBE##|'); +INSERT INTO tpls (pclt_id) VALUES('ARFDBE_SDLR.Database.PCLT.InterfaceWithDB.CatalogNeedsToBeUpdated_DoesIt'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (5,'ARFDBE_SDLR.Database.PCLT.InterfaceWithDB.CatalogNeedsToBeUpdated_DoesIt','##|E_PCLTC_CUE_ARFDBE##|');
+ db/db_inst.sh view
@@ -0,0 +1,15 @@+#!/bin/sh++db_inst_log="db_inst.sh.log"+echo -e "\n\n-------------------------------\n-------Running DB script pclt_meta.sql\n" > $db_inst_log+psql -f pclt_meta.sql 2>&1 | cat >> $db_inst_log+echo -e "\n\n-------------------------------\n-------Running DB script pclt.sql (which also calls data.sql)\n" >> $db_inst_log+psql -f pclt.sql 2>&1 | cat >> $db_inst_log+echo -e "\n\n-------------------------------\n-------Running DB script view.sql\n" >> $db_inst_log+psql -f view.sql 2>&1 | cat >> $db_inst_log+echo -e "\n\n-------------------------------\n-------Data definition scripts finished.\nIf no explicit errors are found, one may also perform a small test using command\n psql -f ./local_test/tests.sql 2>&1 | less\n" >> $db_inst_log++echo -e "Examine $db_inst_log file for results." + +# data.sql is called from pclt.sql+
+ db/local_test/tests.sql view
@@ -0,0 +1,2 @@+\c pcltcatalogs user_pcltcatalogs_owner+select * from sch_pcltcatalogs.in_catalog_localized_tpls_with_their_sdls(50);
+ db/pclt.sql view
@@ -0,0 +1,507 @@+-- Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru> +-- +-- All rights reserved. +-- +-- For license and copyright information, see the file COPYRIGHT + +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- + +\c pcltcatalogs user_pcltcatalogs_owner + +SET search_path TO sch_pcltcatalogs, public; -- sets only for current session + +-------------------------------------------------------------------------------------------------------------- +-------------------------------------------------------------------------------------------------------------- +-------------------------------------------------------------------------------------------------------------- + +DROP FUNCTION IF EXISTS by_catalog_used_config (integer); +DROP FUNCTION IF EXISTS in_catalog_localized_tpls_with_their_sdls(integer); +DROP TYPE IF EXISTS type__catalog_ltpl_row; + +\echo +\echo **** DROPPING TRIGGERS. +\echo **** psql may throw a dosen of complains here, like "ERROR: relation "tpls_catalogs" does not exist", - just ignore that!.. +\echo +DROP TRIGGER IF EXISTS tri_tpls_catalogs_onupdate ON tpls_catalogs; +DROP TRIGGER IF EXISTS tri_tplscat_inner_configs_onupdate ON tplscat_inner_configs; +DROP TRIGGER IF EXISTS tri_tpls_collections_onupdate ON tpls_collections; +DROP TRIGGER IF EXISTS tri_tpls_onupdate ON tpls; +DROP TRIGGER IF EXISTS tri_tpls_oninsert ON tpls; +DROP TRIGGER IF EXISTS tri_tpls_localized_onupdate ON tpls_localized; +DROP TRIGGER IF EXISTS tri_tpls_inclusions_in_collections_onupdate ON tpls_inclusions_in_collections; +DROP TRIGGER IF EXISTS tri_tpls_representations_sdls_onupdate ON tpls_representations_sdls; +DROP TRIGGER IF EXISTS tri_collections_inclusions_in_catalogs_onupdate ON collections_inclusions_in_catalogs; +DROP TRIGGER IF EXISTS tri_collections_dependencies_onupdate ON collections_dependencies; + +DROP TABLE IF EXISTS collections_dependencies; +DROP TABLE IF EXISTS collections_inclusions_in_catalogs; +DROP TABLE IF EXISTS tpls_representations_sdls; +DROP TABLE IF EXISTS tpls_inclusions_in_collections; +DROP TABLE IF EXISTS tpls_localized; +DROP TABLE IF EXISTS tpls; +DROP TABLE IF EXISTS tpls_catalogs; +DROP SEQUENCE IF EXISTS tpls_catalogs_ids_seq; +DROP TABLE IF EXISTS tpls_detalization_policies; +DROP SEQUENCE IF EXISTS tpls_detalization_policies_ids_seq; +DROP TABLE IF EXISTS tpls_collections; +DROP SEQUENCE IF EXISTS tpls_collections_ids_seq; +DROP TABLE IF EXISTS tplscat_inner_configs; +DROP SEQUENCE IF EXISTS tplscat_inner_configs_ids_seq; +DROP TABLE IF EXISTS lang_localizables; +DROP TABLE IF EXISTS language_iso639_3; +DROP TABLE IF EXISTS nameables; + +-------------------------------------------------------------------------------------------------------------- +-------------------------------------------------------------------------------------------------------------- +-------------------------------------------------------------------------------------------------------------- + +CREATE TABLE nameables ( -- an ancestor table + name varchar NOT NULL DEFAULT '<name not given>' + , description varchar NULL + , comments varchar NULL +) TABLESPACE tabsp_pcltcatalogs; + +GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE nameables TO user_pcltCatalogs_data_admin; +GRANT SELECT ON TABLE nameables TO user_pcltCatalogs_data_reader; + +------------------------------------------------------------------------------ + +CREATE TABLE language_iso639_3 ( -- an ancestor table + lng varchar(3) PRIMARY KEY +) INHERITS (nameables) TABLESPACE tabsp_pcltcatalogs; + +INSERT INTO language_iso639_3 (lng, name) VALUES ('rus', 'Russian'), ('eng', 'English'); + +GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE language_iso639_3 TO user_pcltCatalogs_data_admin; +GRANT SELECT ON TABLE language_iso639_3 TO user_pcltCatalogs_data_reader; + +------------------------------------------------------------------------------ + +CREATE TABLE lang_localizables ( -- an ancestor table + lng varchar(3) NOT NULL REFERENCES language_iso639_3 (lng) ON DELETE RESTRICT ON UPDATE CASCADE +) TABLESPACE tabsp_pcltcatalogs; + +GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE lang_localizables TO user_pcltCatalogs_data_admin; +GRANT SELECT ON TABLE lang_localizables TO user_pcltCatalogs_data_reader; + +------------------------------------------------------------------------------ + +CREATE SEQUENCE tplscat_inner_configs_ids_seq INCREMENT BY 1 + MINVALUE 100 + START WITH 100 + NO CYCLE; + +CREATE TABLE tplscat_inner_configs ( + tplscat_inner_config_id integer DEFAULT nextval('tplscat_inner_configs_ids_seq') PRIMARY KEY + + , CompositePlaceholderWrapper varchar(10) NOT NULL DEFAULT '##|' + , ParameterPlaceholderWrapper varchar(10) NOT NULL DEFAULT '@@|' + , InsuficientDetLevelPlaceholder varchar(10) NOT NULL DEFAULT '#x#' + , MarkingErrorPlaceholderWrapper varchar(10) NOT NULL DEFAULT '/!E!\\' + , DefaultLanguage varchar(3) NOT NULL DEFAULT 'eng' REFERENCES language_iso639_3 (lng) ON DELETE RESTRICT ON UPDATE CASCADE + , StrictOrient_ofParamsAndCmpsts_onDfltLngTplsSets + varchar NOT NULL DEFAULT +' StrictOrient_ofParamsAndCmpsts_onDfltLngTplsSets { + soStrict_IsIt = True +, soExcludingInComposites = [] +, soExcludingComposites = [] +, soExcludingParameters = [] +, soExcludingCompComposites = [] +, soExcludingCompParameters = [] +}' + , AllowUntemplatedMessages boolean NOT NULL DEFAULT FALSE + , AllowUntemplatedLocalizationsOfMessages + boolean NOT NULL DEFAULT FALSE + , ShowAdhocParamsInResultOfUntemplated + boolean NOT NULL DEFAULT FALSE + , InstaniationResultMaxSize integer NOT NULL DEFAULT 10000000 + , AllowEmptySDL_parseItByModusMargin + boolean NOT NULL DEFAULT TRUE + , AllowUnreadableSDL_parseIdByModusMargin + boolean NOT NULL DEFAULT TRUE + , ReparsingDepthMax integer NOT NULL DEFAULT 100 + , ReparseParameterContentMaxSize integer NOT NULL DEFAULT 50000 + , Newline varchar NOT NULL DEFAULT E'\n' + +) INHERITS (nameables) TABLESPACE tabsp_pcltcatalogs; +INSERT INTO tplscat_inner_configs(tplscat_inner_config_id, name) VALUES (1, 'Default config'); + +GRANT USAGE ON SEQUENCE tplscat_inner_configs_ids_seq TO user_pcltCatalogs_data_admin; +GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE tplscat_inner_configs TO user_pcltCatalogs_data_admin; +GRANT SELECT ON TABLE tplscat_inner_configs TO user_pcltCatalogs_data_reader; + +------------------------------------------------------------------------------ + +CREATE SEQUENCE tpls_collections_ids_seq INCREMENT BY 1 + MINVALUE 100 + START WITH 100 + NO CYCLE; + +CREATE TABLE tpls_collections ( + tpls_collection_id integer DEFAULT nextval('tpls_collections_ids_seq') PRIMARY KEY +) INHERITS (nameables) TABLESPACE tabsp_pcltcatalogs; + +INSERT INTO tpls_collections(tpls_collection_id, name) VALUES (1, 'General commons'); +INSERT INTO tpls_collections(tpls_collection_id, name) VALUES (2, 'General DB commons'); +INSERT INTO tpls_collections(tpls_collection_id, name) VALUES (3, 'General networking commons'); +INSERT INTO tpls_collections(tpls_collection_id, name) VALUES (4, 'PCLT messages'); +INSERT INTO tpls_collections(tpls_collection_id, name) VALUES (5, 'PCLT-DB messages'); +INSERT INTO tpls_collections(tpls_collection_id, name) VALUES (10, 'Default commons'); + +GRANT USAGE ON SEQUENCE tpls_collections_ids_seq TO user_pcltCatalogs_data_admin; +GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE tpls_collections TO user_pcltCatalogs_data_admin; +GRANT SELECT ON TABLE tpls_collections TO user_pcltCatalogs_data_reader; + +------------------------------------------------------------------------------ + +CREATE SEQUENCE tpls_detalization_policies_ids_seq INCREMENT BY 1 + MINVALUE 100 + START WITH 100 + NO CYCLE; + +CREATE TABLE tpls_detalization_policies ( + tpls_detalization_policy_id integer DEFAULT nextval('tpls_detalization_policies_ids_seq') PRIMARY KEY +) INHERITS (nameables) TABLESPACE tabsp_pcltcatalogs; +INSERT INTO tpls_detalization_policies (tpls_detalization_policy_id, name, description) VALUES + (1, 'Minimal detailization requirements for all', 'The policy gets automatically filled by the AFTER INSERT trigger on tpls.') + , (5, 'Custom detailization requirements for all', 'The policy gets automatically filled by the AFTER INSERT trigger on tpls.') + , (9, 'Maximal detailization requirements for all', 'The policy gets automatically filled by the AFTER INSERT trigger on tpls.'); + +GRANT USAGE ON SEQUENCE tpls_detalization_policies_ids_seq TO user_pcltCatalogs_data_admin; +GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE tpls_detalization_policies TO user_pcltCatalogs_data_admin; +GRANT SELECT ON TABLE tpls_detalization_policies TO user_pcltCatalogs_data_reader; + +------------------------------------------------------------------------------ + +CREATE SEQUENCE tpls_catalogs_ids_seq INCREMENT BY 1 + MINVALUE 100 + START WITH 100 + NO CYCLE; + +CREATE TABLE tpls_catalogs ( + tpls_catalog_id integer NOT NULL DEFAULT nextval('tpls_catalogs_ids_seq') PRIMARY KEY + , tplscat_inner_config_id integer NOT NULL DEFAULT 1 REFERENCES tplscat_inner_configs(tplscat_inner_config_id) ON DELETE RESTRICT ON UPDATE CASCADE + , cat_new_version_available boolean NOT NULL DEFAULT TRUE + , tpls_detalization_policy_id integer NULL REFERENCES tpls_detalization_policies(tpls_detalization_policy_id) ON DELETE RESTRICT ON UPDATE CASCADE +) INHERITS (nameables) TABLESPACE tabsp_pcltcatalogs; + +INSERT INTO tpls_catalogs(tpls_catalog_id, name) VALUES (1, 'PCLT-DB initial catalog'); + +GRANT USAGE ON SEQUENCE tpls_catalogs_ids_seq TO user_pcltCatalogs_data_admin; +GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE tpls_catalogs TO user_pcltCatalogs_data_admin; +GRANT SELECT ON TABLE tpls_catalogs TO user_pcltCatalogs_data_reader; +GRANT UPDATE (cat_new_version_available) ON TABLE tpls_catalogs TO user_pcltCatalogs_data_reader; -- in next version this workaround will be removed + +------------------------------------------------------------------------------ + +CREATE TABLE tpls ( + pclt_id varchar PRIMARY KEY +) INHERITS (nameables) TABLESPACE tabsp_pcltcatalogs; + +GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE tpls TO user_pcltCatalogs_data_admin; +GRANT SELECT ON TABLE tpls TO user_pcltCatalogs_data_reader; + +------------------------------------------------------------------------------ + +CREATE TABLE tpls_localized ( + pclt_id varchar NOT NULL REFERENCES tpls (pclt_id) ON DELETE CASCADE ON UPDATE CASCADE + , structured_text varchar NOT NULL + , FOREIGN KEY (lng) REFERENCES language_iso639_3 (lng) ON DELETE RESTRICT ON UPDATE CASCADE + , PRIMARY KEY (lng, pclt_id) +) INHERITS (lang_localizables) TABLESPACE tabsp_pcltcatalogs; + +GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE tpls_localized TO user_pcltCatalogs_data_admin; +GRANT SELECT ON TABLE tpls_localized TO user_pcltCatalogs_data_reader; + +------------------------------------------------------------------------------ + +CREATE TABLE tpls_inclusions_in_collections ( + tpls_collection_id integer NOT NULL REFERENCES tpls_collections(tpls_collection_id) ON DELETE CASCADE ON UPDATE CASCADE + , pclt_id varchar NOT NULL REFERENCES tpls (pclt_id) ON DELETE CASCADE ON UPDATE CASCADE + , tpl_dflt_req_sdl varchar NOT NULL -- '+inf' < {number} < 'one' < 'zero' + , PRIMARY KEY (tpls_collection_id, pclt_id) +) TABLESPACE tabsp_pcltcatalogs; + +GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE tpls_inclusions_in_collections TO user_pcltCatalogs_data_admin; +GRANT SELECT ON TABLE tpls_inclusions_in_collections TO user_pcltCatalogs_data_reader; + +------------------------------------------------------------------------------ + +CREATE TABLE tpls_representations_sdls ( + tpls_detalization_policy_id integer NOT NULL REFERENCES tpls_detalization_policies(tpls_detalization_policy_id) ON DELETE RESTRICT ON UPDATE CASCADE + , pclt_id varchar NOT NULL REFERENCES tpls (pclt_id) ON DELETE CASCADE ON UPDATE CASCADE + , tpl_req_sdl varchar NULL -- '+inf' < {number} < 'one' < 'zero' + , PRIMARY KEY (pclt_id, tpls_detalization_policy_id) +) TABLESPACE tabsp_pcltcatalogs; + +-- A fast way to regulate current requirement of representation reciever's required detailization level minimum. +-- On every insertion of every template (in tpls table) a trigger gets executed, +-- which lookups from tpls_representations_sdls table first row that uses 5th policy, remembers used tpl_req_sdl, +-- inserts a new row into tpls_representations_sdls with same policy ID and tpl_req_sdl and with a reference +-- on a newly created template. +-- This way, there is an account for each template in 5th policy. In a similar way 1st and 9th policy gets filled, +-- but for these tpl_req_sdl is constant - 'zero' for 1st and '+inf' for 9th. Using simple funcion below one may +-- perform fast regulation or tpl_req_sdl used by 5th policy. +-- Then by fast switching of policy used by catalog from some userdefined to 1st, 5th or 9th user may regulate +-- representation requirement for all template at once. +CREATE OR REPLACE FUNCTION setSDL_forAll5 (varchar) RETURNS VOID AS $$ -- $1 is a new tpl_req_sdl for all templates in a 5th policy + UPDATE tpls_representations_sdls SET tpl_req_sdl = $1 WHERE tpls_detalization_policy_id = 5; +$$ LANGUAGE SQL; + +GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE tpls_representations_sdls TO user_pcltCatalogs_data_admin; +GRANT SELECT ON TABLE tpls_representations_sdls TO user_pcltCatalogs_data_reader; +GRANT EXECUTE ON FUNCTION setSDL_forAll5 (varchar) TO user_pcltCatalogs_data_admin; + +------------------------------------------------------------------------------ + +CREATE TABLE collections_inclusions_in_catalogs ( + tpls_collection_id integer NOT NULL REFERENCES tpls_collections(tpls_collection_id) ON DELETE CASCADE ON UPDATE CASCADE + , tpls_catalog_id integer NOT NULL REFERENCES tpls_catalogs(tpls_catalog_id) ON DELETE CASCADE ON UPDATE CASCADE + , PRIMARY KEY (tpls_collection_id, tpls_catalog_id) +) TABLESPACE tabsp_pcltcatalogs; + +INSERT INTO collections_inclusions_in_catalogs(tpls_catalog_id, tpls_collection_id) VALUES (1 , 10); + +GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE collections_inclusions_in_catalogs TO user_pcltCatalogs_data_admin; +GRANT SELECT ON TABLE collections_inclusions_in_catalogs TO user_pcltCatalogs_data_reader; + +------------------------------------------------------------------------------ + +CREATE TABLE collections_dependencies ( + tpls_collection_rer_id integer NOT NULL REFERENCES tpls_collections(tpls_collection_id) ON DELETE CASCADE ON UPDATE CASCADE + , tpls_collection_red_id integer NOT NULL REFERENCES tpls_collections(tpls_collection_id) ON DELETE RESTRICT ON UPDATE CASCADE + -- rer = requirer; red = required + , PRIMARY KEY (tpls_collection_rer_id, tpls_collection_red_id) +) TABLESPACE tabsp_pcltcatalogs; + +INSERT INTO collections_dependencies(tpls_collection_rer_id, tpls_collection_red_id) VALUES (10, 1); +INSERT INTO collections_dependencies(tpls_collection_rer_id, tpls_collection_red_id) VALUES (10, 2); +INSERT INTO collections_dependencies(tpls_collection_rer_id, tpls_collection_red_id) VALUES (10, 3); +INSERT INTO collections_dependencies(tpls_collection_rer_id, tpls_collection_red_id) VALUES (10, 4); +INSERT INTO collections_dependencies(tpls_collection_rer_id, tpls_collection_red_id) VALUES (10, 5); + +GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE collections_dependencies TO user_pcltCatalogs_data_admin; +GRANT SELECT ON TABLE collections_dependencies TO user_pcltCatalogs_data_reader; + +------------------------------------------------------------------------------ +-------------------------------------------------------------------------------------------------------------- + +CREATE OR REPLACE FUNCTION catalogs_thatuse_tpls_collections (integer,integer) RETURNS SETOF integer AS $$ + SELECT tpls_catalog_id + FROM collections_inclusions_in_catalogs + WHERE tpls_collection_id = $1 OR tpls_collection_id = $2 +$$ LANGUAGE SQL; + +CREATE OR REPLACE FUNCTION catalogs_thatuse_tpls (varchar, varchar) RETURNS SETOF integer AS $$ + SELECT tpls_catalog_id + FROM collections_inclusions_in_catalogs ciic + , tpls_inclusions_in_collections tiic + WHERE ciic.tpls_collection_id = tiic.tpls_collection_id + AND (tiic.pclt_id = $1 OR tiic.pclt_id = $2) +$$ LANGUAGE SQL; + +GRANT EXECUTE ON FUNCTION catalogs_thatuse_tpls_collections (integer,integer) TO user_pcltCatalogs_data_admin; +GRANT EXECUTE ON FUNCTION catalogs_thatuse_tpls_collections (integer,integer) TO user_pcltCatalogs_data_reader; +GRANT EXECUTE ON FUNCTION catalogs_thatuse_tpls (varchar,varchar) TO user_pcltCatalogs_data_admin; +GRANT EXECUTE ON FUNCTION catalogs_thatuse_tpls (varchar,varchar) TO user_pcltCatalogs_data_reader; + +-------------------------------------------------------------------------------- + +CREATE OR REPLACE FUNCTION tpls_catalogs_onupdate() RETURNS trigger AS $tri_tpls_catalogs_onupdate$ -- upd +BEGIN + NEW.cat_new_version_available := TRUE; + RETURN NEW; +END; +$tri_tpls_catalogs_onupdate$ LANGUAGE plpgsql; + +CREATE OR REPLACE FUNCTION tplscat_inner_configs_onupdate() RETURNS trigger AS $tri_tplscat_inner_configs_onupdate$ -- upd +BEGIN + UPDATE tpls_catalogs AS tc + SET cat_new_version_available = TRUE + WHERE tc.tplscat_inner_config_id = OLD.tplscat_inner_config_id + OR tc.tplscat_inner_config_id = NEW.tplscat_inner_config_id; + + RETURN NEW; +END; +$tri_tplscat_inner_configs_onupdate$ LANGUAGE plpgsql; + +CREATE OR REPLACE FUNCTION tpls_collections_onupdate() RETURNS trigger AS $tri_tpls_collections_onupdate$ -- upd, del +DECLARE + old_col_id integer := NULL; +BEGIN + IF TG_OP = 'UPDATE' THEN + old_col_id := OLD.tpls_collection_id; + END IF; + UPDATE tpls_catalogs AS tc + SET cat_new_version_available = TRUE + WHERE tc.tpls_catalog_id IN (SELECT * FROM catalogs_thatuse_tpls_collections (old_col_id, NEW.tpls_collection_id)); + + RETURN NEW; +END; +$tri_tpls_collections_onupdate$ LANGUAGE plpgsql; + +CREATE OR REPLACE FUNCTION tpls_onupdate() RETURNS trigger AS $tri_tpls_onupdate$ -- upd, del +DECLARE + old_tpl_id varchar := NULL; +BEGIN + IF TG_OP = 'UPDATE' THEN + old_tpl_id := OLD.pclt_id; + END IF; + UPDATE tpls_catalogs AS tc + SET cat_new_version_available = TRUE + WHERE tc.tpls_catalog_id IN (SELECT * FROM catalogs_thatuse_tpls (old_tpl_id, NEW.pclt_id)); + + RETURN NEW; +END; +$tri_tpls_onupdate$ LANGUAGE plpgsql; + +CREATE OR REPLACE FUNCTION tpls_oninsert() RETURNS trigger AS $tri_tpls_oninsert$ -- ins +DECLARE + custom_sdl varchar; +BEGIN + SELECT tpl_req_sdl INTO custom_sdl FROM tpls_representations_sdls WHERE tpls_detalization_policy_id = 5 LIMIT 1; + INSERT INTO tpls_representations_sdls (tpls_detalization_policy_id, pclt_id, tpl_req_sdl) + SELECT tpls_detalization_policy_id + , NEW.pclt_id + , CASE tpls_detalization_policy_id + WHEN 1 THEN 'zero' + WHEN 5 THEN custom_sdl + WHEN 9 THEN '+inf' + END + FROM tpls_detalization_policies + WHERE tpls_detalization_policy_id IN (1, 5, 9); + + RETURN NEW; +END; +$tri_tpls_oninsert$ LANGUAGE plpgsql; + +CREATE OR REPLACE FUNCTION tpls_localized_onupdate() RETURNS trigger AS $tri_tpls_localized_onupdate$ -- upd, del, ins +DECLARE + old_tpl_id varchar := NULL; + new_tpl_id varchar := NULL; +BEGIN + IF TG_OP = 'INSERT' THEN + new_tpl_id := NEW.pclt_id; + ELSIF TG_OP = 'DELETE' THEN + old_tpl_id := OLD.pclt_id; + ELSIF TG_OP = 'UPDATE' THEN + new_tpl_id := NEW.pclt_id; + old_tpl_id := OLD.pclt_id; + END IF; + UPDATE tpls_catalogs AS tc + SET cat_new_version_available = TRUE + WHERE tc.tpls_catalog_id IN (SELECT * FROM catalogs_thatuse_tpls (new_tpl_id, old_tpl_id)); + + RETURN NEW; +END; +$tri_tpls_localized_onupdate$ LANGUAGE plpgsql; + +CREATE OR REPLACE FUNCTION tpls_inclusions_in_collections_onupdate() RETURNS trigger AS $tri_tpls_inclusions_in_collections_onupdate$ -- upd, del, ins +DECLARE + old_col_id integer := NULL; + new_col_id integer := NULL; +BEGIN + IF TG_OP = 'INSERT' THEN + new_col_id := NEW.tpls_collection_id; + ELSIF TG_OP = 'DELETE' THEN + old_col_id := OLD.tpls_collection_id; + ELSIF TG_OP = 'UPDATE' THEN + new_col_id := NEW.tpls_collection_id; + old_col_id := OLD.tpls_collection_id; + END IF; + UPDATE tpls_catalogs AS tc + SET cat_new_version_available = TRUE + WHERE tc.tpls_catalog_id IN (SELECT * FROM catalogs_thatuse_tpls_collections (old_col_id, new_col_id)); + + RETURN NEW; +END; +$tri_tpls_inclusions_in_collections_onupdate$ LANGUAGE plpgsql; + +CREATE OR REPLACE FUNCTION tpls_representations_sdls_onupdate() RETURNS trigger AS $tri_tpls_representations_sdls_onupdate$ -- upd, ins, del +DECLARE + old_dp_id integer := NULL; + new_dp_id integer := NULL; +BEGIN + IF TG_OP = 'INSERT' THEN + new_dp_id := NEW.tpls_detalization_policy_id; + ELSIF TG_OP = 'DELETE' THEN + old_dp_id := OLD.tpls_detalization_policy_id; + ELSIF TG_OP = 'UPDATE' THEN + new_dp_id := NEW.tpls_detalization_policy_id; + old_dp_id := OLD.tpls_detalization_policy_id; + END IF; + UPDATE tpls_catalogs AS tc + SET cat_new_version_available = TRUE + WHERE tc.tpls_detalization_policy_id = old_dp_id + OR tc.tpls_detalization_policy_id = new_dp_id; + + RETURN NEW; +END; +$tri_tpls_representations_sdls_onupdate$ LANGUAGE plpgsql; + +CREATE OR REPLACE FUNCTION collections_inclusions_in_catalogs_onupdate() RETURNS trigger AS $tri_collections_inclusions_in_catalogs_onupdate$ -- upd, ins, del +DECLARE + old_cat_id integer := NULL; + new_cat_id integer := NULL; +BEGIN + IF TG_OP = 'INSERT' THEN + new_cat_id := NEW.tpls_catalog_id; + ELSIF TG_OP = 'DELETE' THEN + old_cat_id := OLD.tpls_catalog_id; + ELSIF TG_OP = 'UPDATE' THEN + new_cat_id := NEW.tpls_catalog_id; + old_cat_id := OLD.tpls_catalog_id; + END IF; + UPDATE tpls_catalogs AS tc + SET cat_new_version_available = TRUE + WHERE tc.tpls_catalog_id = old_cat_id + OR tc.tpls_catalog_id = new_cat_id; + + RETURN NEW; +END; +$tri_collections_inclusions_in_catalogs_onupdate$ LANGUAGE plpgsql; + +CREATE OR REPLACE FUNCTION collections_dependencies_onupdate() RETURNS trigger AS $tri_collections_dependencies_onupdate$ -- upd, ins, del +DECLARE + old_col_id integer := NULL; + new_col_id integer := NULL; +BEGIN + IF TG_OP = 'INSERT' THEN + new_col_id := NEW.tpls_collection_rer_id; + ELSIF TG_OP = 'DELETE' THEN + old_col_id := OLD.tpls_collection_rer_id; + ELSIF TG_OP = 'UPDATE' THEN + new_col_id := NEW.tpls_collection_rer_id; + old_col_id := OLD.tpls_collection_rer_id; + END IF; + UPDATE tpls_catalogs AS tc + SET cat_new_version_available = TRUE + WHERE tc.tpls_catalog_id IN (SELECT * FROM catalogs_thatuse_tpls_collections (old_col_id, new_col_id)); + + RETURN NEW; +END; +$tri_collections_dependencies_onupdate$ LANGUAGE plpgsql; + +\i data.sql + +CREATE TRIGGER tri_tpls_catalogs_onupdate AFTER UPDATE ON tpls_catalogs + FOR EACH ROW EXECUTE PROCEDURE tpls_catalogs_onupdate(); +CREATE TRIGGER tri_tplscat_inner_configs_onupdate AFTER UPDATE ON tplscat_inner_configs + FOR EACH ROW EXECUTE PROCEDURE tplscat_inner_configs_onupdate(); +CREATE TRIGGER tri_tpls_collections_onupdate AFTER UPDATE OR DELETE ON tpls_collections + FOR EACH ROW EXECUTE PROCEDURE tpls_collections_onupdate(); +CREATE TRIGGER tri_tpls_onupdate AFTER UPDATE OR DELETE ON tpls + FOR EACH ROW EXECUTE PROCEDURE tpls_onupdate(); +CREATE TRIGGER tri_tpls_oninsert AFTER UPDATE OR DELETE ON tpls + FOR EACH ROW EXECUTE PROCEDURE tpls_oninsert(); +CREATE TRIGGER tri_tpls_localized_onupdate AFTER UPDATE OR DELETE OR INSERT ON tpls_localized + FOR EACH ROW EXECUTE PROCEDURE tpls_localized_onupdate(); +CREATE TRIGGER tri_tpls_inclusions_in_collections_onupdate AFTER UPDATE OR DELETE OR INSERT ON tpls_inclusions_in_collections + FOR EACH ROW EXECUTE PROCEDURE tpls_inclusions_in_collections_onupdate(); +CREATE TRIGGER tri_tpls_representations_sdls_onupdate AFTER UPDATE OR DELETE OR INSERT ON tpls_representations_sdls + FOR EACH ROW EXECUTE PROCEDURE tpls_representations_sdls_onupdate(); +CREATE TRIGGER tri_collections_inclusions_in_catalogs_onupdate AFTER UPDATE OR DELETE OR INSERT ON collections_inclusions_in_catalogs + FOR EACH ROW EXECUTE PROCEDURE collections_inclusions_in_catalogs_onupdate(); +CREATE TRIGGER tri_collections_dependencies_onupdate AFTER UPDATE OR DELETE OR INSERT ON collections_dependencies + FOR EACH ROW EXECUTE PROCEDURE collections_dependencies_onupdate();
+ db/pclt_meta.sql view
@@ -0,0 +1,67 @@+-- Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru>+-- +-- All rights reserved.+-- +-- For license and copyright information, see the file COPYRIGHT++--------------------------------------------------------------------------+--------------------------------------------------------------------------++\! clear++DROP DATABASE IF EXISTS pcltCatalogs;+DROP TABLESPACE IF EXISTS tabsp_pcltCatalogs;++\! rm -rf /var/lib/postgres/data/pg_tblspc/pcltCatalogs++DROP ROLE IF EXISTS user_pcltCatalogs_data_reader;+DROP ROLE IF EXISTS user_pcltCatalogs_data_admin;+DROP ROLE IF EXISTS user_pcltCatalogs_owner;++---------------------------------+---------------------------------+---------------------------------++CREATE ROLE user_pcltCatalogs_owner + WITH SUPERUSER + NOCREATEDB+ LOGIN+ CREATEROLE+ UNENCRYPTED PASSWORD 'owner_password';++CREATE ROLE user_pcltCatalogs_data_admin + WITH LOGIN+ UNENCRYPTED PASSWORD 'data_admin_password';++CREATE ROLE user_pcltCatalogs_data_reader + WITH LOGIN+ UNENCRYPTED PASSWORD 'data_reader_password';++-------------------------++\! mkdir /var/lib/postgres/data/pg_tblspc/pcltCatalogs+\! mkdir /var/lib/postgres/data/pg_tblspc/pcltCatalogs/tabsp_pcltCatalogs.data++CREATE TABLESPACE tabsp_pcltCatalogs + OWNER user_pcltCatalogs_owner + LOCATION '/var/lib/postgres/data/pg_tblspc/pcltCatalogs/tabsp_pcltCatalogs.data';++-------------------------++CREATE DATABASE pcltCatalogs+ WITH OWNER = user_pcltCatalogs_owner + ENCODING = 'UTF8'+ TABLESPACE = tabsp_pcltCatalogs;++GRANT CONNECT ON DATABASE pcltCatalogs TO user_pcltCatalogs_data_admin, user_pcltCatalogs_data_reader;++-------------------------+-- (1) case sensetive (2) postgres lowercases real names+\c pcltcatalogs user_pcltcatalogs_owner++CREATE LANGUAGE plpgsql;++CREATE SCHEMA sch_pcltCatalogs AUTHORIZATION user_pcltCatalogs_owner;++GRANT USAGE ON SCHEMA sch_pcltCatalogs TO user_pcltCatalogs_data_admin, user_pcltCatalogs_data_reader;+
+ db/view.sql view
@@ -0,0 +1,87 @@+-- Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru> +-- +-- All rights reserved. +-- +-- For license and copyright information, see the file COPYRIGHT + +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- + +\c pcltcatalogs user_pcltcatalogs_owner + +SET search_path TO sch_pcltcatalogs, public; + +DROP FUNCTION IF EXISTS in_catalog_localized_tpls_with_their_sdls(integer); +DROP TYPE IF EXISTS type__catalog_ltpl_row; + +CREATE TYPE type__catalog_ltpl_row AS ( + pclt_id varchar + , tpl_req_sdl varchar + , structured_text varchar + , lng varchar(3) +); + +CREATE OR REPLACE FUNCTION in_catalog_localized_tpls_with_their_sdls (integer) RETURNS SETOF type__catalog_ltpl_row AS $$ +-- i don't know, why it doesn't allow me to name parameter as par__cat_id... well $1 = catalog_id for wich we are viewing catalog entries... + WITH RECURSIVE included_collections (tpls_collection_rer_id, tpls_collection_red_id) AS ( + SELECT tpls_collection_rer_id, tpls_collection_red_id + FROM sch_pcltcatalogs.collections_dependencies + WHERE tpls_collection_rer_id IN ( + SELECT tpls_collection_id + FROM sch_pcltcatalogs.collections_inclusions_in_catalogs + WHERE tpls_catalog_id = $1 + ) + UNION + SELECT cd.tpls_collection_rer_id, cd.tpls_collection_red_id + FROM included_collections ic, sch_pcltcatalogs.collections_dependencies cd + WHERE ic.tpls_collection_red_id = cd.tpls_collection_rer_id + ), used_collections AS ( + SELECT tpls_collection_id + FROM ( + SELECT tpls_collection_id + FROM sch_pcltcatalogs.collections_inclusions_in_catalogs + WHERE tpls_catalog_id = $1 + ) AS top_collection_ids + UNION + SELECT tpls_collection_red_id AS tpls_collection_id FROM included_collections + ), used_tpls_w_default_sdls AS ( + SELECT pclt_id, tpl_dflt_req_sdl + FROM sch_pcltcatalogs.tpls_inclusions_in_collections tiic, used_collections uc + WHERE uc.tpls_collection_id = tiic.tpls_collection_id + ), used_tpls_representations_sdls AS ( + SELECT trs.pclt_id, trs.tpl_req_sdl + FROM sch_pcltcatalogs.tpls_representations_sdls trs + , sch_pcltcatalogs.tpls_detalization_policies trp + , sch_pcltcatalogs.tpls_catalogs tc + WHERE tc.tpls_detalization_policy_id = trp.tpls_detalization_policy_id + AND trs.tpls_detalization_policy_id = trp.tpls_detalization_policy_id + ), used_tpls_w_sdls AS ( + SELECT DISTINCT utds.pclt_id, CASE utrs.tpl_req_sdl is NULL WHEN TRUE THEN utds.tpl_dflt_req_sdl ELSE utrs.tpl_req_sdl END AS tpl_req_sdl + FROM used_tpls_w_default_sdls utds + LEFT OUTER JOIN + used_tpls_representations_sdls utrs + ON utds.pclt_id = utrs.pclt_id + ), used_localized_tpls_w_sdls AS ( + SELECT tl.pclt_id, uts.tpl_req_sdl, tl.structured_text, tl.lng + FROM used_tpls_w_sdls uts + , sch_pcltcatalogs.tpls_localized tl + WHERE tl.pclt_id = uts.pclt_id + ) + SELECT * FROM used_localized_tpls_w_sdls; +$$ LANGUAGE SQL; + +GRANT EXECUTE ON FUNCTION in_catalog_localized_tpls_with_their_sdls (integer) TO user_pcltCatalogs_data_admin; +GRANT EXECUTE ON FUNCTION in_catalog_localized_tpls_with_their_sdls (integer) TO user_pcltCatalogs_data_reader; + +------------------------------------------------------------------------------------------------------------------- + +CREATE OR REPLACE FUNCTION by_catalog_used_config (integer) RETURNS SETOF tplscat_inner_configs AS $$ + SELECT tic.* + FROM sch_pcltcatalogs.tplscat_inner_configs AS tic + , sch_pcltcatalogs.tpls_catalogs AS tcat + WHERE tic.tplscat_inner_config_id = tcat.tplscat_inner_config_id -- dont know why NATURAL JOIN didn't work + AND tcat.tpls_catalog_id = $1; +$$ LANGUAGE SQL; + +GRANT EXECUTE ON FUNCTION by_catalog_used_config (integer) TO user_pcltCatalogs_data_admin; +GRANT EXECUTE ON FUNCTION by_catalog_used_config (integer) TO user_pcltCatalogs_data_reader;
+ doinst.sh view
@@ -0,0 +1,19 @@+#!/bin/sh++clear+sudo runghc Setup unregister+sudo runghc Setup configure --user+sudo runghc Setup build+sudo runghc Setup haddock+sudo runghc Setup install++echo+echo "###################################"+echo "#"+echo "# Before (or after) installing this Cabal package one should also install DB." +echo "# " +echo "# The package uses PostgreSQL 8.4 (not earlier version)."+echo "# Examine and run file ./db/db_inst.sh under user account," +echo "# that is used on your system as a PostgreSQL DBMS superuser."+echo "#"+echo "###################################"
+ examples/HelloWorld/HelloWorld.PCLTCatalog.ods view
binary file changed (absent → 38297 bytes)
+ examples/HelloWorld/HelloWorld.hs view
@@ -0,0 +1,266 @@+{- +Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru> + +All rights reserved. + +For license and copyright information, see the file COPYRIGHT +-} + +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- + +{-# LANGUAGE DeriveDataTypeable #-} + +-- 1) HelloWorld program that doesn't use PCLT and PCLT-DB packages is to be found in PCLT packages examples directory. +-- 2) HelloWorld program that uses only PCLT (but no PCLT-DB) package is to be found in PCLT packages examples directory. All the explanations about using PCLT are also there, but here are omited. +-- 3)< HelloWorld program that uses both PCLT and PCLT-DB packages is the one you are currently looking at. +-- It's best to understand (1) and (2) before trying to understand what's going on in this listing here. +-- Before running this exaple user must run HelloWorld.sql + +module HelloWorld where + +----------------------------------------------------- +-- Modules necessary for our PCLTCatalog + +import Control.Concurrent +import Database.HDBC +import Database.HDBC.PostgreSQL +import qualified Data.ByteString.Lazy.UTF8.Unified as Lazy (ByteString) +import qualified Data.ByteString.Lazy.UTF8.Unified as B hiding (ByteString) +import Data.List +import qualified Data.Map as M +import Data.Map (Map, (!)) +import Data.Typeable + + +import qualified Text.ConstraintedLBS as CB +import Database.PCLT -- this module exports most required PCLT-DB modules +import Text.PCLT + +import Prelude hiding (putStrLn, readLn) +import System.IO hiding (putStrLn, readLn, hPutStr) +import System.IO.UTF8 -- putStrLn from here will be used to correctly output russian letters + +----------------------------------------------------- +----------------------------------------------------- +-- Application specific modules +import Control.Exception +import HelloWorld_Data -- Application specific ADTs and type synonyms +import HelloWorld__ -- instances for ShowAsPCSI and HasStaticRawPCLTs + +----------------------------------------------------- +----------------------------------------------------- +-- Functional part of app + +type SayHelloWorld_Mode = Int +sayHelloWorld :: SayHelloWorld_Mode -> Either HelloWorldError HelloWorld +sayHelloWorld mode = + case mode of + 0 -> Right HelloWorld + 1 -> Left NoWorld_HWE + 2 -> Left $ AmbiguousChoiceOfWorlds_HWE ("RealWorld", 1) ("VirtualWorld", 2) [("OtherWorld1", 3), ("OtherWorld2", 4), ("OtherWorld3", 5)] + 3 -> Left $ SomeVeryStrangeError_HWE 5789 "Noise..." True (Just True) Nothing (SomeException DivideByZero) + 4 -> Left $ FailedDueToErrorInSubsystem_HWE ErrorType1_EIS + 5 -> Left $ FailedDueToErrorInSubsystem_HWE ErrorType2_EIS + 6 -> Left $ FailedDueToErrorInSubsystem_HWE $ FailedDueToErrorInSub_sub_system_EIS ErrorType1_EISS + 7 -> Left $ FailedDueToErrorInSubsystem_HWE $ FailedDueToErrorInSub_sub_system_EIS ErrorType2_EISS + +------------------------------------- + +--some constants required by catalogizing system +__db_name = "pcltcatalogs" +__dbms_user = "user_pcltcatalogs_data_reader" +__dbms_user_password = "data_reader_password" +__connection_string_delimiter = " " +__connectionString = "dbname=" ++ __db_name ++ __connection_string_delimiter +__connectionString' = __connectionString ++ "user=" ++ __dbms_user ++ __connection_string_delimiter +__connectionString'' = __connectionString' ++ "password=" ++ __dbms_user_password ++ __connection_string_delimiter + +__update_frequency_sec = 8 +__my_lng = "rus" -- possible values: "eng", "rus", "hs_" +__my_sdl = InfinitelyBig_SDL -- possible values: Zero_SDL < One_SDL < SDL Int < InfinitelyBig_SDL +__my_stderr_clbs_size = 50000 +__my_stdout_clbs_size = 50000 +__catalog_id = 50 + +type Microseconds = Int + +data CatalogControl = -- MVar of this will be in between HelloWorld mainmodule and thread that will regularly update catalog from DB + CatalogControl { + catcCatalogMV :: MVar PCLT_Catalog + , catcUpdateFrequency :: MVar Microseconds + , catcUpdatorLoopHolder :: MVar Bool -- initialized as True; whenever we putthis to False, the next iteration on of update cycle begins with service termination + , catcUpdatorTaskTriggerChan :: Chan Bool -- between iterations service awaits on this channel; we regularly send thereit gets catcUpdatorLoopHolder value; if False is sent, updator finishes + , catcUpdatorTaskTriggerThreadID :: ThreadId + , catcUpdatorThreadID :: ThreadId + } deriving (Typeable) + +acquireCatalog :: StdErr_CLBS -> (ShowDetalizationLevel, LanguageName) -> IO (CatalogControl, MVar StdErr_CLBS) +acquireCatalog stderr_clbs (stderr_sdl, stderr_lng) = do + let catalog_config = + defaultPCLTInnerConfig { + pcsStrictOrient_ofParamsAndCmpsts_onDfltLngTplsSets = + (pcsStrictOrient_ofParamsAndCmpsts_onDfltLngTplsSets defaultPCLTInnerConfig) { + soExcludingCompParameters = soExcludingCompParameters (pcsStrictOrient_ofParamsAndCmpsts_onDfltLngTplsSets defaultPCLTInnerConfig) + ++ [("E_HWE_AMBWRLDCH_OW", "__row_idx")] -- this is described in a HelloWorld that uses only PCLT (but no PCLT-DB) + } + } + updateFrequency_mv <- newMVar (__update_frequency_sec * 1000000) + updatorLoopHolder_mv <- newMVar True + let taskEnablerCycle :: Chan Bool -> IO () + taskEnablerCycle ch = do + freq <- readMVar updateFrequency_mv + threadDelay freq + enabled_isit <- readMVar updatorLoopHolder_mv + putStrLn "#catalog updated...#" + writeChan ch enabled_isit + case enabled_isit of + True -> taskEnablerCycle ch + False -> return () + let taskEnablerThread :: IO (Chan Bool, ThreadId) -- this thread will regularly stimulate iterations of catalog updator + taskEnablerThread = do + ch <- newChan + tm_TID <- forkIO $ taskEnablerCycle ch + return (ch, tm_TID) + (aliveChan, tm_TID) <- taskEnablerThread -- thread started + stderr_clbs_mv <- newMVar stderr_clbs + let errorsReporter :: PCLT_Catalog -> CatalogUpdateFromDBErrors -> IO () -- ths is how the catalog updator service must react on catalog read failure (due to error); if catalog isn't read, the previous version of catalog is used here + errorsReporter cat cue = modifyMVar_ + stderr_clbs_mv + (\ _errs_clbs -> return $ pcsi2text_plus_errs_1 _errs_clbs (showAsPCSI cue) (__my_sdl, __my_lng) cat ) + serviceStart :: IO CatalogControl + serviceStart = do + db_conn <- connectPostgreSQL __connectionString'' + serv_db_conn <- clone db_conn -- good practice for cases, when have multiple same connections - make a prototype and clone it as many times as needed + (cat_mv, us_TID) <- runCatalogUpdatorService + (__catalog_id, catalog_config, PCLTRawCatalog__HelloWorld) -- With this catalog updator will start it's service. This way we ensure, that even if DB connection fails, we still have a catalog available. + (serv_db_conn, True) -- True says, that server must disconnect assigned to it DB connection, when it finishes + errorsReporter + aliveChan + disconnect db_conn -- prototype isn't needed anymore + return CatalogControl { + catcCatalogMV = cat_mv + , catcUpdateFrequency = updateFrequency_mv + , catcUpdatorLoopHolder = updatorLoopHolder_mv + , catcUpdatorTaskTriggerChan = aliveChan + , catcUpdatorTaskTriggerThreadID = tm_TID + , catcUpdatorThreadID = us_TID + } + cc <- serviceStart + return (cc, stderr_clbs_mv) + +showHelloWorld :: SayHelloWorld_Mode -> (StdOut_CLBS, StdErr_CLBS) -> (ShowDetalizationLevel, LanguageName, PCLT_Catalog) -> (StdOut_CLBS, StdErr_CLBS) +showHelloWorld mode (stdout_clbs, stderr_clbs) (sdl, lng, catalog) = -- showHelloWorld here doesn't differ the HelloWorld, that uses only PCLT (but no PCLT-DB) - it is described there + let err_or_HelloWorld = sayHelloWorld mode + (new_stdout_clbs, new_stderr_clbs) = + pcsi2text_plus_errs_2 + (stdout_clbs, stderr_clbs) + (showAsPCSI err_or_HelloWorld) + (sdl, lng) + catalog + in (new_stdout_clbs, new_stderr_clbs) + +main = run_test __my_lng __my_sdl + +run_test _lng _sdl = + let stderr_clbs0 = newCLBS __my_stderr_clbs_size + stdout_clbs0 = newCLBS __my_stdout_clbs_size + in do (catalog_control, stderr_clbs_mv) <- acquireCatalog stderr_clbs0 (__my_sdl, __my_lng) + putStrLn ("Language, SDL (detailization level), update frequency (sec): " ++ show (_lng, _sdl, __update_frequency_sec)) + putStrLn "----Init-errors:-----------------" + stderr_clbs1 <- modifyMVar stderr_clbs_mv (\ stderr_clbs1 -> return (stderr_clbs0, stderr_clbs1)) + putStrLn $ show stderr_clbs1 + dump stderr_clbs1 + putStrLn "----Cycle-start:-----------------" + let iterate_ = do + putStrLn "----New-iteration:---------------" + putStrLn "Input sayHelloWorld mode (0-7; '-1' to exit): " + mode <- readLn + case mode >= 0 && mode <= 7 of + True -> do (stdout_clbs1, stderr_clbs1) <- -- stderr_clbs1 accumulates all errors from work of catalog udator servece, and independently also accumulates errors from interaction with user + withMVar + (catcCatalogMV catalog_control) + (\ catalog -> + modifyMVar + stderr_clbs_mv + (\ _stderr_clbs -> + return ( stderr_clbs0 -- in each iteration of interaction with user, stderr gets shown and emptyed + , showHelloWorld + mode + (stdout_clbs0, _stderr_clbs) + (__my_sdl, __my_lng, catalog) + ) + + ) + ) + putStrLn "----Errors:----------------------" + putStrLn_paged 12 $ show stderr_clbs1 + putStrLn "----Output:----------------------" + putStrLn $ show stdout_clbs1 + iterate_ + False -> case mode == (-1) of + True -> modifyMVar_ (catcUpdatorLoopHolder catalog_control) (\ _ -> return False) -- tell updator services to finish + False -> iterate_ + iterate_ + + +putStrLn_paged :: Int -> String -> IO () +putStrLn_paged page_size s = f $ lines s + where + f lines_list = + let (to_print, to_next_itera) = splitAt page_size lines_list + in do putStrLn (concat $ intersperse "\n" to_print) + case null to_next_itera of + True -> return () + False -> f to_next_itera << hGetChar stdin << putStrLn "\n-------Press any key to continue...-------" + +dump :: Show a => a -> IO () +dump a = do + h <- openFile "./dump.out" WriteMode -- WriteMode -- AppendMode + hPutStr h $ show a + hClose h + +infixr 1 << +(<<) :: Monad m => m b -> m a -> m b +f << x = x >> f + +----------------------------------------------------- +----------------------------------------------------- +-- Representations + +-- moved to file HelloWorld__.hs + +{- +------------------------------------------------------------------------- +-- CONCLUSION + +It is a lot of work to play multilinguality, using PCLT-DB. The ShowAsPCSI instaniations, HasStaticRawPCLTs instaniations, templates management... however PCLT-DB was built with an aim, that once catalog is setup, tested and put to work, it's management cost is minimal possible. +When using PCLT only (no DB) the following management points are there: +a) Choose catalog configuration in haskell code. +b) Adjust (together with (c)) templates in an electronic table (f.e. using OpenOffice Calc). +c) Adjust (together with (b)) templates "calls" in ShowAsPCSI instances. +d) From (b) fill in HasStaticRawPCLTs instances +e) Use HasStaticRawPCLTs instances to unite into module-wide and package-wide raw template sets. + +When using PCLT-DB the following management points there are: +f) Choose catalog configuration and store it in DB. +g) Adjust (together with (c)) templates in DB. +j) Use collections in DB in order to unite module-wide and package-wide template sets. +i) If needed, manage and configure representation policies in DB - a way to set different schemes of detalization requirements "with one key press". + +Possible economies: +(f) makes unnecessary (a) +(g) makes unnecessary (b) +(j) makes unnecessary (d) and (e) +(f,g,j) is considered to require less code and management cost than (a,b,d,e) + +One might get confused: why then Database.PCLT.runCatalogUpdatorService input still requires a some PCLT_InnerConfig and an instance of HasStaticRawPCLTs, if all this is now kept in DB? +The answer: +0) If DB for some reasons is unawailable, catalog will be formed from the data hardcoded in HasStaticRawPCLTs instances, and using some hardcoded config. +1) Despite (a,b,d,e) becomes unnecessary, one may still choose to use them. (a,b,d,e) and (f,g,j) may work together - if DB is off, hardcoded version (a,b,d,e) of catalog is always available! Double cost for double reliability, why not, if resources allow. +2) But even if programmer doesn't want to manage (a,b,d,e), it is asummed, that at least templates used by PCLT/-DB itselt are nice to have operatively available. In this case on input to + Database.PCLT.runCatalogUpdatorService programmer puts + Database.PCLT.PCLTRawCatalog__Database_PCLT_UpdatableCatalog + Text.PCLT.Config.defaultPCLTInnerConfig. + , which are templates set used by PCLT and PCLT-DB themselves and default config. They are already defined, and one only needs to reference them. +-}
+ examples/HelloWorld/HelloWorld.sql view
@@ -0,0 +1,138 @@+-- Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru> +-- +-- All rights reserved. +-- +-- For license and copyright information, see the file COPYRIGHT + +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- + +\c pcltcatalogs user_pcltcatalogs_data_admin + +SET search_path TO sch_pcltcatalogs, public; -- sets only for current session + +INSERT INTO tplscat_inner_configs(tplscat_inner_config_id, name, StrictOrient_ofParamsAndCmpsts_onDfltLngTplsSets) +VALUES ( 50 + , 'HelloWorld config' + , ' StrictOrient_ofParamsAndCmpsts_onDfltLngTplsSets {' + || ' soStrict_IsIt = True' + || ', soExcludingInComposites = []' + || ', soExcludingComposites = []' + || ', soExcludingParameters = []' + || ', soExcludingCompComposites = []' + || ', soExcludingCompParameters = [("E_HWE_AMBWRLDCH_OW", "__row_idx")]' -- about that read in the explanations to the config in version of HelloWorld that uses only PCLT (but no PCLT-DB) + || '}' + ); +INSERT INTO tpls_catalogs(tpls_catalog_id, tplscat_inner_config_id, name, description) VALUES (50, 50, 'HelloWorld catalog', 'PCLT catalog for testing of packages PCLT and PCLT-DB by application "HelloWorld"'); +INSERT INTO tpls_collections(tpls_collection_id, name, description) VALUES (50, 'HelloWorld templates', 'A collection of templates for testing of packages PCLT and PCLT-DB by application "HelloWorld". Contains (by dependencies) the collection (ID:10) "Default commons", which contains all the templates, that are used by PCLT and PCLT-DB packages + templates used by "HelloWorld" application.'); +INSERT INTO collections_inclusions_in_catalogs(tpls_catalog_id, tpls_collection_id) VALUES (50, 50); -- collection dedicated to HelloWorld catalog +INSERT INTO collections_dependencies(tpls_collection_rer_id, tpls_collection_red_id) VALUES (50, 10); -- collection with ID 10 contains all the templates that are used by PCLT and PCLT-DB packages +INSERT INTO language_iso639_3 (lng, name) VALUES ('hs_', 'Haskell'); -- used by HelloWorld example + +-- These \/ are generated in "HelloWorld.PCLTCatalog.ods" file +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'TRUE', 'True'); -- these are already in catalog, we just add localizations for "hs_" language +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'FALSE', 'False'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'MAYBE_A', '@@|maybe_cnstr@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'MAYBE_JUST', 'Just @@|a@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'MAYBE_NOTHING', 'Nothing'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'LLEXCPT', 'SomeException (ErrorCall "@@|excpt_msg@@|")'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'DB_ERROR', 'SqlError { seState = "@@|seState@@|", seNativeError = @@|seNativeError@@|, seErrorMsg = "@@|seErrorMsg@@|" }'); + +INSERT INTO tpls (pclt_id) VALUES('HW'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'HW', 'Привет, Мир!'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'HW', 'Hello world!'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'HW', 'HelloWorld'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'HW','0'); + +INSERT INTO tpls (pclt_id) VALUES('E_HWE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_HWE', '##|E_HWE_PREFIX##|@@|hwe_details_pcsi@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_HWE', '##|E_HWE_PREFIX##|@@|hwe_details_pcsi@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'E_HWE', '##|E_HWE_PREFIX##|@@|hwe_details_pcsi@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_HWE','10'); +INSERT INTO tpls (pclt_id) VALUES('E_HWE_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_HWE_PREFIX', 'Приветствие мира не удалось!\nПричина: '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_HWE_PREFIX', 'Hello world failure!\nReason: '); + +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_HWE_PREFIX','##|E_HWE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_HWE_NOWRLD'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_HWE_NOWRLD', 'некого приветствовать (нет мира)!'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_HWE_NOWRLD', 'no world!'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'E_HWE_NOWRLD', 'NoWorld_HWE'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_HWE_NOWRLD','##|E_HWE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_HWE_AMBWRLDCH'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_HWE_AMBWRLDCH', 'неясно, какой из миров приветствовать - их несколько!\nПервый мир: [имя: ''@@|w_name_1@@|'', индекс: @@|w_idx_1@@|].\nВторой мир: [имя: ''@@|w_name_2@@|'', индекс: @@|w_idx_2@@|].\nА так же эти миры: \n @@|other_worlds@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_HWE_AMBWRLDCH', 'ambiguous choice of worlds!\nFirst world: [name: ''@@|w_name_1@@|'', index: @@|w_idx_1@@|].\nSecond world: [name: ''@@|w_name_2@@|'', index: @@|w_idx_2@@|].\nAnd also these worlds: \n @@|other_worlds@@|.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'E_HWE_AMBWRLDCH', 'AmbiguousChoiceOfWorlds_HWE\n ("@@|w_name_1@@|", @@|w_idx_1@@|)\n ("@@|w_name_2@@|", @@|w_idx_2@@|)\n [ @@|other_worlds@@|\n ]'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_HWE_AMBWRLDCH','##|E_HWE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_HWE_AMBWRLDCH_OW'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_HWE_AMBWRLDCH_OW', '@@|__row_idx@@|) мир [имя: ''@@|w_name@@|'', индекс: @@|w_idx@@|]'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_HWE_AMBWRLDCH_OW', '@@|__row_idx@@|) world [name: ''@@|w_name@@|'', index: @@|w_idx@@|]'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'E_HWE_AMBWRLDCH_OW', '("@@|w_name@@|", @@|w_idx@@|)'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_HWE_AMBWRLDCH_OW','##|E_HWE_AMBWRLDCH##|'); +INSERT INTO tpls (pclt_id) VALUES('E_HWE_AMBWRLDCH_OW_SEP'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_HWE_AMBWRLDCH_OW_SEP', '\n'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_HWE_AMBWRLDCH_OW_SEP', '\n'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'E_HWE_AMBWRLDCH_OW_SEP', '\n, '); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_HWE_AMBWRLDCH_OW_SEP','##|E_HWE_AMBWRLDCH_OW##|'); +INSERT INTO tpls (pclt_id) VALUES('E_HWE_AMBWRLDCH_NOMORE'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_HWE_AMBWRLDCH_NOMORE', 'список пуст.'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_HWE_AMBWRLDCH_NOMORE', 'empty list.'); + +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_HWE_AMBWRLDCH_NOMORE','##|E_HWE_AMBWRLDCH_OW##|'); +INSERT INTO tpls (pclt_id) VALUES('E_HWE_STRNGERR'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_HWE_STRNGERR', 'какая-то странная непонятная ошибка! Данные: @@|int@@| "@@|str@@|" @@|bool@@| (@@|mb_bool1@@|) (@@|mb_bool2@@|) { @@|sm_excpt@@| }'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_HWE_STRNGERR', 'some very strange error! Data: @@|int@@| "@@|str@@|" @@|bool@@| (@@|mb_bool1@@|) (@@|mb_bool2@@|) { @@|sm_excpt@@| }'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'E_HWE_STRNGERR', 'SomeVeryStrangeError_HWE @@|int@@| "@@|str@@|" @@|bool@@| (@@|mb_bool1@@|) (@@|mb_bool2@@|) (@@|sm_excpt@@|)'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_HWE_STRNGERR','##|E_HWE##|'); +INSERT INTO tpls (pclt_id) VALUES('E_HWE_EIS'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_HWE_EIS', 'ошибка в подсистеме!\nТекст исключения уровнем ниже:\n##|E_EIS##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_HWE_EIS', 'failed due to error(s) in subsystem!\nLower level exception message:\n##|E_EIS##|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'E_HWE_EIS', 'FailedDueToErrorInSubsystem_HWE (##|E_EIS##|)'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_HWE_EIS','##|E_HWE##|'); + +INSERT INTO tpls (pclt_id) VALUES('E_EIS'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_EIS', '##|E_EIS_PREFIX##|@@|eis_details_pcsi@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_EIS', '##|E_EIS_PREFIX##|@@|eis_details_pcsi@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'E_EIS', '##|E_EIS_PREFIX##|@@|eis_details_pcsi@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_EIS','20'); +INSERT INTO tpls (pclt_id) VALUES('E_EIS_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_EIS_PREFIX', 'Сбой в подсистеме!\nПричина: '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_EIS_PREFIX', 'Subsystem failure!\nReason: '); + +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_EIS_PREFIX','##|E_EIS##|'); +INSERT INTO tpls (pclt_id) VALUES('E_EIS_ET1'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_EIS_ET1', 'ошибка типа #1!'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_EIS_ET1', 'error of type #1!'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'E_EIS_ET1', 'ErrorType1_EIS'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_EIS_ET1','##|E_EIS##|'); +INSERT INTO tpls (pclt_id) VALUES('E_EIS_ET2'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_EIS_ET2', 'ошибка типа #2!'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_EIS_ET2', 'error of type #2!'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'E_EIS_ET2', 'ErrorType2_EIS'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_EIS_ET2','##|E_EIS##|'); +INSERT INTO tpls (pclt_id) VALUES('E_EIS_EISS'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_EIS_EISS', 'сбой в подПОДсистеме! Текст исключения уровнем ниже: @@|e_eiss@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_EIS_EISS', 'failed due to error(s) in subSUBsystem!\nLower level exception message:\n@@|e_eiss@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'E_EIS_EISS', 'FailedDueToErrorInSub_sub_system_EIS (@@|e_eiss@@|)'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_EIS_EISS','@@|e_eiss@@|'); + +INSERT INTO tpls (pclt_id) VALUES('E_EISS'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_EISS', '##|E_EISS_PREFIX##|@@|eiss_details_pcsi@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_EISS', '##|E_EISS_PREFIX##|@@|eiss_details_pcsi@@|'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'E_EISS', '##|E_EISS_PREFIX##|@@|eiss_details_pcsi@@|'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_EISS','20'); +INSERT INTO tpls (pclt_id) VALUES('E_EISS_PREFIX'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_EISS_PREFIX', 'Сбой в подПОДсистеме!\nПричина: '); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_EISS_PREFIX', 'SubSUBsystem failure!\nReason: '); + +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_EISS_PREFIX','##|E_EISS##|'); +INSERT INTO tpls (pclt_id) VALUES('E_EISS_ET1'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_EISS_ET1', 'ошибка типа #1!'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_EISS_ET1', 'error of type #1!'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'E_EISS_ET1', 'ErrorType1_EISS'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_EISS_ET1','##|E_EISS##|'); +INSERT INTO tpls (pclt_id) VALUES('E_EISS_ET2'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('rus', 'E_EISS_ET2', 'ошибка типа #2!'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('eng', 'E_EISS_ET2', 'error of type #2!'); +INSERT INTO tpls_localized (lng, pclt_id, structured_text) VALUES('hs_', 'E_EISS_ET2', 'ErrorType2_EISS'); +INSERT INTO tpls_inclusions_in_collections (tpls_collection_id, pclt_id, tpl_dflt_req_sdl) VALUES (50,'E_EISS_ET2','##|E_EISS##|');
+ examples/HelloWorld/HelloWorld_Data.hs view
@@ -0,0 +1,47 @@+{- +Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru> + +All rights reserved. + +For license and copyright information, see the file COPYRIGHT +-} + +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- + +{-# LANGUAGE FlexibleInstances, FlexibleContexts #-} + +-- File with HelloWorld data structures. Had to separate this, since we separated PCLT templates in HelloWorld__.hs and we want to avoid recursive module imports. +-- Main file is HelloWorld.hs + +module HelloWorld_Data where + +----------------------------------------------------- +----------------------------------------------------- +-- Application specific modules +import Control.Exception + +----------------------------------------------------- +----------------------------------------------------- +-- Application specific data structures + +-- \/ data +data HelloWorld = HelloWorld + +-- \/ errors +type WorldName = String +type WorldIndex = Int +data HelloWorldError = + NoWorld_HWE + | AmbiguousChoiceOfWorlds_HWE (WorldName, WorldIndex) (WorldName, WorldIndex) [(WorldName, WorldIndex)] + | SomeVeryStrangeError_HWE Int String Bool (Maybe Bool) (Maybe Bool) SomeException + | FailedDueToErrorInSubsystem_HWE ErrorInSubsystem + +data ErrorInSubsystem = + ErrorType1_EIS + | ErrorType2_EIS + | FailedDueToErrorInSub_sub_system_EIS ErrorInSub_sub_system + +data ErrorInSub_sub_system = + ErrorType1_EISS + | ErrorType2_EISS
+ examples/HelloWorld/HelloWorld__.hs view
@@ -0,0 +1,329 @@+{- +Copyright (C) 2009 Andrejs Sisojevs <andrejs.sisojevs@nextmail.ru> + +All rights reserved. + +For license and copyright information, see the file COPYRIGHT +-} + +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- + +{-# OPTIONS_HADDOCK hide #-} +{-# LANGUAGE FlexibleInstances, FlexibleContexts #-} + +-- File with PCLT representations. +-- Main file is HelloWorld.hs + +module HelloWorld__ where + +import Database.PCLT +import qualified Data.ByteString.Lazy.UTF8.Unified as Lazy (ByteString) +import qualified Data.ByteString.Lazy.UTF8.Unified as B hiding (ByteString) +import qualified Data.Map as M +import Data.Map (Map, (!)) +import Text.PCLT.SH__ +import Text.PCLT.ShowAsPCSI__ +import HelloWorld_Data + +----------------------------------------------------- +----------------------------------------------------- +-- Representations +-- IMPORTANT!!! : It is highly recommended to use ISO 639(3) standard for language names, since PCLT-DB package that addons a DBMS powers to PCLT catalogs management is oriented on 3 letters (not bigger) language names. Without modifications PCLT-DB won't work for bigger (then 3-letters) names. + +instance (ShowAsPCSI HelloWorldError, ShowAsPCSI HelloWorld) => ShowAsPCSI (Either HelloWorldError HelloWorld) where + showAsPCSI err_or_hw = + case err_or_hw of + Right hw -> showAsPCSI hw + Left hwe -> showAsPCSI hwe + +instance ShowAsPCSI HelloWorld where + showAsPCSI hw = empPCSI "HW" +instance HasStaticRawPCLTs HelloWorld where + getStaticRawPCLTs inner_cfg _ = flip (,) [] $ + PCLT_RawCatalogData $ M.fromList + [ ( "HW" + , ( M.fromList + [ ("rus", B.pack "Привет, Мир!") + , ("eng", B.pack "Hello world!") + , ("hs_", B.pack "HelloWorld") + ] + , str2PCLT_SDL Required_SDLM "0" inner_cfg + ) + ) + ] + +instance ShowAsPCSI HelloWorldError where + showAsPCSI hwe = thePCSI "E_HWE" [ ("hwe_details_pcsi", PCSI_PV hwe_details_pcsi) ] + where + hwe_details_pcsi = + case hwe of + NoWorld_HWE -> + empPCSI "E_HWE_NOWRLD" + AmbiguousChoiceOfWorlds_HWE (wn1, wi1) (wn2, wi2) other_worlds -> + thePCSI "E_HWE_AMBWRLDCH" + [ ("w_name_1", PlainText_PV wn1) + , ("w_idx_1" , PlainText_PV $ show wi1) + , ("w_name_2", PlainTextLBS_PV $ B.pack wn1) + , ("w_idx_2" , PlainTextLBS_PV $ B.pack $ show wi2) + , ("other_worlds", case null other_worlds of + True -> PCSI_PV $ empPCSI "E_HWE_AMBWRLDCH_NOMORE" + False -> + Indented_PV 3 $ + PCSIList_PV + (map (\ (w_name, w_idx) -> + thePCSI + "E_HWE_AMBWRLDCH_OW" + [ ("w_name", PlainText_PV w_name) + , ("w_idx" , PlainText_PV $ show w_idx) + ] + ) + other_worlds + ) + (PCSI_PV $ empPCSI "E_HWE_AMBWRLDCH_OW_SEP") + ) + ] + SomeVeryStrangeError_HWE i s b mb_b1 mb_b2 sm_excpt -> + thePCSI "E_HWE_STRNGERR" + [ ("int" , PlainText_PV $ show i) + , ("str" , PlainText_PV s) + , ("bool" , PCSI_PV $ showAsPCSI b) + , ("mb_bool1", PCSI_PV $ showAsPCSI mb_b1) + , ("mb_bool2", PCSI_PV $ showAsPCSI mb_b2) + , ("sm_excpt", PCSI_PV $ showAsPCSI sm_excpt) + ] + FailedDueToErrorInSubsystem_HWE eis -> + [showAsPCSI eis] `addToPCSI` empPCSI "E_HWE_EIS" + +data PCLTRawCatalog__Text_PCLT_ShowAsPCSI_GeneralCommons__addon_for_haskell_lng = PCLTRawCatalog__Text_PCLT_ShowAsPCSI_GeneralCommons__addon_for_haskell_lng +instance HasStaticRawPCLTs PCLTRawCatalog__Text_PCLT_ShowAsPCSI_GeneralCommons__addon_for_haskell_lng where + getStaticRawPCLTs inner_cfg _ = flip (,) [] $ + PCLT_RawCatalogData $ M.fromList + [ + ("TRUE", (M.fromList [("hs_", B.pack "True")], str2PCLT_SDL Required_SDLM "one" inner_cfg)) -- the minimal SDL requirement here must be the same as for the representation in catalog, where these templates are persistent in other languages and where these templates will be added + , ("FALSE", (M.fromList [("hs_", B.pack "False")], str2PCLT_SDL Required_SDLM "##|TRUE##|" inner_cfg)) + + , ("MAYBE_A", (M.fromList [("hs_", B.pack "@@|maybe_cnstr@@|")], str2PCLT_SDL Required_SDLM "##|TRUE##|" inner_cfg)) -- we must stick to the composites and parameters sets used in original representation + , ("MAYBE_JUST", (M.fromList [("hs_", B.pack "Just @@|a@@|")], str2PCLT_SDL Required_SDLM "##|MAYBE_A##|" inner_cfg)) + , ("MAYBE_NOTHING", (M.fromList [("hs_", B.pack "Nothing")], str2PCLT_SDL Required_SDLM "##|MAYBE_A##|" inner_cfg)) + + , ("LLEXCPT", (M.fromList [("hs_", B.pack "SomeException (ErrorCall \"@@|excpt_msg@@|\")")], str2PCLT_SDL Required_SDLM "1000" inner_cfg)) + -- this \/ wasn't in th previous version of HelloWorld (the one, where PCLT-DB was not used, but only PCLT) + , ("DB_ERROR", (M.fromList [("hs_", B.pack "SqlError { seState = \"@@|seState@@|\", seNativeError = @@|seNativeError@@|, seErrorMsg = \"@@|seErrorMsg@@|\" }")], str2PCLT_SDL Required_SDLM "##|LLEXCPT##|" inner_cfg)) + ] + +instance HasStaticRawPCLTs HelloWorldError where + getStaticRawPCLTs inner_cfg _ = flip (,) [] $ + PCLT_RawCatalogData $ M.fromList + [ ( "E_HWE" + , ( let same_tpl = B.pack "##|E_HWE_PREFIX##|@@|hwe_details_pcsi@@|" + in M.fromList + [ ("rus", same_tpl) + , ("eng", same_tpl) + , ("hs_", same_tpl) + ] + , str2PCLT_SDL Required_SDLM "10" inner_cfg + ) + ) + , ( "E_HWE_PREFIX" + , ( M.fromList + [ ("rus", B.pack "Приветствие мира не удалось!\nПричина: ") + , ("eng", B.pack "Hello world failure!\nReason: ") + , ("hs_", B.empty) + ] + , str2PCLT_SDL Required_SDLM "##|E_HWE##|" inner_cfg + ) + ) + , ( "E_HWE_NOWRLD" + , ( M.fromList + [ ("rus", B.pack "некого приветствовать (нет мира)!") + , ("eng", B.pack "no world!") + , ("hs_", B.pack "NoWorld_HWE") + ] + , str2PCLT_SDL Required_SDLM "##|E_HWE##|" inner_cfg + ) + ) + , ( "E_HWE_AMBWRLDCH" + , ( M.fromList + [ ("rus", B.pack "неясно, какой из миров приветствовать - их несколько!\nПервый мир: [имя: '@@|w_name_1@@|', индекс: @@|w_idx_1@@|].\nВторой мир: [имя: '@@|w_name_2@@|', индекс: @@|w_idx_2@@|].\nА так же эти миры: \n @@|other_worlds@@|.") + , ("eng", B.pack "ambiguous choice of worlds!\nFirst world: [name: '@@|w_name_1@@|', index: @@|w_idx_1@@|].\nSecond world: [name: '@@|w_name_2@@|', index: @@|w_idx_2@@|].\nAnd also these worlds: \n @@|other_worlds@@|.") + , ("hs_", B.pack "AmbiguousChoiceOfWorlds_HWE\n (\"@@|w_name_1@@|\", @@|w_idx_1@@|)\n (\"@@|w_name_2@@|\", @@|w_idx_2@@|)\n [ @@|other_worlds@@|\n ]") + ] + , str2PCLT_SDL Required_SDLM "##|E_HWE##|" inner_cfg + ) + ) + , ( "E_HWE_AMBWRLDCH_OW" + , ( M.fromList + [ ("rus", B.pack "@@|__row_idx@@|) мир [имя: '@@|w_name@@|', индекс: @@|w_idx@@|]") -- __row_idx is an implicit parameter, that can be used by templates that are guaranteed to be wrapped in a PCSIList_PV (not PVList_PV !!!) parameter value wrapper + , ("eng", B.pack "@@|__row_idx@@|) world [name: '@@|w_name@@|', index: @@|w_idx@@|]") + , ("hs_", B.pack "(\"@@|w_name@@|\", @@|w_idx@@|)") + ] + , str2PCLT_SDL Required_SDLM "##|E_HWE_AMBWRLDCH##|" inner_cfg + ) + ) + , ( "E_HWE_AMBWRLDCH_OW_SEP" + , ( M.fromList + [ ("rus", B.pack "\n") + , ("eng", B.pack "\n") + , ("hs_", B.pack "\n, ") + ] + , str2PCLT_SDL Required_SDLM "##|E_HWE_AMBWRLDCH_OW##|" inner_cfg + ) + ) + , ( "E_HWE_AMBWRLDCH_NOMORE" + , ( M.fromList + [ ("rus", B.pack "список пуст.") + , ("eng", B.pack "empty list.") + , ("hs_", B.empty) + ] + , str2PCLT_SDL Required_SDLM "##|E_HWE_AMBWRLDCH_OW##|" inner_cfg + ) + ) + , ( "E_HWE_STRNGERR" + , ( M.fromList + [ ("rus", B.pack "какая-то странная непонятная ошибка! Данные: @@|int@@| \"@@|str@@|\" @@|bool@@| (@@|mb_bool1@@|) (@@|mb_bool2@@|) { @@|sm_excpt@@| }") + , ("eng", B.pack "some very strange error! Data: @@|int@@| \"@@|str@@|\" @@|bool@@| (@@|mb_bool1@@|) (@@|mb_bool2@@|) { @@|sm_excpt@@| }") + , ("hs_", B.pack "SomeVeryStrangeError_HWE @@|int@@| \"@@|str@@|\" @@|bool@@| (@@|mb_bool1@@|) (@@|mb_bool2@@|) (@@|sm_excpt@@|)") + ] + , str2PCLT_SDL Required_SDLM "##|E_HWE##|" inner_cfg + ) + ) + , ( "E_HWE_EIS" + , ( M.fromList + [ ("rus", B.pack "ошибка в подсистеме!\nТекст исключения уровнем ниже:\n##|E_EIS##|") + , ("eng", B.pack "failed due to error(s) in subsystem!\nLower level exception message:\n##|E_EIS##|") + , ("hs_", B.pack "FailedDueToErrorInSubsystem_HWE (##|E_EIS##|)") + ] + , str2PCLT_SDL Required_SDLM "##|E_HWE##|" inner_cfg + ) + ) + ] + +instance ShowAsPCSI ErrorInSubsystem where + showAsPCSI eis = thePCSI "E_EIS" [ ("eis_details_pcsi", PCSI_PV eis_details_pcsi) ] + where + eis_details_pcsi = + case eis of + ErrorType1_EIS -> + empPCSI "E_EIS_ET1" + ErrorType2_EIS -> + empPCSI "E_EIS_ET2" + FailedDueToErrorInSub_sub_system_EIS eiss -> + thePCSI "E_EIS_EISS" [("e_eiss", PCSI_PV $ showAsPCSI eiss)] +instance HasStaticRawPCLTs ErrorInSubsystem where + getStaticRawPCLTs inner_cfg _ = flip (,) [] $ + PCLT_RawCatalogData $ M.fromList + [ ( "E_EIS" + , ( let same_tpl = B.pack "##|E_EIS_PREFIX##|@@|eis_details_pcsi@@|" + in M.fromList + [ ("rus", same_tpl) + , ("eng", same_tpl) + , ("hs_", same_tpl) + ] + , str2PCLT_SDL Required_SDLM "20" inner_cfg + ) + ) + , ( "E_EIS_PREFIX" + , ( M.fromList + [ ("rus", B.pack "Сбой в подсистеме!\nПричина: ") + , ("eng", B.pack "Subsystem failure!\nReason: ") + , ("hs_", B.empty) + ] + , str2PCLT_SDL Required_SDLM "##|E_EIS##|" inner_cfg + ) + ) + , ( "E_EIS_ET1" + , ( M.fromList + [ ("rus", B.pack "ошибка типа #1!") + , ("eng", B.pack "error of type #1!") + , ("hs_", B.pack "ErrorType1_EIS") + ] + , str2PCLT_SDL Required_SDLM "##|E_EIS##|" inner_cfg + ) + ) + , ( "E_EIS_ET2" + , ( M.fromList + [ ("rus", B.pack "ошибка типа #2!") + , ("eng", B.pack "error of type #2!") + , ("hs_", B.pack "ErrorType2_EIS") + ] + , str2PCLT_SDL Required_SDLM "##|E_EIS##|" inner_cfg + ) + ) + , ( "E_EIS_EISS" + , ( M.fromList + [ ("rus", B.pack "сбой в подПОДсистеме! Текст исключения уровнем ниже: @@|e_eiss@@|") + , ("eng", B.pack "failed due to error(s) in subSUBsystem!\nLower level exception message:\n@@|e_eiss@@|") + , ("hs_", B.pack "FailedDueToErrorInSub_sub_system_EIS (@@|e_eiss@@|)") + ] + , str2PCLT_SDL Required_SDLM "@@|e_eiss@@|" inner_cfg + ) + ) + ] + +instance ShowAsPCSI ErrorInSub_sub_system where + showAsPCSI eiss = thePCSI "E_EISS" [ ("eiss_details_pcsi", PCSI_PV eiss_details_pcsi) ] + where + eiss_details_pcsi = + case eiss of + ErrorType1_EISS -> + empPCSI "E_EISS_ET1" + ErrorType2_EISS -> + empPCSI "E_EISS_ET2" +instance HasStaticRawPCLTs ErrorInSub_sub_system where + getStaticRawPCLTs inner_cfg _ = flip (,) [] $ + PCLT_RawCatalogData $ M.fromList + [ ( "E_EISS" + , ( let same_tpl = B.pack "##|E_EISS_PREFIX##|@@|eiss_details_pcsi@@|" + in M.fromList + [ ("rus", same_tpl) + , ("eng", same_tpl) + , ("hs_", same_tpl) + ] + , str2PCLT_SDL Required_SDLM "30" inner_cfg + ) + ) + , ( "E_EISS_PREFIX" + , ( M.fromList + [ ("rus", B.pack "Сбой в подПОДсистеме!\nПричина: ") + , ("eng", B.pack "SubSUBsystem failure!\nReason: ") + , ("hs_", B.empty) + ] + , str2PCLT_SDL Required_SDLM "##|E_EISS##|" inner_cfg + ) + ) + , ( "E_EISS_ET1" + , ( M.fromList + [ ("rus", B.pack "ошибка типа #1!") + , ("eng", B.pack "error of type #1!") + , ("hs_", B.pack "ErrorType1_EISS") + ] + , str2PCLT_SDL Required_SDLM "##|E_EISS##|" inner_cfg + ) + ) + , ( "E_EISS_ET2" + , ( M.fromList + [ ("rus", B.pack "ошибка типа #2!") + , ("eng", B.pack "error of type #2!") + , ("hs_", B.pack "ErrorType2_EISS") + ] + , str2PCLT_SDL Required_SDLM "##|E_EISS##|" inner_cfg + ) + ) + ] + +------------------------------------ +-- Gathering all HasStaticRawPCLTs insances and sticking them to one data type. + +data PCLTRawCatalog__HelloWorld = PCLTRawCatalog__HelloWorld +instance HasStaticRawPCLTs PCLTRawCatalog__HelloWorld where + widenessOfStaticRawPCLTsSet _ = Module_RPSW + getStaticRawPCLTs inner_cfg _ = + mergeRawCatalogDataSets2 True + [ getStaticRawPCLTs inner_cfg (undefined :: HelloWorld) + , getStaticRawPCLTs inner_cfg (undefined :: HelloWorldError) + , getStaticRawPCLTs inner_cfg (undefined :: ErrorInSubsystem) + , getStaticRawPCLTs inner_cfg (undefined :: ErrorInSub_sub_system) + , getStaticRawPCLTs inner_cfg (undefined :: PCLTRawCatalog__Text_PCLT_ShowAsPCSI_GeneralCommons__addon_for_haskell_lng) + , getStaticRawPCLTs inner_cfg (undefined :: PCLTRawCatalog__Database_PCLT_UpdatableCatalog) -- this collection unites all templates used by PCLT and PCLT-DB + ]
+ initial_data/PCLT-DB.PCLTCatalog.ods view
binary file changed (absent → 33528 bytes)
+ models/PCLT-DB.ERD.v0.1.odg view
binary file changed (absent → 33737 bytes)
+ models/PCLT-DB.ERD.v0.1.odg.png view
binary file changed (absent → 579661 bytes)