2001-05-23 15:26:42 +02:00
|
|
|
/*
|
|
|
|
* PROGRAM: Dynamic SQL runtime support
|
2003-10-05 08:37:26 +02:00
|
|
|
* MODULE: utld.cpp
|
2001-05-23 15:26:42 +02:00
|
|
|
* DESCRIPTION: Utility routines for DSQL
|
|
|
|
*
|
|
|
|
* 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): ______________________________________.
|
2002-06-29 08:56:51 +02:00
|
|
|
*
|
2008-09-11 08:49:27 +02:00
|
|
|
* 21 Nov 01 - Ann Harrison - Turn off the code in parse_sqlda that
|
2002-06-29 08:56:51 +02:00
|
|
|
* decides that two statements are the same based on their message
|
|
|
|
* descriptions because it misleads some code in remote/interface.c
|
|
|
|
* and causes problems when two statements are prepared.
|
2002-10-30 07:40:58 +01:00
|
|
|
*
|
|
|
|
* 2002.10.29 Sean Leyne - Removed obsolete "Netware" port
|
|
|
|
*
|
2001-05-23 15:26:42 +02:00
|
|
|
*/
|
2002-06-29 08:56:51 +02:00
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2001-07-30 01:43:24 +02:00
|
|
|
#include "firebird.h"
|
2004-04-29 00:00:03 +02:00
|
|
|
#include <stdio.h>
|
2001-05-23 15:26:42 +02:00
|
|
|
#include <string.h>
|
|
|
|
#include "../dsql/dsql.h"
|
|
|
|
#include "../dsql/sqlda.h"
|
2003-11-08 00:27:24 +01:00
|
|
|
#include "../jrd/ibase.h"
|
2001-05-23 15:26:42 +02:00
|
|
|
#include "../jrd/align.h"
|
2005-06-10 04:03:08 +02:00
|
|
|
#include "../jrd/constants.h"
|
2001-05-23 15:26:42 +02:00
|
|
|
#include "../dsql/utld_proto.h"
|
2010-10-12 10:02:57 +02:00
|
|
|
#include "../yvalve/gds_proto.h"
|
2008-02-03 15:27:13 +01:00
|
|
|
#include "../common/classes/init.h"
|
2006-08-12 05:17:01 +02:00
|
|
|
|
2008-02-28 14:48:16 +01:00
|
|
|
using namespace Jrd;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2005-06-10 04:03:08 +02:00
|
|
|
/**
|
|
|
|
|
|
|
|
UTLD_char_length_to_byte_length
|
2008-09-11 08:49:27 +02:00
|
|
|
|
2005-06-10 04:03:08 +02:00
|
|
|
@brief Return max byte length necessary for a specified character length string
|
2008-09-11 08:49:27 +02:00
|
|
|
|
2005-06-10 04:03:08 +02:00
|
|
|
@param lengthInChars
|
|
|
|
@param maxBytesPerChar
|
2008-09-11 08:49:27 +02:00
|
|
|
|
2005-06-10 04:03:08 +02:00
|
|
|
**/
|
|
|
|
USHORT UTLD_char_length_to_byte_length(USHORT lengthInChars, USHORT maxBytesPerChar)
|
|
|
|
{
|
2009-01-02 07:36:12 +01:00
|
|
|
return MIN(((MAX_COLUMN_SIZE - sizeof(USHORT)) / maxBytesPerChar) * maxBytesPerChar,
|
2009-04-19 12:05:22 +02:00
|
|
|
(ULONG) lengthInChars * maxBytesPerChar);
|
2005-06-10 04:03:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-09-04 23:31:25 +02:00
|
|
|
ISC_STATUS UTLD_copy_status(const ISC_STATUS* from, ISC_STATUS* to)
|
|
|
|
{
|
|
|
|
/**************************************
|
|
|
|
*
|
|
|
|
* c o p y _ s t a t u s
|
|
|
|
*
|
|
|
|
**************************************
|
|
|
|
*
|
|
|
|
* Functional description
|
|
|
|
* Copy a status vector.
|
|
|
|
*
|
|
|
|
**************************************/
|
|
|
|
const ISC_STATUS status = from[1];
|
|
|
|
|
|
|
|
const ISC_STATUS* const end = from + ISC_STATUS_LENGTH;
|
|
|
|
while (from < end)
|
|
|
|
*to++ = *from++;
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|