Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Wrong numeric field size from SQLEXEC() call
Message
De
14/12/2005 10:57:41
 
 
À
14/12/2005 05:26:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Divers
Thread ID:
01077250
Message ID:
01077852
Vues:
46
Hello Andrus,

"I want to specify data types for some columns only, not for all columns.
How this can be done ?"

you can map any column in the resultset to a specific type in the cursorschema parameter.
e.g.

lcSchema = 'foo1 N(1), foo2 N(1), foo3 L, foo4 C(254) NOCPTRANS, foo5 W'
IF SQLEXECEX(nconnh, csql,'','',0,lcSchema) < 0

one thing to note is that N(1) in FoxPro is not the same as NUMERIC(1) in most DMBS's. Sounds a little strange but FoxPro defines it differently.
In FoxPro the 1 represents only display size, including the minus (-) prefix on negative numbers and the decimal seperator, but you can store any numerical value into it. In most DBMS's NUMERIC(1) defines that only numeric values between -9 to 9 can be inserted. That's why a NUMERIC(12,2) datatype from MSSQL Server for example is mapped to N(14,2) by default.

And this should also be the cause of the problem you got in thread xyz from a few days ago where you wanted to insert a large numerics into a NUMERIC(10) column. Postgres will trigger error "Numeric overflow" (or something similar) if you try to insert numerics with more than 10 digits.

"I wrote in other thread today that VFP SQLEXEC() does not call FreeStmt(SQL_CLOSE) and FreeStmt(SQL_RESET_PARAMS) after error from ODBC."
Will you SQLEXECEX() make those calls? I'm sorry, I havent studied its source code."

I had a look at the links you posted but without having repro code I cannot tell you if SQLEXECEX would work. I tried downloading the repro code from your site but the file wasn't available anymore, you may send it to me by email and i'll have a look and correct SQLEXECEX if neccessary.

Regards
Christian
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform