Difference between revisions of "Talk:Documentation/OOoAuthors User Manual/Base Guide/Planning"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Data Types)
m (=Char / Varchar)
Line 299: Line 299:
=======Char / Varchar======
======Char / Varchar======
HSQL supports VARCHAR_IGNORECASE, this is a somewhat unique data type and very useful for lookup values.
HSQL supports VARCHAR_IGNORECASE, this is a somewhat unique data type and very useful for lookup values.
======Memo / Long Strings======
======Memo / Long Strings======
======Formatted Text======
======Formatted Text======

Revision as of 15:28, 6 July 2007

I wrote a document called AndrewBase.odt (available online). This is a basic outline used there:

Information Page 2 Copyright 2 Authors 2 Feedback 2 Acknowledgments 2 Publication date and software version 2

1. Introduction    1
1.1. Introductory comments    1
1.2. Document organization and introduction    1
2. Storing images (binary data) in Base    3
2.1. Create the initial Base document    3
2.1.1. Using the GUI    3
2.1.2. Using a macro    3
2.1.3. Using a macro to open the wizard    4
2.2. Create the table    4
2.2.1. Using the GUI    4
2.2.2. Using a macro    5
2.2.3. Using SQL statements to modify tables    7
2.2.4. Refresh the tables    7
2.2.5. Creating and deleting tables using SQL    8
2.2.6. Increase a field's length    9
2.3. Create a form    10
2.3.1. Using the GUI    10
2.3.2. Using a macro    12
2.4. Open a form using a macro    15
2.5. Accessing the binary data    18
2.5.1. Adding binary data    18
2.5.2. Extracting binary data    19
3. One-To-Many relationships    22
3.1. Create the tables    22
3.1.1. Create the DEALER table    22
3.1.2. Create the ITEM table    23
3.2. Define the data relationships    25
3.3. Add data to the DEALER and ITEM tables    26
4. Forms    29
4.1. The internal object model    29
4.1.1. A control's shape is in the draw page    29
4.1.2. A draw page contains forms    30
4.1.3. A control's data model is in a form    31
4.1.4. A control's view model is in the controller    32
4.1.5. Enabling and setting controls visible – an example    32
4.1.6. Finding a control from an event – an example    33
4.1.7. Control model summary    34
4.2. Database Forms act like a result set    34
4.2.1. Duplicate record macro    35
4.3. Show one item and the corresponding dealer    38
4.4. Use a combo box with the dealer id    40
4.5. Use a list box with the dealer name    41
4.6. Relations in a single table    42
4.6.1. Solution    43
4.6.2. Solution characteristics    44
4.7. Use a “help and fill” button    45
5. Many-to-many relationships    46
6. Database fields    47
6.1. Storing numbers    50
6.1.1. Integer numbers    50
6.1.2. Floating point numbers    51
6.1.3. NUMERIC and DECIMAL types    52
6.2. Bit and Boolean Types    52
6.3. Date and time    53
6.4. Text data    53
6.5. Binary data    54
6.6. Other data type    54
6.7. Database sequences and auto-value fields    54
7. A few easy database definitions    56
7.1. Schema    57
8. Database connections    58
8.1. Obtain a database context    58
8.1.1. Registered data sources    59
8.1.2. Unregistering a data source    59
8.1.3. Registering a data source    59
8.2. Connect to a database    60
8.3. Connect using an interaction handler    61
8.4. Connections    61
8.4.1. Extended SDB connections    63
8.4.2. Meta-data    63
8.4.3. Inspecting the meta-data    70
8.4.4. GetBestRowIdentifier    76
8.4.5. GetColumnPrivileges    77
8.4.6. GetColumns    78
8.4.7. GetExportedKeys    79
8.4.8. GetIndexInfo    81
8.4.9. GetPrimaryKeys    82
8.4.10. GetTablePrivileges    82
8.4.11. GetTables    83
8.4.12. GetTypeInfo()    83
8.4.13. GetUDTS    85
8.4.14. GetVersionColumns    85
8.5. Connections     86
8.6. Connections without a data source    87
8.6.1. Delimited text files    91
8.6.2. Fixed width text files    93
8.6.3. Help, I still can not import my CSV file    98
8.6.4. Address books    99
8.6.5. MySQL using JDBC    100
8.6.6. Paradox using ODBC    100
8.6.7. Conclusion    102
9. Connecting to MySQL using JDBC    103
10. Mailmerge    105
11. Copying an entire database    106
12. General utility macros    107
12.1. Choose a directory    108
12.2. Get a document's directory    109
12.3. Choose a file    109
12.4. Finding a (loaded) OOo document    111
12.5. Append to an array    112
12.6. Compare data in an array    113
12.7. Create a property    113
12.8. Create a Point and a Size    114
12.9. Append a data array to a Calc document    114
12.10. Dynamically call object methods    115
12.11. Display numeric constants as meaningful text    119
12.12. Select from a list in a list box    120
13. Database utility macros    122
13.1. Quoting table and field names    122
13.2. Convert between an UNO Date and a Basic Date    122
13.3. Convert a result set to an array of data    124
13.4. Create and populate a dialog from a result set    127
14. Tips and tricks    128
14.1. Limit the number of returned records    128
15. Connect to a Base document using JDBC    130

