Hi,
Can I work with Google Tables from FWH ?
FWH and Google Tables
- Antonio Linares
- Site Admin
- Posts: 42854
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 185 times
- Been thanked: 124 times
- Contact:
Re: FWH and Google Tables
Yes, you have to use curl:
Code: Select all | Expand
#include "hbcurl.ch"function Main() ? BigQuery( "select ..." )return nilfunction BigQuery( cQuery ) local hCurl, cBuffer := "" local aData := {} local aResult local cUrl := "https://www.googleapis.com/bigquery/v2/projects/your_project_name/queries" curl_global_init() if ! empty( hCurl := curl_easy_init() ) curl_easy_setopt( hCurl, HB_CURLOPT_URL, cUrl ) curl_easy_setopt( hCurl, HB_CURLOPT_DL_BUFF_SETUP ) curl_easy_setopt( hCurl, HB_CURLOPT_HTTPAUTH, HB_CURLAUTH_BASIC ) curl_easy_setopt( hCurl, HB_CURLOPT_POST, 1 ) curl_easy_setopt( hCurl, HB_CURLOPT_HTTPHEADER, { "Content-Type:application/json" } ) curl_easy_setopt( hCurl, HB_CURLOPT_HTTPHEADER, { "Authorization: Bearer yourOauth2key" } ) curl_easy_setopt( hCurl, HB_CURLOPT_POSTFIELDS, ' { "configuration" : { "query" : { "query" : cQuery } } }' ) if curl_easy_perform( hCurl ) == 0 cBuffer = curl_easy_dl_buff_get( hCurl ) if ! empty( cBuffer ) hb_jsonDecode( cBuffer, @aData ) endif else ? "error" endif endif curl_global_cleanup()return If( ! Empty( aData ), aData,)
Re: FWH and Google Tables
What file *.bat from Fwh\samples should be used for assembly of this example?
It Harbour or xHarbour?
What else files (dll) are necessary for its work?
I did not find "hbcurl.ch"
Many thanks!
It Harbour or xHarbour?
What else files (dll) are necessary for its work?
I did not find "hbcurl.ch"
Many thanks!
- Antonio Linares
- Site Admin
- Posts: 42854
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 185 times
- Been thanked: 124 times
- Contact:
Re: FWH and Google Tables
hbcurl.ch is available from:
https://github.com/harbour/core/tree/master/contrib/hbcurl
Use Harbour
You may use FWH\samples\buildh.bat if you want to use CURL from a FWH app, or simply use FWH\samples\build.bat if you don't want to include FWH
https://github.com/harbour/core/tree/master/contrib/hbcurl
Use Harbour
You may use FWH\samples\buildh.bat if you want to use CURL from a FWH app, or simply use FWH\samples\build.bat if you don't want to include FWH