FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour DBF to SQL script tool
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: DBF to SQL script tool
Posted: Tue Aug 05, 2014 12:41 PM

We can and we should create different databases on the server for different projects/purposes. On some servers like MSSql, they are referred to as Catalogs. Purpose is the same. You can consider them as folders on our disk.

You can either create them with the help of tools provided at the time of installation or through program:
oCn:Execute( "CREATE DATABASE FWH" ) // here FWH is the database we are creating.

Then while connecting you can directly connect to FWH as default database/catalog.
That is what is the cInitCat is meant for.

Regards



G. N. Rao.

Hyderabad, India
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: DBF to SQL script tool
Posted: Wed Aug 06, 2014 08:08 AM

Hi Mr. Rao,

I understand. but how can I find out FWH is created or not created. After than I can create database

I also use MySql.

Thanks.

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: DBF to SQL script tool
Posted: Wed Aug 06, 2014 08:55 AM
Hi,

You can use
Code (fw): Select all Collapse
oCn:Execute( "CREATE DATABASE IF NOT EXISTS FWH" )


Then it will be only created when it doesn't exist.
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: DBF to SQL script tool
Posted: Wed Aug 06, 2014 09:14 AM
Marc Vanzegbroeck wrote:Hi,

You can use
Code (fw): Select all Collapse
oCn:Execute( "CREATE DATABASE IF NOT EXISTS FWH" )


Then it will be only created when it doesn't exist.


Thank you Marc. I will try it soon.
Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 301
Joined: Fri Jun 01, 2007 09:07 AM
Re: DBF to SQL script tool
Posted: Wed Aug 06, 2014 08:15 PM
I understand. but how can I find out FWH is created or not created. After than I can create database


Why not something like this

Code (fw): Select all Collapse
TRY
 oCn:Execute( "CREATE DATABASE FWH" )
 CATCH
 MsgInfo("Error while creating database FWH")
END TRY
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: DBF to SQL script tool
Posted: Wed Aug 06, 2014 08:22 PM
Horizon wrote:Hi Mr. Rao,

I understand. but how can I find out FWH is created or not created. After than I can create database

I also use MySql.

Thanks.


Use the FW_AdoTableExists ( cTable, oCn ) function to see if the table was created (ADOFUNCS,PRG)
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces

Continue the discussion