Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CW-Fieldtypes equvalent to MySQL 1

Status
Not open for further replies.

bazzo

Programmer
Feb 14, 2002
6
DE
Hallo all,

I am able to access to a MySQL-DB on a Linux-Webserver.

I want to write a small program in CW 5.5e ´to work on the Web-DB from my Desktop.

Where can I get info about the different fieldtypes?

What is char or varchar, int, date etc equivalent to in CW?

Is there any source where I can look at?

tia
bazzo
 
Gaudalier,

thank you very much for your helpful reply.

One additionale question: Rick Hoffmann writes about MS-SQL.

Is there a difference or any difference at all between the different SQL-breeds concerning the fieldtypes?

bye
bazzo
 
Gaudalier,

sorry but I have to come up with another question.

Each MySQL has a user and a password.

My first SQL-DB is "myfirstsql" and it contains one table, simply "adresses"

As far as I understood the resources you mentioned I need to put them into the dictionary.

Name: "adresses"
Driver: "ODBC"
DriverOptions: ""
OwnerName: "myfirstsql,username,userpassword"
Fullpathname: ""

Is that correct?

At the moment I test it locally on my computer.

Apache, MySQL and phpMyAdmin run successful.

Accessing does not work, I receive a message
"File adresses could not be opened, Access denied for user username@...."

Then I realized that I have no user and no pw locally.

I tried root instead of username, without pw.

Result is now "[mysql][odbc3.51]unknown database 'adresses'"

What is my mistake?
tia
bazzo
 
IF ya're using ODBC Try putting on the Table's Owner Name:


Code:
<YourSQLServer>,<user>,<password>;


I'm using Direct Access to MSSQL 7.0 (NO ODBC) & I'm using a Single Global Variable for All the Tables' Owner Name, and that variables is initialized before open any table this way:

Code:
Glo:Login = 'MyServerName,MyDataBase,UserName,Password,'


So you must to do it in testing with MySql (wich I'll be using very soon!.)

bye -----
carabez@hotmail.com
 

Sorry, I forgot to mention that you MUST to append ';' at ODBC OWNER name:

<YourSQLServer>,<user>,<password>;

And I typed an aditional ',' at:

Glo:Login = 'MyServerName,MyDataBase,UserName,Password'


Q.- Is there a difference or any difference at all between the different SQL-breeds concerning the fieldtypes?


R.- Hope it ain't differeces at all ;-) but I'm usign LONG for store DATES, so I Still usign the PICTURE @d8 or any that normally is used in TPS files...

Regards!. -----
carabez@hotmail.com
 
Hello again, Gaudalier,

after your tips I kept on trying...... ;-)

That ; is significant to terminate the owner, indeed!

Clarion is such a great product, but has a poor manual.

After this hint I indeed got one step further and connected to the datbase - just to receive an &quot;Error: Invalid Record Declaration (47)&quot;

Ok, I thought, maybe I wanted too much at once with my char, varchar, int and time...

SO I created another test with a complete new DCT and APP.

I encountered another problem: Table-names may not be longer than 8 character <sigh> [more than poor documentation]{or I have simply overread}

The new dict contained one int(11)/long(???) and three char(20)/string(20).

The field &quot;id&quot; in the SQL-table is autonumbered and primary and unique as it is in Clarion

Same result: 47......

pooooh....... but in general it is easy to use SQL in Clarion, isn't it? ;-)

slightly frustated
bazzo
 
Hola!...

Ok, to overide the 47 error, Clarion's table definition (on the dic) and the SQL Tables MUST MATCH in Size!...

Ergo, if ya wanna implement:

CLARION:
Field Type Size
Id LONG 4 bytes
String1 STRING 20 bytes
String2 STRING 20 bytes
String3 STRING 20 bytes
64 bytes

SQL:
Id Int 4 bytes
String1 Char 20 bytes
String2 Char 20 bytes
String3 Char 20 bytes
64 bytes

After that, You'll need to Implement the keys, As you know the if the keys Don't match, we'll get the 47 Horror...

SQL:
IndexName FieldName Attr.
PK_ID Id Primary, Unique

Clarion:
Key_Name External_Name Attr.
PK_ID PK_ID Unique,Primary, CaseSensitive,Row


The AutoNumber will be manage by The SQL Engine (Only in these tables that has SingleField Primary Keys).


It's Important to note, that if there are any changes in the Database layout, must to be done first on MySQl, and reflect the changes to the Clarion's Dic.

The Calrion's Key Name and External Name MUST BE like the SQL Index Name!


That all!.


bye.
-----
carabez@hotmail.com
 
Hi again, Gaudalier.

You say &quot;that be all&quot; - and I bet you are able to do the right things.... but I still stumble across (maybe) stupid questions:

How long is a LONG? >> CW Manual: &quot; LONG - A four-byte signed integer.&quot;

> CLARION:
> Field Type Size
> Id LONG 4 bytes

assuming this 4 bytes are the usual size of a Clarion LONG I adjusted my id in MySQL to int(4).

btw id is the only field now in that table to avoid any interference from mistakes caused by strings or other buddies ;-)

But you can already guess...even that simple table does return an Invalid Record Error (47)

> After that, You'll need to Implement the
> keys, As you know the if the keys Don't
> match, we'll get the 47 Horror...

> SQL:
> IndexName FieldName Attr.
> PK_ID Id Primary, Unique

oh well, what is the index's name?

I tried the filename test3 (because it is test3.MYI),
I tried PRIMARY,
I tried id

- none of it worked

> The Calrion's Key Name and External Name MUST BE
> like the SQL Index Name!

but how?

meanwhile I get a connection to the database (don't ask me why and how)

I have found out that I have to write
the Full Pathname c:\mysql\data\mytest\test3.myd
(How will this ever work on the web?)

Now I have a connection

I know that because I receive another error-message now:
&quot;An error occured in your SQL-syntax near WHERE 0=1 in Line 1&quot;



-----

> Clarion:
> Key_Name External_Name Attr.
> PK_ID PK_ID Unique,Primary, CaseSensitive,Row


> The AutoNumber will be manage by The SQL Engine
> (Only in these tables that has SingleField Primary Keys).

In CWs key AutoNumber has no to be marked?




(... and what happens if the given MySQL-table has an INT which is not 4-byte?)



soooo many questions...

I have spent days now to get that running, it is rather disappointing.

Good night for now
bazzo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top