The content started as a book that I intended to write, but then it was dropped, so I created this instead. It is likely too concentrated on macros for the average person. That said, any content can be removed and used. Something of interest with AndrewBase.odt, is that all included macros are included in the document itself and my be run by clicking on buttons in the document.

Note that Drew Jensen probably has much of interest that he could add.

Areas of interest that should likely be covered, in my opinion, include:

What is a database "key"?

Database design deals with what is known as "normal" forms. This is perhaps very advanced, but I have been sent database documents created by users that had no idea how to deal with redundant data. For example, if I have a doll that can have a "body type". The usual method is to create a table that enumerates body types. Each body type has a primary key acting as a unique identifier. I do not repeat all information related to the body type for each doll. Instead, I use the primary key and reference the body type table.

Dealing with one-to-many and many-to-many relationships. Areas of interest include table design, form design, and reports.

There is an entirely new Report writing system in the works, it is very exciting. This should be covered, perhaps as its own chapter.

Using an internal database. Using an external database such as MySQL. Converting from MS Access.

I am tired, and these are without much thought.

06/30/07 Here is my first thought on an outline



How are the sections laid out

         o Each section for a Wizard will have a description page for each of the dialog pages. Named the same as the page on screen.
         o Each section for a Designer will have a description of the tool bars used, dialogs used and embedded wizards used.
         o Who are you?  [ Help them with where to start reading and suggest a different route through the sections ]
             + I have a Base database ( *.odb file ) and I need to work with it. 
             + I need to create a database, like I have done before with ( XXXX )[Access, FileMaker..]
             + I need to create a database, like I have with Excel or Calc before. 
             + I think I want a database, but have never used a database manager before
         o A brief history of OO.o databases and Base
           I think it will help show why some things are done they way they are in Base.

A lot of this will most likely be covered in the Getting started guide. I am not sure if much of that document shouldn't become this chapter. There would be additions of course.

Base window layout

         o Menus
         o Tool bars
         o Sections 
         o SQL Window

Database objects


What is a table? A collection of records, where each record consists of a specific sequence of fields. A table has a name, which must be unique within the Base database. ( This uniqueness includes names for Tables, Views and Queries since version 2.2.1 ??? [ I might be wrong on the version number ] ) A field is single piece of information. A field has a name. A field consists of the information and a collection of rules regarding exactly what information may be contained in this field. For more information see the section on Table Wizard.

Creating Admin Forms - 1 Click Away

If you use the New Table Wizard to create your tables then Base can automatically start the New Form Wizard for you. A form with a grid control is easier to work with then is the data view window from a Table.


Base supports the use of and creation of views. Most users will benefit by using the Query-in-Query feature of Base instead of a view. For more information see the section on Table Designer.


Base Query vs SQL Select

A Base query definition contains an SQL Select statement and more.

Can a Base query also use SQL Insert / Update / Delete statements?

No. Performing the same actions is covered in the section Adding and Removing data.

Using a Query in A Query

New with 2.1


Wizards every where

Reports Wizard / Designer Based

Wizard for quick lists
I don't have the designer?

New with version 2.3

keep track of it all

Using folders to keep things together.

Here again a lot of this most likely is covered pretty much as needed in the help files. I don't know, exactly, where in the source files are the help files.

How to find your information ( Searches and Filters )

         o What are the differences between a search and a filter
         o Searching multiple fields ( And vs Or and stuff )
         o Don't forget sorting

Adding and Removing data

Working in a table data view window

Using Queries for insert / Update / Delete

Working in a form window

Mixing Base with the rest of OO.o

         o Overview of data exchange within OO.o
         o F4 - Has always been there, and is still there - Use it
             + Add a table to Calc
             + Add a table to Writer
             + F4 Even works in Base forms???
                 # Update a lookup table on the fly

The examples used in the book

         o A flat database ( Exercise Log? ) 
         o A relational model ( Contacts??  )
         o Advanced features (  [Invoices or  Inventory or ??? ] )

This would be just a thumbnail of each database and what from each is shown where. I would strongly recommend that each database should be based on supplied table structures. With a modicum of changes or additions. With the possible exception of the advanced entry. There are a couple of database files on the internet hat would be good candidates for this. There is a good French language database that might be right for here for example. Or the accounting demo built by a company in Australia ( sorry, I am not going to go dig up the urls at this minute..)

