From: Rildo P. <ri...@pr...> - 2002-08-30 21:54:38
|
Hi Alain, On Fri, 30 Aug 2002, eurlix wrote: > Ok, (really I am the boss of nobody), but thank you ! > As Linus said "if you make a mistake on the web, it is for eternity" > so my bads things (joins) may made laugh many peoples. > Tant pis ! Well, I don't care to make mistakes. Whom has never made a mistake throw the first stone! Besides, we only learn when we try (with or without mistakes) to do something. So, I prefer trying to learn :^) > First, a question : > the new guide of PostgreSQL (7.2.1 it has changed ans is better) > said : it is better to use PQsendQuery and PQgetResult than > PQexec. > Have you an idea about this ? Let's think a little. With PQsendQuery() we have a multiple-SQL-statement query, that may return several answers, so we must check all the answers (by calling PQgetResult()) till NULL is returned. Where do we return all the collected answers to cobol? (or just the last answer?!) Of course, this means we have a faster way to query many things. On the other side, it is more complex, as we are not able to do another query until this procedure finish. This is the tradeoff. What do you prefer to use? > Second, Using your own code, I have written intfpg.c , > adding some zones to sql_get_tuple and a rustine "frdb_num" > this works, but I think is it not "clean" > frdb_num.bad seem to me more clean, but don't work. > (the comments are in french, but I suppose you understand its). > your help is welcome ! Well, I will have to read it first. Let me answer that later. > third, what I try to do : > with some utilities I analyze the data copybooks of a file > and generate a shell for creation of the table and a cobol subprog > to access to it in the pg db > with three tables > one for the length of the zones > one for the number of decimals > one for said if the zone is signed, sign leading or not signed ; > this works almost automatically but is a little heavy ... What are you trying to tell me? You are trying to map a cobol file (record structure) into an automatically generated table? There are a number of issues there. First, all COMP variables must be converted into textual data (say, by sprintf()). In some places, (for instance in the "oids") postgres don't like to have it included in quotes (like '1234'), but for other numeric data, it must be quoted. There are many more issues (exceptions to the rule)... > Sure you can have some ideas in order to make it more light . > If you have sometime and are interested, I can send you my > procs in order to discuss about them. A simple idea that comes to my mind (for just encapsulating a cobol record in a sql table) is to use blobs (binary large objects). This way you can save everything in native cobol format. But, as I would say, it depends on the kind of application you have in mind. Let us discuss more, so I can have a better picture of it. best regards, Rildo ------------------------------------------------------------------ Rildo Pragana FPGA/uControllers * Linux * tcl/tk R.Joaquim Nabuco,92/302 Derby http://www.pragana.net Recife, PE - Brazil 52011-000 +55-81-3223-5694 |