From 6c950e043d80fedc9644a6c19fca23c73ad6fc80 Mon Sep 17 00:00:00 2001 From: "ondrej.zara" Date: Mon, 7 Dec 2009 17:51:53 +0000 Subject: [PATCH] fixes for vfp9 db definition --HG-- extra : convert_revision : svn%3Ab267cdba-c1da-11dd-874b-8bacd04a0a74/trunk%4066 --- db/vfp9/datatypes.xml | 78 ++++++++++++++++++------------------ db/vfp9/output.xsl | 80 ++++++++++++++++++++++--------------- db/vfp9/readme_vfp9.txt | 87 ++++++++++++++++++++--------------------- 3 files changed, 130 insertions(+), 115 deletions(-) diff --git a/db/vfp9/datatypes.xml b/db/vfp9/datatypes.xml index e34d7d2..5629078 100644 --- a/db/vfp9/datatypes.xml +++ b/db/vfp9/datatypes.xml @@ -1,39 +1,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/db/vfp9/output.xsl b/db/vfp9/output.xsl index 13fded4..1167872 100644 --- a/db/vfp9/output.xsl +++ b/db/vfp9/output.xsl @@ -26,22 +26,26 @@ - LPARAMETERS teLongName, tcCommand + LPARAMETERS teLongName, tcCommand, tcPath * [teLongName] False: set llDbc=.F. and generates "FREE", Empty: generates without "FREE" and "NAME", otherwise generates "NAME teLongName" - * [tcCommand] if used, &tcCommand command will run after CREATE TABLE + * [tcCommand] if used, &tcCommand command will run after CREATE TABLE, f.e. "= MyProc( ALIAS(), m.lcTableComment, @lacComments )" + + * [tcPath] path where tables will be created (if not used, tables will be created in current folder) - LOCAL llDbc, lcFreeOrName, lnIndex + LOCAL ARRAY lacComments[1,2] + + LOCAL llDbc, lcFreeOrName, lcTableComment llDbc = VARTYPE( m.teLongName )=[C] - * True not supported yet: Improve db\vfp9\output.xsl and remove "xsl:if test=[1=2]" from it + * no special support for llDbc=True yet (you could improve db\vfp9\output.xsl and remove "xsl:if test=[1=2]" from it) lcFreeOrName = IIF( m.llDbc, IIF( EMPTY( m.teLongName ), [], [NAME "] + m.teLongName + ["] ), [FREE] ) - lnIndex = IIF( VARTYPE( m.teIndex )=[L], 0, IIF( EMPTY( m.teIndex ), 1, 2 ) ) + tcPath = IIF( VARTYPE( m.tcPath )=[L], [], ADDBS( m.tcPath ) ) @@ -49,36 +53,36 @@ - ERASE + ERASE ' - .dbf + .dbf' - ERASE + ERASE ' - .fpt + .fpt' - ERASE + ERASE ' - .cdx + .cdx' - ERASE + ERASE ' - .bak + .bak' - ERASE + ERASE ' - .tbk + .tbk' - CREATE TABLE + CREATE TABLE (m.tcPath + ' - &lcFreeOrName + ') &lcFreeOrName ( ; @@ -102,7 +106,8 @@ - + + @@ -154,26 +159,39 @@ ) - + lcTableComment = ' + + + + + + ' + - - COMMENT ' + + + DIMENSION lacComments[FCOUNT(),2] + + + lacComments[ + + ,1] = ' + + ' + + lacComments[ + + ,2] = ' - ' - - - ; - + ' + + + - - - - - IF NOT EMPTY( m.tcCommand ) &tcCommand diff --git a/db/vfp9/readme_vfp9.txt b/db/vfp9/readme_vfp9.txt index f70dc34..c3e3957 100644 --- a/db/vfp9/readme_vfp9.txt +++ b/db/vfp9/readme_vfp9.txt @@ -1,45 +1,42 @@ -02.12.2009 - vfp9 add-on for WwwSQLDesigner - by zvolsky@seznam.cz - - -Installation: -------------- -Download and install WwwSQLDesigner from http://code.google.com/p/wwwsqldesigner/ -If there is no db\vfp9 folder, then continue: - -Unzip files into db\vfp9 folder of the WwwSQLDesigner. -If you don't see vfp9 in database type selection, copy db\vfp9\readme_vfp9\config.js into js\config.js location. -After changing js\config.js you must restart. -Changes in db\vfp9\output.xsl take effect immediately. -To re-read db\vfp9\datatypes.xml you must make some (dummy) change in js\config.js and restart. - - -WwwSQLDesigner basics: ----------------------- -To start click Index.html. -Never use Page Refresh (F5) - data will be lost! -Use Save button to generate FoxPro script with CREATE TABLEs. -Use Save/Read and Save XML buttons to generate XML and copy-paste it into text file to save your work. -Use Save/Read and Read XML buttons to continue work. - - -Use of VFP9 add-on: -------------------- -Textbox "Default" in Field adding has different meaning. Here you can enter all foxpro keywords, which follow field definition. -No word "DEFAULT" is added. To use some DEFAULT, write "DEFAULT value". If you let just "NULL" in Textbox "Default", -you will receive FoxPro error. Write "DEFAULT .NULL." if you want a default null value. - -Data type "Integer (not key)" differents just in its color (but generates standard Integer) - -Data types Binary aren't in list. They are supported through "Default" textbox. Write "NOCPTRANS" there. - - -There is (at this time - 02.12.2009) no support for .dbc (primary/foreign keys,..). -Plain CREATE TABLE commands are generated. - - -You can call VFP script with parameters. See generated script for details. -teLongName gives a possibility to genarate FREE or NAME keywords. -tcCommand can fire immediately after CREATE TABLE. -------------------------------------------------------------------------------------------------------------------------- \ No newline at end of file +07.12.2009 + vfp9 support for WwwSQLDesigner + by zvolsky@seznam.cz + + +Installation: +------------- +vfp9 support is standard part of WwwSQLDesigner - simple choose database vfp9 in Settings. + +You can change the generated script by patch/replace of db\vfp9\output.xsl. + + +WwwSQLDesigner basics: +---------------------- +To start click Index.html. +Never use Page Refresh (F5) - data will be lost! +Use Save button to generate FoxPro script with CREATE TABLEs. +Use Save/Read and Save XML buttons to generate XML and copy-paste it into text file to save your work. +Use Save/Read and Read XML buttons to continue work. + + +Use of VFP9 support: +-------------------- +Textbox "Default" in Field adding has different meaning. Here you can enter all foxpro keywords, which follow field definition. +No word "DEFAULT" is added. To use some DEFAULT, write "DEFAULT value". If you let just "NULL" in Textbox "Default", +you will receive FoxPro error. Write "DEFAULT .NULL." instead. + +Data types Binary aren't in list. Use standard Varchar, Character, Memo instead and write "NOCPTRANS" into the "Default" textbox. + +Data type "Integer (not key)" differents (from the primary/foreign key) just in its color (but generates standard Integer). + + + +Generated VFP script contains (optional) parameters, which change behavior of CREATE TABLE commands: +teLongName gives a possibility to generate FREE or NAME keywords. +tcCommand can fire immediately after each CREATE TABLE (new table is selected). + F.e. "= MyProc( ALIAS(), m.lcTableComment, @lacComments )" gives access to alias and all comments from model inside MyProc() procedure. +tcPath can control path, where tables will be created. + +Comments aren't copied directly into target database. +Instead of this, they are prepared in lcTableComment variable (table comment) and in lacComments array (field comments) before &tcCommand call. +So you can work with comments in your user defined code as you want.