Thread Rating:
  • 288 Vote(s) - 2.75 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Print data
04-03-2017, 11:17 AM, (This post was last modified: 04-03-2017, 03:26 PM by NamDH.)
#1
Print data
English translated below.
_________________________________________


みんなこんにちは。
長い文書ですから、すみません。CURLプログラミング言語をまだ2週間勉強していますけど、今はちょっとCURL に困ります。例えば、ローカルの Oracle データバースから選択された 以下のような RecordSet があります。
Code:
{let rs:RecordSet =
    {connection.create-record-set "SCOTT","SELECT * FROM EMP"}
}

105レコードがあり、 RecordGridで表示でき、それから構築と この RecordSet のすべてのデータを表示たいです。CURL 資料に検索しましたが、 {dump rs}と {value rs}で実行見ましたけど実行できません。 [BasicConnectedRecordSet @0x0CE32A54] とういうしか表現しないです。
PHP プログラミング言語では、 var_dump()や print_r() が データを表示できます。CURL プログラミング言語では同じやつあるか。この文書は何か間違ったか教えてください。ありがとうございます。



_________________________________________
Hello everybody!


Sorry because of this rude post.
I am new to CURL programming language just for 2 weeks and i am very stuck with this problem.
Let's assume that I have a RecordSet selected in my local Oracle database:
Code:
{let rs:RecordSet =
    {connection.create-record-set "SCOTT","SELECT * FROM EMP"}
    }


I have 105 records, I can view it with RecordGrid and I want to show structure and all data of this RecordSet.
I searched in Curl documentation, I have tried "{dump rs}" and "{value rs}" but it doesn't work, what i got just a text "[BasicConnectedRecordSet @0x0CE32A54]".

In PHP programming language, we have syntax like "var_dump()" and "print_r()" to show all our data.
I wondering if we have similar syntax in Curl programming language?

Please tell me if this post is wrong thread or it rude.

Thank in advance.
04-03-2017, 02:42 PM,
#2
RE: Print data
dump (macro) dumps specified values.
However, Recordset is a class object, not a value.
Therefore, the following code is necessary to dump data registered using the record set

Code:
{curl 8.0 applet}

{define-proc {output-recordset rs:RecordSet}:void
    {for f in rs.fields do
        {outfmt {format "%s, ", f.name}}
    }
    {outfmt "\n"}
    
    {for r in rs do
        {for f in rs.fields do
            {outfmt {format "%s, ", r[f.name]}}
        }
        {outfmt "\n"}
    }
}

{let people:RecordSet =
    {RecordSet
        {RecordFields
            {RecordField
                "First", caption = "First Name", domain = String
            },
            {RecordField
                "Last", caption = "Last Name", domain = String
            },
            {RecordField
                "Age", domain = int
            }
        },
        {RecordData First = "John", Last = "Smith", Age = 25},
        {RecordData First = "Jane", Last = "Smith", Age = 29},
        {RecordData First = "Jane", Last = "Jones", Age = 28}
    }
}

{output-recordset people}

04-03-2017, 05:03 PM,
#3
RE: Print data
(04-03-2017, 02:42 PM)dyoshida Wrote: dump (macro) dumps specified values.
However, Recordset is a class object, not a value.
Therefore, the following code is necessary to dump data registered using the record set

Code:
{curl 8.0 applet}

{define-proc {output-recordset rs:RecordSet}:void
    {for f in rs.fields do
        {outfmt {format "%s, ", f.name}}
    }
    {outfmt "\n"}
    
    {for r in rs do
        {for f in rs.fields do
            {outfmt {format "%s, ", r[f.name]}}
        }
        {outfmt "\n"}
    }
}

{let people:RecordSet =
    {RecordSet
        {RecordFields
            {RecordField
                "First", caption = "First Name", domain = String
            },
            {RecordField
                "Last", caption = "Last Name", domain = String
            },
            {RecordField
                "Age", domain = int
            }
        },
        {RecordData First = "John", Last = "Smith", Age = 25},
        {RecordData First = "Jane", Last = "Smith", Age = 29},
        {RecordData First = "Jane", Last = "Jones", Age = 28}
    }
}

{output-recordset people}
Thank you, I found output data with your code in Curl RTE Console, it works.

By the way, do you have any document or any example about CRUD (Create, Read, Update, Delete) with Oracle database?
I am searching in:
+ http://curl.com/

+ http://curlap.com/
+ http://tech.curlap.com/
+ Curl Documentation Viewer (it be shown when i hit F3 or choose Open Definition in Eclipse).

At this time, i can get data from Oracle database and show it with GridView.
04-03-2017, 05:49 PM,
#4
RE: Print data
I found a similar old posted article.

http://communities.curl.com/showthread.php?tid=282


The link in the article is broken, but you can see from the link below.

http://tech.curlap.com/db/
http://tech.curlap.com/?s=data-connection.html



The following library may also be useful.
http://www.curl.com/products/prod/opensource/
04-03-2017, 07:05 PM,
#5
RE: Print data
(04-03-2017, 05:49 PM)dyoshida Wrote: I found a similar old posted article.

http://communities.curl.com/showthread.php?tid=282


The link in the article is broken, but you can see from the link below.

http://tech.curlap.com/db/
http://tech.curlap.com/?s=data-connection.html



The following library may also be useful.
http://www.curl.com/products/prod/opensource/
Thank you for your suggest library, I will do some simple sample to understand how it works.
I can connect to Oracle database at previous time. At this time, I expect more about how to Insert, Edit, Delete data in database.

04-04-2017, 02:27 PM,
#6
RE: Print data
How to Insert, Edit, Delete using ConnectedRecordSet is described RecordSet section of the Curl document.

If the database server allows, committing changes to ConnectedRecordSet will update the data on the database server.
(Please refer to RecordSet.commit )


Possibly Related Threads...
Thread Author Replies Views Last Post
  Using cURL command, how do we fetch stock data which comes back *WITHOUT comm Scotland Warrior 1 3,473 01-16-2015, 10:09 AM
Last Post: dyoshida
  次の meta-data 値を使用しています? umemura 2 4,727 12-09-2013, 03:01 PM
Last Post: umemura
  Weird behaviour while receiving the data rupesh.shukla 0 3,051 11-29-2012, 12:34 AM
Last Post: rupesh.shukla
  How to submit data on web pages using script..? PANDIYAN107 1 3,287 06-11-2012, 04:00 PM
Last Post: alchimiste
  print-graphic-pdfに関して nmyzk 1 3,446 05-11-2012, 05:23 PM
Last Post: nmyzk
  Problemm with separating header and data using curl Khushi 3 10,855 12-13-2011, 10:37 AM
Last Post: c-s
Tongue print-graphic-pdfプロシージャの仕様について 森口 慶紀 1 3,625 09-30-2011, 06:36 PM
Last Post: 森口 慶紀
Forum Jump:


Users browsing this thread:
6 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('1443')