Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get logical data from PostgreSQL
Message
De
22/01/2005 16:48:46
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
How to get logical data from PostgreSQL
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
00979680
Message ID:
00979680
Vues:
75
PostgreSQL has boolean and bit bata types.
Unfortunately, VFP returns them as character columns.
Also, trying to set conversion to logical data type does not work.

Any idea how to force VFP to return logical column from PostgreSQL data ?

To reproduce:

1. Create PostgreSQL data source PostgreSQL
2. Run the code

Observed results: C, C, "Type conversion is invalid" error
Expected results: L, L, No error
cconnstr= 'DSN=PostgreSQL;' + ;
  "DRIVER=PostgreSQL; UID=postgres; PWD=masterkey;"

tnConnHnd = sqlstringconnect( cconnstr )
IF tnConnHnd <= 0
  AERROR(gaError)
  MESSAGEBOX(gaerror[1,2])
  return
  ENDIF

SQLEXEC(tnConnHnd,'DROP TABLE test')

IF SQLEXEC(tnConnHnd,'create table test ( test boolean )') < 0
  * This does not work also:
  * IF SQLEXEC(tnConnHnd,'create table test ( test bit )') < 0
  AERROR(gaError)
  MESSAGEBOX(gaerror[1,2])
  RETURN
  ENDIF

CreateCursorAdapter()
MESSAGEBOX( TYPE('cursoradapter1.test'))

CreateRemoteView()
MESSAGEBOX( TYPE('test'))

DBSetProp('TEST.TEST', 'Field', 'DataType', "L")

* Next USE causes error
* Type conversion required by the DataType property for field 'Test' 
* is invalid.

USE test

RETURN


PROCEDURE CreateCursorAdapter

PUBLIC ca AS cursoradapter
ca =CREATEOBJECT( 'cursoradapter' )
ca.DataSourceType='ODBC'
ca.DataSource = tnConnHnd 
ca.SelectCmd = "SELECT * FROM TEST"
IF !ca.cursorfill()
  AERROR(gaError)
  MESSAGEBOX(gaerror[1,2])
  RETURN
  ENDIF
ENDPROC

PROCEDURE CreateRemoteView

CREATE DATABASE test
CREATE CONNECTION test CONNSTRING (cconnstr)

CREATE SQL VIEW test REMOTE ;
   CONNECTION test ; 
   AS SELECT * FROM test

USE test
ENDPROC
Andrus
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform