Ado : Field Definition

Ado : Field Definition

Postby Franklin Demont » Sun Jan 21, 2018 7: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
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am

Re: Ado : Field Definition

Postby nageswaragunupudi » Fri Jan 26, 2018 1: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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 111 guests