ToMySql

Informations are based on Version 0.04

ToMySql is a Project to explore the mySQL-Database with Gambas.


All contacts with mySQL are passing by a Shell–call.


Till now you can not write to the Tables, exepte by script.

Example are included to learn about/and show writing to the Database and tables.

THIS FILE YOU FIND NOW ALSO IN TOMYSQL UNDER /ABOUT/PROGRAMMERS HELP

Actually I don't use Mlocal.module anymore, because I think, I will move to the Gambas – Translation.

The parts of the ToMySql project are :

ToMySql.module

The StartUp

Fmain.class
FMain.form

The Main Window with the Menu

FLogin.class

FLogin.form

The Login Window

FTree.class

FTree.form

The Tree Window.

Here you can explore you Database, going into eache DB, Table and Fields.

Via FGrid called by a click on the Image, left of 'Tables' you can have a look to the data in the choosen Table.
Database and Table has a Contextmenu

FSampl.class

FSampl.form

The Example:

Here you can play with, and test if all workes.

FAbout.class

FAbout.form

The About Window !?

FGrid.class

FGrid.form
MFillGrid.module

Shows Tables Data.

Fills all Data into a ColumnView ( I call it Grid )

FInput.class
FInput.form

Simple Input Form to enter something ( used for Create Database)

FPassword.class
FPassword.form

change your Password

FShow.class
FShow.form

for showing mysql-Status

FcreateTable.class
FcreateTable.form

creates Tables (if create fails you return to the script) ,you can save the script

FNotepad.class
FNotepad.form

for editing and running Scripts

FUser.class
FUser.form

you can create,modify and delete Users



MSQLExec.module

Functions to talk with mySQL via Shell

MmySQL.modul

Functions reading DB'S , Tables , Fields and ....

MLocal.module

For localizing the Text output ( don't use the gambas-0.50 Translate)

MFunctions.module

Global project Functions

MINIHandler.module

handles with INI-File



ToDO


FXport.class
FXport.form

for Export/Import Databases,Tables and Data from/into mysql to/by script
(not finished)


How to use parts of ToMySql in your projects.

The Startup Module/Classe

Has to have at last these Public Variables

The Code:

'---- Variables -------------------------------------------

PUBLIC bLogedOn AS Boolean

PUBLIC sMyHost AS String

PUBLIC sMyUser AS String

PUBLIC sMyPW AS String

PUBLIC sMyDB AS String

PUBLIC sMyTable AS String



comment

This Variables are used for the connection.

bLogedOn is used for Status metters

sMyHost , sMyUser , sMyPW keep the login parameters

sMyDB , sMyTable keep the target parameters for Database and Table ( and mast be changed, every time you change your target)

All functions in MSQLExec.module use this Variables

On ToMySql you find them in ToMySql.module


MmySQL.module

'# includes old MGetDB.module

'# MGetTables.module

'# MGetRows.module

'# MSelect.module

'# now the Return is allways the same schema

'# includes old

'# MisAlive.module

'#

'# finish a linge with \n and no more '|'

'# so it is easier to write it in a file

'# if bWithHeader=TRUE the Header is first line


FUNCTION GetDB(OPTIONAL bWithHeader AS Boolean = FALSE) AS String


FUNCTION GetTables(sDB AS String,OPTIONAL bWithHeader AS Boolean = FALSE) AS String


FUNCTION GetRows(sTable AS String,OPTIONAL bWithHeader AS Boolean = FALSE) AS String


FUNCTION Select(sSelect AS String) AS String


FUNCTION Get4Show(sShow AS String) AS String


FUNCTION isAlive() AS Boolean


MSQLExec.module

SQLCommandBool and SQLCommandString are working with mysql, the others are wrapper, who uses these both.


FUNCTION SQLCommandBool(sExec AS String,iWait AS Integer) AS Boolean


PUBLIC FUNCTION SQLcommand(sSQL AS String, OPTIONAL iWait AS Integer = 1 ) AS Boolean


PUBLIC FUNCTION SQLExecCommand(sSQL AS String, OPTIONAL iWait AS Integer = 1 ) AS Boolean


PUBLIC FUNCTION SQLcommandOnDB(sSQL AS String, OPTIONAL iWait AS Integer = 1 ) AS Boolean


PUBLIC FUNCTION SQLExecCommandOnDB(sSQL AS String, OPTIONAL iWait AS Integer = 1 ) AS Boolean



FUNCTION SQLCommandString(sExec AS String,iWait AS Integer) AS String


PUBLIC FUNCTION SQLReturn(sSQL AS String, OPTIONAL iWait AS Integer = 1 ) AS String


PUBLIC FUNCTION SQLExecReturn(sSQL AS String, OPTIONAL iWait AS Integer = 1 ) AS String


PUBLIC FUNCTION SQLReturnOnDB(sSQL AS String, OPTIONAL iWait AS Integer = 1 ) AS String


PUBLIC FUNCTION SQLExecReturnOnDB(sSQL AS String, OPTIONAL iWait AS Integer = 1 ) AS String


MLocal.module

PUBLIC FUNCTION LocalText(iNumber AS Integer, OPTIONAL Lang AS String = Application.language ) AS String

SELECT Upper(Left(Lang,5))

CASE "EN_EN"

SELECT iNumber

' 1 to 999 for Fmain

CASE 1

sTextReturn="Please start mySQLd first"

..................

CASE ELSE

sTextReturn=" Oobs !! Number : " & CStr(iNumber) & " is not defined"

Message.info(sTextReturn)

END SELECT

DEFAULT

' if Lang not found use "EN_EN"

sTextReturn=LocalText(iNumber,"EN_EN")

END SELECT

RETURN sTextReturn

END


Mfunctions.module

PUBLIC FUNCTION FileExist(sFile AS String , OPTIONAL bMessage AS Boolean = TRUE) AS Boolean


'-----------------------------------------------

' returns a Version

' you have to strip all parts you don't need

'-----------------------------------------------

PUBLIC FUNCTION getVersion(sArg AS String,OPTIONAL sArgV AS String = "--version") AS String


MINIHandler.module

PUBLIC SUB SetProfileString(sSection AS String,sName AS String,sValue AS String,sINIFile AS String)

PUBLIC FUNCTION GetProfileString(sSection AS String,sName AS String,sINIFile AS String) AS String


MfillGrid.module

'# reading Data to a CV = Grid

'#--------- 01/19/2003 -- charlie----------------

'# get it sorted like in table, not invers


PUBLIC SUB FillGrid(thisGrid AS ColumnView,sContent AS String, OPTIONAL iCount AS Integer = 0)





ToMySql Source Code