I would bet if someone asked they any of these authors would allow their OS offering to have certain pieces dissected for the manual. There is also a POS database for running for a small specialty gift retailer that is fully OS, it is less polished or advanced then the others, but with an update for the new report designer would work quite well.

Also the fact that it is not so advanced might be a benefit, it is advanced enough to demonstrate I think most of what needs to be covered - but not so much so that the reader needs to be a seasoned database developer to follow the structures and methods.

Wizards ( Let OO.o do most of the work. )

Open database wizard

         o Why have a wizard for Open?
         o Where is my data anyway?
         o The default database type.
         o Connections to external databases
               + A connection is not the same as an import!
         o Your address book ( Not really a marriage made in Heaven. )

New Table Wzard

         o Working with the table templates.
               + Create Exercise Log table
         o Data Types 101 ( Default or HSQL datatypes )
         o Key please!

Query Wizard

         o Getting only a few of many ( Simple selects statements )
         o Create Exercise Log queries
       NOTE - this may be the weakest wizard and I would make this the shortest section - the focus on queries is the designer

Form Wizard

         o Tables and Queries and SQL - Oh my! ( Why the are the same, and why they aren't )
         o Which layout template?
               + Build Exercise Log Main Form
         o Seating for two please. ( Adding a sub-form )
               + Relations prompt suggestions
               + Build Contacts Main Form

Report Wizard

When you need a simple list it's hard to beat, if you can make a query!

Tables and Queries and SQL - Oh My! en duex!

         o It's all in the query.

Chose a layout

Can I make this little change?

 ( Sure but know the lay of the land )
  + Using Styles is THE safest way.
  + Create Exercise Log report
      # The report takes one input from the user, the name of a month. It then prints the report for that month of the current year.

Exchanging Data

Working with Calc

   o Using linked data ranges

There must be some information in Calc Guide about working with Base - need to see how this reference can augment that.

Working with Writer

   o MailMerge

There must be some information in Writer about working with Base - need to see how this reference can augment that.

Working with Text files

   o Multiple Choices 
       + The TEXT connection type
       + A TEXT table in an embedded database

There are plenty of sources for this section. The HSQL documentation, a fine how to written in French, a few of my postings on the forum are fairly good.

Customizing your database

Designers ( When you need to do it your way.)

Table Designer

Data Types
   o More engines equals more data types ( MySQL, PostgreSQL, MS Access and a host of others 
Char / Varchar

HSQL supports VARCHAR_IGNORECASE, this is a somewhat unique data type and very useful for lookup values.

Memo / Long Strings
Formatted Text
Dates / Time
Binary ( Graphics / Documents )
Boolean / Other
GUI default values
Create View

Relation Designer

       + Set up Contacts database

Query Designer

         o Design View / SQl View / SQL Direct ( Which one? )
         o Working with Queries in Queries
         o Using Replacement Parameters
         o Using Aliases
         o Adding data form multiple tables together ( Joins )
             + Why Can't I update the data?
         o Creating Calculated fields
         o using aggregate functions
         o Default built-in functions
         o Advanced SQL
             + Unions / Intersections / Exclusions
             + Case When
             + Calling Stored Procedures
                 #  As column
                 #  In Criteria

Form Designer

Tool bars
   + Form Design ( Overview )
   + Form Controls ( Overview )
   + More Controls ( Overview )
Form Navigator
   + Dataforms 
        # Content Types
        # Table
        # Query
        # SQL
   + Control Lists
        # Moving controls around
Add Field Window
Form Designer Wizards
   + New Table Grid Control
   + New Combo Box
   + New List Box

Report Designer

Using Macros

Validating data input

Generating calculated data

Working with multiple forms

Using other OO.o documents

Using Base at work

Moving from an embedded single user Base file to a Multi-User HSQL server

   o Extract the HSQL database defintion
   o Setup the HSQL server
   o Create the new Base file

HSQl is the default, Base supports it in all three deployment models: In Memory ( default ), File, Server. Moving between the three is very easy and the engine is immediately available on every computer OS OO.o runs on.

Using Other Servers



MS Access

MS Jet ( MDB )
ACCDB ( MS 2000,2007 )

Understanding Connections

Auto Commit

Handling multiple table transactions

Restricting Access to Forms and Reports

Appendix I Build the example database

   * Flat ( ? )
   * Relational 1 ( ?? )
   * Relational 2 ( ???

This should be a page or 2 of the steps needed to create any of the example files needed. This would not necessarily be the same as creating a duplicate of the files that would be available for download of the example databases.

These pages would be here for the person that might get a printed copy of the document and not have access to the odb files. For this guy then he has to type it in and limit this to only the items needed for what is described.

Appendix II Overview of A Database

Appendix III Further reading on database design

Personal tools