About the Easysoft ODBC-Zoho Books Driver
The Easysoft ODBC-Zoho Books Driver provides real-time access to Zoho Books data from any application that supports ODBC.
ODBC API and scalar functions
API functions
Use this table to find out what ODBC API functions the Easysoft ODBC-Zoho Books Driver supports:
Function | Status |
---|---|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Not supported |
|
Supported |
|
Supported |
|
Supported |
|
Not supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Supported |
|
Not supported |
|
Supported |
|
Supported |
Scalar functions
The Easysoft ODBC-Zoho Books Driver supports a number of scalar functions:
Use either the SQL-92 or ODBC syntax with scalar functions. For example:
SELECT
Invoice_Id,
Customer_Name,
EXTRACT(YEAR FROM Due_Date) as "Year"
FROM
Invoice
SELECT
Invoice_Id,
Customer_Name,
{fn EXTRACT(YEAR FROM Due_Date)} as "Year"
FROM
Invoice
String functions
The Easysoft ODBC-Zoho Books Driver supports these string functions:
-
ASCII(string_exp)
-
BIT_LENGTH(string_exp)
-
CHAR(code)
-
CHAR_LENGTH(string_exp)
-
CHARACTER_LENGTH
-
CONCAT(string_exp1, string_exp2)
-
DIFFERENCE(string_exp1, string_exp2)
-
INSERT(string_exp1, start, length, string_exp2)
-
LCASE(string_exp)
-
LEFT(string_exp, count)
-
LENGTH(string_exp)
-
LOCATE(string_exp1, string_exp2[,start])
-
LTRIM(string_exp)
-
OCTET_LENGTH(string_exp)
-
POSITION(char_exp IN char_exp)
-
REPEAT(string_exp, count)
-
REPLACE(string_exp1, string_exp2, string_exp3)
-
RIGHT(string_exp, count)
-
RTRIM(string_exp)
-
SOUNDEX(string_exp)
-
SPACE(count)
-
SUBSTRING(string_exp, start, length)
-
TRIM
-
UCASE(string_exp)
Numeric functions
The Easysoft ODBC-Zoho Books Driver supports these numeric functions:
-
ABS(numeric_exp)
-
ACOS(float_exp)
-
ASIN(float_exp)
-
ATAN(float_exp)
-
ATAN2(float_exp1, float_exp2)
-
CEILING(numeric_exp)
-
COS(float_exp)
-
COT(float_exp)
-
DEGREES(numeric_exp)
-
EXP(float_exp)
-
FLOOR(numeric_exp)
-
LOG(float_exp)
-
LOG10(float_exp)
-
MOD(integer_exp1, integer_exp2)
-
PI()
-
POWER(numeric_exp, integer_exp)
-
RADIANS(numeric_exp)
-
RAND([integer_exp])
-
ROUND(numeric_exp, integer_exp)
-
SIGN(numeric_exp)
-
SIN(float_exp)
-
SQRT(float_exp)
-
TAN(float_exp)
-
TRUNCATE(numeric_exp, integer_exp)
Time, date, and interval functions
The Easysoft ODBC-Zoho Books Driver supports these time, date, and interval functions:
-
CURRENT_DATE()
-
CURRENT_TIME[(time-precision)]
-
CURRENT_TIMESTAMP[(timestamp-precision)]
-
CURDATE()
-
CURTIME()
-
DAYNAME(date_exp)
-
DAYOFMONTH(date_exp)
-
DAYOFWEEK(date_exp)
-
DAYOFYEAR(date_exp)
-
EXTRACT(extract-field FROM extract-sourc)
-
HOUR(time_exp)
-
MINUTE(time_exp)
-
MONTH(date_exp)
-
MONTHNAME(date_exp)
-
NOW()
-
QUARTER(date_exp)
-
SECOND(time_exp)
-
TIMESTAMPADD(interval, integer_exp, timestamp_exp)
-
TIMESTAMPDIFF(interval, timestamp_exp1, timestamp_exp2)
-
WEEK(date_exp)
-
YEAR(date_exp)
System functions
The Easysoft ODBC-Zoho Books Driver supports these system functions:
-
DATABASE()
-
IFNULL(exp, value)
-
USER()
Conversion functions
The Easysoft ODBC-Zoho Books Driver supports supports both the SQL-92 CAST function and the ODBC CONVERT function for conversion between compatible data types.
Data type mapping
The Easysoft ODBC-Zoho Books Driver maps Zoho Books data types to ODBC data types in this way:
Zoho Books data type | ODBC data type |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Finding out more about data types on Windows
If you need more information about a data types, for example, the precision and scale, use Microsoft’s ODBC Test to do this.
-
Download the version of ODBC Test that matches your application’s architecture from:
-
Copy both files to a folder on the machine where Easysoft ODBC-Zoho Books Driver is installed.
-
Double-click odbcte32.exe.
-
Select Con > Full Connect.
-
Choose your Easysoft ODBC-Zoho Books Driver data source from the list.
-
Choose Catalog > SQLGetTypeInfo.
-
Either choose SQL_ALL_TYPES=0 (1.0) or a specific data type from the DataType list.
-
Choose Results > Get Data All.
SQL support
The Easysoft ODBC-Zoho Books Driver supports these SQL statements, clauses, and operators:
-
SELECT
-
SELECT DISTINCT
-
WHERE
-
ORDER BY
-
AND
-
OR
-
NOT
-
INSERT INTO
-
NULL
-
UPDATE
-
DELETE
-
TOP
-
MIN
-
MAX
-
COUNT
-
SUM
-
AVG
-
LIKE
-
WILDCARDS
-
IN
-
BETWEEN
-
ALIASES
-
JOINS
-
UNION
-
GROUP BY
-
HAVING
-
EXISTS
-
CASE
Example queries
-
To fetch all records from a table, use the asterisk symbol (
*
) in your queries. For example:SELECT * FROM Invoice
-
To only fetch records whose values are different, use
DISTINCT
. For example:-- Which different customers do we invoice? SELECT DISTINCT Customer_Name AS Different_Customer_Name FROM Invoice -- How many different customers do we invoice? SELECT COUNT(DISTINCT Customer_Name) AS Different_Customer_Total FROM Invoice
-
To filter records, use
WHERE
. For example:SELECT Invoice_Id, Customer_Name, Total FROM Invoice WHERE Billing_Address_Country = 'Germany' SELECT Invoice_Id, Customer_Name, Total FROM Invoice WHERE Billing_Address_Country = 'Germany' OR Billing_Address_Country = 'France' SELECT Invoice_Id, Customer_Name, Total FROM Invoice WHERE Billing_Address_Country = 'Germany' AND Total < 1000
You can also supply a
WHERE
clause value as a parameter. For example, to do this in Python:cursor.execute("SELECT Invoice_Id, Customer_Name, Total FROM Invoice WHERE Billing_Address_Country = ?", ['Germany'])
-
To fetch records that don’t match the
WHERE
clause pattern useNOT
. For example:SELECT Invoice_Id, Customer_Name, Total FROM Invoice WHERE NOT Billing_Address_Country = 'Germany'
-
To sort the result set in either ascending or descending order, use
ORDER BY
. For example:SELECT Invoice_Id, Customer_Name, Invoice_Number FROM Invoice ORDER BY Invoice_Number ASC SELECT Customer_Name, Billing_Address_City, Billing_Address_Country FROM Invoice ORDER BY ( CASE WHEN Billing_Address_City IS NULL THEN Billing_Address_Country ELSE Billing_Address_City END );
-
To group a result set into summary rows, use
GROUP BY
. For example:SELECT COUNT(Invoice_Id) As "Number", Billing_Address_Country FROM Invoice GROUP BY Billing_Address_Country SELECT COUNT(Invoice_Id) As "Number", Billing_Address_Country FROM Invoice GROUP BY Billing_Address_Country HAVING COUNT(Invoice_Id) > 10;
-
To do calculations based on result set vales, use the SQL aggregate functions
MIN()
,MAX()
,COUNT()
,SUM()
, andAVG()
. For example:SELECT Max(Total) FROM Invoice SELECT Sum(Total) FROM Invoice
In addition, you can use these scalar funtions.
-
To convert between compatible data types, use
CAST
orCONVERT
. For example:SELECT CAST(Total AS Char(100))FROM Invoice SELECT {fn CONVERT(Total, SQL_CHAR)} FROM Invoice
-
To fetch records that contain column values between a given range, use
BETWEEN
For example:SELECT Invoice_Id, Customer_Name FROM Invoice WHERE Total BETWEEN 10 AND 20
-
To combine the result set of two or more
SELECT
statements, useUNION
. For example:SELECT 'Recurring Expense' AS Type, Recurrence_Name, Total FROM Recurring_Bill UNION SELECT 'Recurring Bill', Customer_Name, Total FROM Recurring_Expense
-
To combine rows from two or more tables, use
JOIN
. For example:SELECT Account_Id, Account_Name FROM Chart_Of_Account INNER JOIN Bank_Account ON Bank_Account.Account_Id = Chart_Of_Account.Account_Id
-
To fetch records that contain column values matching a search pattern, use
LIKE
. For example:SELECT Invoice_Id FROM Invoice WHERE Customer_Name LIKE 'E%' SELECT Invoice_Id FROM Invoice WHERE Customer_Name LIKE '_asysoft'
-
To search for columns without a value (
NULL
) or with a value (nonNULL
), use eitherIS NULL
orIS NOT NULL
. For example:SELECT Invoice_Id, Customer_Name, Total FROM Invoice WHERE Payment_Terms IS NULL
-
To specify multiple values in a
WHERE
clause, you can useIN
as an alternative toOR
. For example:SELECT Invoice_Id, Customer_Name, Total FROM Invoice WHERE Billing_Address_Country = 'Germany' OR Billing_Address_Country = 'France' OR Billing_Address_Country = 'United Kingdom'
can be replaced with:
SELECT Invoice_Id, Customer_Name, Total FROM Invoice WHERE Billing_Address_Country IN ('Germany', 'France', 'United Kingdom');
-
To set the maximum number of records to return, use
TOP
. For example:SELECT Top 10 Invoice_Id, Customer_Name FROM Invoice
-
To test for the existence of records in a subquery, use
EXISTS
. For example:SELECT Customer_Name FROM Invoice WHERE EXISTS ( SELECT Contact_Name FROM Contact WHERE Invoice.Customer_Id = Contact.Contact_Id AND Customer_Sub_Type = 'individual' )
Example inserts, updates, and deletes
-
To insert a Zoho Books record, use
INSERT INTO
. For example:INSERT INTO Bank_Account ( Account_Name, Account_Type, Account_Number, Routing_Number, Currency_Code ) VALUES ( 'COOP Account', 'bank', '80000009823', '123456789', 'GBP' )
-
Here’s a SQL Server linked server example:
INSERT INTO [Zoho Books].ZOHOB.DBO.Bank_Account ( Account_Name, Account_Type, Account_Number, Routing_Number, Currency_Code ) VALUES ( 'COOP Account', 'bank', '80000009823', '123456789', 'GBP' )
-
Here’s an Oracle linked table example:
INSERT INTO "Bank_Account"@ZohoBooksLink ( "Account_Name", "Account_Type", "Account_Number", "Routing_Number", "Currency_Code" ) VALUES ( 'COOP Account', 'bank', '80000009823', '123456789', 'GBP' );
-
The Easysoft ODBC-Zoho Books Driver also supports parameterized inserts. Here’s an example of doing this in PHP:
$stmt = odbc_prepare($cnx, "INSERT INTO Bank_Account (Account_Name, Account_Type, Account_Number, Routing_Number, Currency_Code) VALUES (?, ?, ?, ?, ?)"); $success = odbc_execute($stmt, array('COOP Account', 'bank', '80000009823', '123456789', 'GBP'));
-
To update a Zoho Books record, use
UPDATE
. For example:UPDATE Bank_Account SET Account_Name = 'COOP Account' WHERE Account_Id = '661294000000089005'
The Easysoft ODBC-Zoho Books Driver also supports parameterized updates. Here’s an example of doing this in Perl:
my $sth = $dbh->prepare('UPDATE Bank_Account SET Account_Name = \'COOP Account\' WHERE Account_Id = ?') or die "Can't prepare statement: $DBI::errstr"; $sth->execute('661294000000089005');
-
To delete a Zoho Books record, use
DELETE
. For example:-- Delete (mark inactive) a bank account DELETE FROM Bank_Account WHERE Account_Id = '661294000000108004'
The Easysoft ODBC-Zoho Books Driver also supports parameterized deletes. Here’s an example of doing this in Python:
sql = "DELETE FROM Bank_Account WHERE Account_Id = ?" cursor.execute(sql, '661294000000097009')