FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Ado : Field Definition
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
Ado : Field Definition
Posted: Sun Jan 21, 2018 07:42 AM

Hello ,

I try to use the defined datatypes from adodef.ch , i can only test in ADO , .mdb or .accdb

The goal is that the syntax is also accepted in MySql , MsSql , Oracle and Sqlite (see Adofuncs.prg)

Some defines are accepted in the syntax as :

[Fld2] TynyInt

where TynyInt comes from adoDef.ch : #define adTinyInt 16
(removing ad)

Is it safe to use this defines this way for all the DNS ?
Or
1) must we create a table as :
ADO MSSQL MYSQL ORACLE SQLITE
16 TinyInt TinyInt TinyInt TinyInt TinyInt

If so , where can i find this field definitions ?

Or
2) Can the field definition be made with the numeric var (16 in this example)

Frank

test
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Ado : Field Definition
Posted: Fri Jan 26, 2018 01:14 AM

Different RDBSs have different field types. Not all field types are available in all Databases. We need to learn about every Database and choose appropriate field types of that Database to create tables. Typically we need to write an sql statement with the field specifications to create a table and execute the sql statement. If we write an application to work with different databases, we need to write conditionally different sql statements.

FW Ado functions simplify this task. We can use the function:
FWAdoCreateTable( cTable, aCols, oConnectionObject, [lAddAutoInc] ) --> lSuccess
where aCols is a structure exactly like DBSTRUCT() of DBF tables.

This function detects the database from the "oConnectionObject" and chooses appropriate field types and specs and generates sql statement suitable for that database. As of now, this function can handle MSACCESS, MYSQL, SQLITE, MicrosoftSQL, ORACLE for this purpose.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion