Default repository for execsql.py
Révision | 128b99ee4fd85d6fd14fc4be9990fd7edb581092 (tree) |
---|---|
l'heure | 2022-02-20 22:49:26 |
Auteur | rdnielsen |
Commiter | rdnielsen |
Updated documentation and added the INITIALLY clause to the PROMPT ENTER_SUB metacommand.
@@ -1,6 +1,7 @@ | ||
1 | 1 | ========== ========== ================================================================================= |
2 | 2 | Version Date Features |
3 | 3 | ========== ========== ================================================================================= |
4 | +1.100.0 2022-02-20 Added the INITIALLY clause to the PROMPT ENTER_SUB metacommand. | |
4 | 5 | 1.99.0 2022-02-19 Added the variant IMPORT metacommands that use a SHEETS MATCHING <regex> clause to import multiple sheets from an OpenDocument or Excel workbook in one step. |
5 | 6 | 1.98.0 2022-01-12 Added the FOLD_COLUMN_HEADERS configuration setting. Cleaning column headers now adds an underscore to the beginning of any column header that starts with a digit. |
6 | 7 | 1.97.0 2022-01-08 Added the CONTAINS, ENDS_WITH, and STARTS_WITH conditional tests. Modified the 'textarea' control in an ENTRY_FORM to allow newlines to be inserted, and to strip trailing newlines. Modified the SQL statement evaluator to ignore multiple terminating semicolons. |
@@ -60,7 +60,7 @@ | ||
60 | 60 | # The short X.Y version. |
61 | 61 | version = u'1.99' |
62 | 62 | # The full version, including alpha/beta/rc tags. |
63 | -release = u'1.99' | |
63 | +release = u'1.100' | |
64 | 64 | |
65 | 65 | # A string of reStructuredText that will be included at the beginning of |
66 | 66 | # every source file that is read. |
@@ -187,6 +187,9 @@ | ||
187 | 187 | a column header except letters, digits, and the underscore character |
188 | 188 | will be replaced by the underscore character. |
189 | 189 | |
190 | + This setting is also applied to the conversion of spreadsheet names | |
191 | + to table names when multiple worksheets are :ref:`IMPORTed<import>`. | |
192 | + | |
190 | 193 | .. index:: |
191 | 194 | single: Configuration; Create column headers |
192 | 195 |
@@ -250,6 +253,9 @@ | ||
250 | 253 | :ref:`IMPORTed<import>`. Valid values are "No" (the default), |
251 | 254 | "Lower", and "Upper". Case does not matter in the specification. |
252 | 255 | |
256 | + This setting is also applied to the conversion of spreadsheet names | |
257 | + to table names when multiple worksheets are :ref:`IMPORTed<import>`. | |
258 | + | |
253 | 259 | .. index:: |
254 | 260 | single: Configuration; Import buffer |
255 | 261 |
@@ -510,6 +510,9 @@ | ||
510 | 510 | for the DBMS in use, or eliminate the need for column names to be |
511 | 511 | double-quoted. |
512 | 512 | |
513 | +This setting is also applied to the conversion of spreadsheet names | |
514 | +to table names when multiple worksheets are :ref:`IMPORTed<import>`. | |
515 | + | |
513 | 516 | |
514 | 517 | |
515 | 518 | .. index:: ! CONFIG CONSOLE WAIT_WHEN_DONE metacommand |
@@ -670,7 +673,10 @@ | ||
670 | 673 | to lowercase or uppercase, or to leave them unchanged when data are |
671 | 674 | :ref:`IMPORTed<import>`. Valid values are "No" (the default), |
672 | 675 | "Lower", and "Upper". Case does not matter in the specification. |
673 | - | |
676 | + | |
677 | +This setting is also applied to the conversion of spreadsheet names | |
678 | +to table names when multiple worksheets are :ref:`IMPORTed<import>`. | |
679 | + | |
674 | 680 | |
675 | 681 | |
676 | 682 |
@@ -3048,6 +3054,11 @@ | ||
3048 | 3054 | added to any already-existing data. If existing data are to be |
3049 | 3055 | replaced, they should be deleted before the IMPORT metacommand is run. |
3050 | 3056 | |
3057 | +If multiple worksheets are imported at once, using the SHEETS MATCHING | |
3058 | +clause, the :ref:`clean_column_headers<clean_column_headers>` and | |
3059 | +:ref:`fold_column_headers<config_fold_column_headers>` settings | |
3060 | +are used when creating table names from worksheet names. | |
3061 | + | |
3051 | 3062 | .. index:: |
3052 | 3063 | single: Firebird |
3053 | 3064 | single: Commit |
@@ -3984,6 +3995,7 @@ | ||
3984 | 3995 | [DISPLAY <table_or_view>] |
3985 | 3996 | [TYPE INT|FLOAT|BOOL|IDENT] |
3986 | 3997 | [LCASE|UCASE] |
3998 | + [INITIALLY "<text>"] | |
3987 | 3999 | |
3988 | 4000 | Prompts for a replacement string to be assigned to the specified |
3989 | 4001 | substitution variable (matching string). Entry of a value is not required; |
@@ -4013,6 +4025,9 @@ | ||
4013 | 4025 | The keywords "LCASE" and "UCASE" force the returned value to be all |
4014 | 4026 | lowercase or all uppercase, respectively. |
4015 | 4027 | |
4028 | +If the INITIALLY clause is used, the provided text must be double-quoted | |
4029 | +and must not contain a double quote character. | |
4030 | + | |
4016 | 4031 | |
4017 | 4032 | |
4018 | 4033 | .. index:: ! PROMPT ENTRY_FORM metacommand |
@@ -27,11 +27,11 @@ | ||
27 | 27 | # |
28 | 28 | # =============================================================================== |
29 | 29 | |
30 | -__version__ = "1.99.0" | |
31 | -__vdate = "2022-02-19" | |
30 | +__version__ = "1.100.0" | |
31 | +__vdate = "2022-02-20" | |
32 | 32 | |
33 | 33 | primary_vno = 1 |
34 | -secondary_vno = 99 | |
34 | +secondary_vno = 100 | |
35 | 35 | tertiary_vno = 0 |
36 | 36 | |
37 | 37 | import os |
@@ -6576,7 +6576,8 @@ | ||
6576 | 6576 | return True |
6577 | 6577 | return self.validate_rxs[self.textentrytype.upper()].match(newval) is not None |
6578 | 6578 | def __init__(self, title, message, button_list, selected_button=0, no_cancel=False, column_headers=None, |
6579 | - rowset=None, textentry=None, hidetext=False, textentrytype=None, textentrycase=None): | |
6579 | + rowset=None, textentry=None, hidetext=False, textentrytype=None, textentrycase=None, | |
6580 | + initialtext=None): | |
6580 | 6581 | # button_list is a *list* of 3-tuples where the first item is the button label, |
6581 | 6582 | # the second item is the button's value, and the third (optional) value is the key |
6582 | 6583 | # to bind to the button. Key identifiers must be in the form taken by the Tk bind() |
@@ -6589,6 +6590,7 @@ | ||
6589 | 6590 | # hidetext is a boolean; if True, asterisks will be printed as if the entry is a password. |
6590 | 6591 | # textentrytype is a string, one of "INT", "FLOAT", "BOOL", or "IDENT". |
6591 | 6592 | # textentrycase is a string, one of "UCASE", "LCASE". |
6593 | + # initialtext is a string containing the initial value for the text entry. | |
6592 | 6594 | try: |
6593 | 6595 | import Tkinter as tk |
6594 | 6596 | except: |
@@ -6615,6 +6617,7 @@ | ||
6615 | 6617 | self.entryctrl = None # The ttk.Entry object used for text entry. |
6616 | 6618 | self.textentrytype = textentrytype |
6617 | 6619 | self.textentrycase = textentrycase |
6620 | + self.initialtext = initialtext | |
6618 | 6621 | self.tbl = None # The ttk.Treeview widget that may display data. |
6619 | 6622 | self.buttons = [] # A list of ttk.Button objects, with an extra attribute "command_func" |
6620 | 6623 | # (because the Button callback function is not queryable) |
@@ -6639,6 +6642,8 @@ | ||
6639 | 6642 | # Add text entry box if needed. |
6640 | 6643 | if textentry: |
6641 | 6644 | self.entryvar = tk.StringVar() |
6645 | + if self.initialtext is not None: | |
6646 | + self.entryvar.set(self.initialtext) | |
6642 | 6647 | self.entryctrl = ttk.Entry(msgframe, width=60, textvariable=self.entryvar, validate="all") |
6643 | 6648 | validate_tkcmd = (self.entryctrl.register(self.validate), '%P') |
6644 | 6649 | self.entryctrl.configure(validatecommand = validate_tkcmd) |
@@ -10289,6 +10294,7 @@ | ||
10289 | 10294 | as_pw = kwargs["password"] is not None |
10290 | 10295 | schema = kwargs["schema"] |
10291 | 10296 | table = kwargs["table"] |
10297 | + initial = kwargs["initial"] | |
10292 | 10298 | if table is not None: |
10293 | 10299 | db = dbs.current() |
10294 | 10300 | cmd = u"select * from %s;" % db.schema_qualified_table_name(schema, table) |
@@ -10305,7 +10311,8 @@ | ||
10305 | 10311 | "textentry": True, |
10306 | 10312 | "hidetext": as_pw, |
10307 | 10313 | "textentrytype": texttype, |
10308 | - "textentrycase": textcase} | |
10314 | + "textentrycase": textcase, | |
10315 | + "initialtext": initial} | |
10309 | 10316 | gui_manager_queue.put(GuiSpec(GUI_DISPLAY, gui_args, return_queue)) |
10310 | 10317 | user_response = return_queue.get(block=True) |
10311 | 10318 | btnval = user_response["button"] |
@@ -10325,7 +10332,7 @@ | ||
10325 | 10332 | return None |
10326 | 10333 | |
10327 | 10334 | metacommandlist.add( |
10328 | - ins_table_rxs(r'^\s*PROMPT\s+ENTER_SUB\s+(?P<match_str>~?\w+)\s+(?:(?P<password>PASSWORD)\s+)?MESSAGE\s+"(?P<message>(.|\n)*)"(?:\s+DISPLAY\s+', r')?(?:\s+TYPE\s+(?P<type>INT|FLOAT|BOOL|IDENT))?(?:\s+(?P<case>LCASE|UCASE))?\s*$'), | |
10335 | + ins_table_rxs(r'^\s*PROMPT\s+ENTER_SUB\s+(?P<match_str>~?\w+)\s+(?:(?P<password>PASSWORD)\s+)?MESSAGE\s+"(?P<message>([^"]|\n)*)"(?:\s+DISPLAY\s+', r')?(?:\s+TYPE\s+(?P<type>INT|FLOAT|BOOL|IDENT))?(?:\s+(?P<case>LCASE|UCASE))?(?:\s+INITIALLY\s+"(?P<initial>[^"]+)")?\s*$'), | |
10329 | 10336 | x_prompt_enter) |
10330 | 10337 | |
10331 | 10338 |
@@ -5,7 +5,7 @@ | ||
5 | 5 | long_description = f.read() |
6 | 6 | |
7 | 7 | setuptools.setup(name='execsql', |
8 | - version='1.98.0', | |
8 | + version='1.100.0', | |
9 | 9 | description="Runs a SQL script against a PostgreSQL, MS-Access, SQLite, MS-SQL-Server, MySQL, MariaDB, Firebird, or Oracle database, or an ODBC DSN. Provides metacommands to import and export data, copy data between databases, conditionally execute SQL and metacommands, and dynamically alter SQL and metacommands with substitution variables. Data can be exported in 18 different formats, including CSV, TSV, ODS, HTML, JSON, LaTeX, and Markdown tables, and using custom templates.", |
10 | 10 | author='Dreas Nielsen', |
11 | 11 | author_email='dreas.nielsen@gmail.com', |