Click here to Skip to main content
15,897,032 members
Articles / Programming Languages / C

C++ Wrapper Library for Firebird Embedded SQL

,
Rate me:
Please Sign up or sign in to vote.
4.25/5 (9 votes)
23 Sep 2009CPOL8 min read 45.7K   1.1K   24  
This article is devoted to the Embedded Firebird database usage and also development of C++ wrapper of this database.
/*
 *	PROGRAM:	C preprocessor
 *	MODULE:		sqlda_pub.h
 *	DESCRIPTION:	Public DSQL definitions (included in ibase.h)
 *
 * The contents of this file are subject to the Interbase Public
 * License Version 1.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy
 * of the License at http://www.Inprise.com/IPL.html
 *
 * Software distributed under the License is distributed on an
 * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
 * or implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code was created by Inprise Corporation
 * and its predecessors. Portions created by Inprise Corporation are
 * Copyright (C) Inprise Corporation.
 *
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 */

#ifndef DSQL_SQLDA_PUB_H
#define DSQL_SQLDA_PUB_H

/* Definitions for DSQL free_statement routine */

#define DSQL_close	1
#define DSQL_drop	2

/* Declare the extended SQLDA */

typedef struct
{
	ISC_SHORT	sqltype;			/* datatype of field */
	ISC_SHORT	sqlscale;			/* scale factor */
	ISC_SHORT	sqlsubtype;			/* datatype subtype - currently BLOBs only */
	ISC_SHORT	sqllen;				/* length of data area */
	ISC_SCHAR*	sqldata;			/* address of data */
	ISC_SHORT*	sqlind;				/* address of indicator variable */
	ISC_SHORT	sqlname_length;		/* length of sqlname field */
	ISC_SCHAR	sqlname[32];		/* name of field, name length + space for NULL */
	ISC_SHORT	relname_length;		/* length of relation name */
	ISC_SCHAR	relname[32];		/* field's relation name + space for NULL */
	ISC_SHORT	ownname_length;		/* length of owner name */
	ISC_SCHAR	ownname[32];		/* relation's owner name + space for NULL */
	ISC_SHORT	aliasname_length;	/* length of alias name */
	ISC_SCHAR	aliasname[32];		/* relation's alias name + space for NULL */
} XSQLVAR;

#define SQLDA_VERSION1		1

typedef struct
{
	ISC_SHORT	version;			/* version of this XSQLDA */
	ISC_SCHAR	sqldaid[8];			/* XSQLDA name field */
	ISC_LONG	sqldabc;			/* length in bytes of SQLDA */
	ISC_SHORT	sqln;				/* number of fields allocated */
	ISC_SHORT	sqld;				/* actual number of fields */
	XSQLVAR	sqlvar[1];			/* first field address */
} XSQLDA;

#define XSQLDA_LENGTH(n)	(sizeof (XSQLDA) + (n - 1) * sizeof (XSQLVAR))

#define SQL_TEXT                           452
#define SQL_VARYING                        448
#define SQL_SHORT                          500
#define SQL_LONG                           496
#define SQL_FLOAT                          482
#define SQL_DOUBLE                         480
#define SQL_D_FLOAT                        530
#define SQL_TIMESTAMP                      510
#define SQL_BLOB                           520
#define SQL_ARRAY                          540
#define SQL_QUAD                           550
#define SQL_TYPE_TIME			   560
#define SQL_TYPE_DATE                      570
#define SQL_INT64                          580

/* Historical alias for pre v6 code */
#define SQL_DATE                           SQL_TIMESTAMP

/***************************/
/* SQL Dialects            */
/***************************/

#define SQL_DIALECT_V5				1	/* meaning is same as DIALECT_xsqlda */
#define SQL_DIALECT_V6_TRANSITION	2	/* flagging anything that is delimited
										   by double quotes as an error and
										   flagging keyword DATE as an error */
#define SQL_DIALECT_V6				3	/* supports SQL delimited identifier,
										   SQLDATE/DATE, TIME, TIMESTAMP,
										   CURRENT_DATE, CURRENT_TIME,
										   CURRENT_TIMESTAMP, and 64-bit exact
										   numeric type */
#define SQL_DIALECT_CURRENT		SQL_DIALECT_V6	/* latest IB DIALECT */

#endif /* DSQL_SQLDA_PUB_H */

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer Apriorit Inc.
United States United States
ApriorIT is a software research and development company specializing in cybersecurity and data management technology engineering. We work for a broad range of clients from Fortune 500 technology leaders to small innovative startups building unique solutions.

As Apriorit offers integrated research&development services for the software projects in such areas as endpoint security, network security, data security, embedded Systems, and virtualization, we have strong kernel and driver development skills, huge system programming expertise, and are reals fans of research projects.

Our specialty is reverse engineering, we apply it for security testing and security-related projects.

A separate department of Apriorit works on large-scale business SaaS solutions, handling tasks from business analysis, data architecture design, and web development to performance optimization and DevOps.

Official site: https://www.apriorit.com
Clutch profile: https://clutch.co/profile/apriorit
This is a Organisation

33 members

Written By
Software Developer (Senior) ApriorIT
Ukraine Ukraine
Senior Software Developer of Apriorit Inc.
My favorite tasks are multithreading, networking and WDK.

... But in free time : beer, meat, travelling and photo...)

LinkedIn Profile : Wineblat Eugene

Comments and Discussions