2012-03-13 13:53 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* harbour/contrib/sddpg/sddpg.c
  * harbour/contrib/sddsqlt3/sddsqlt3.c
  * harbour/contrib/sddmy/sddmy.c
  * harbour/contrib/sddfb/sddfb.c
  * harbour/contrib/sddodbc/sddodbc.c
  * harbour/contrib/sddoci/sddoci.c
    * removed redundant fieldname conversions
    ; I left one TOFIX note in sddfb.c - It's not critical but I'd like
      to ask someone with FB experience to verify it.
This commit is contained in:
Przemyslaw Czerpak
2012-03-13 12:53:47 +00:00
parent 9723beb5c0
commit a5baeb0cb0
7 changed files with 29 additions and 57 deletions

View File

@@ -16,6 +16,17 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-03-13 13:53 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* harbour/contrib/sddpg/sddpg.c
* harbour/contrib/sddsqlt3/sddsqlt3.c
* harbour/contrib/sddmy/sddmy.c
* harbour/contrib/sddfb/sddfb.c
* harbour/contrib/sddodbc/sddodbc.c
* harbour/contrib/sddoci/sddoci.c
* removed redundant fieldname conversions
; I left one TOFIX note in sddfb.c - It's not critical but I'd like
to ask someone with FB experience to verify it.
2012-03-13 12:55 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* harbour/package/harbour.spec
! added missing attribute for harbour.ld.conf file

View File

@@ -213,7 +213,6 @@ static HB_ERRCODE fbOpen( SQLBASEAREAP pArea )
PHB_ITEM pItemEof, pItem;
DBFIELDINFO pFieldInfo;
HB_BOOL bError;
char * pBuffer;
HB_USHORT uiFields, uiCount;
int iType;
@@ -276,16 +275,16 @@ static HB_ERRCODE fbOpen( SQLBASEAREAP pArea )
pItemEof = hb_itemArrayNew( uiFields );
pBuffer = ( char * ) hb_xgrab( MAX_FIELD_NAME + 1 );
bError = HB_FALSE;
for ( uiCount = 0, pVar = pSqlda->sqlvar; uiCount < uiFields; uiCount++, pVar++ )
{
hb_cdpnDup2Upper( hb_vmCDP(),
pVar->sqlname, pVar->sqlname_length,
pBuffer, MAX_FIELD_NAME + 1 );
pBuffer[ MAX_FIELD_NAME ] = '\0';
pFieldInfo.atomName = pBuffer;
/* FIXME: if pVar->sqlname is ended with 0 byte then this hb_strndup()
* and hb_xfree() bewlow is redundant and
* pFieldInfo.atomName = pVar->sqlname;
* is enough.
*/
char * szOurName = hb_strndup( pVar->sqlname, pVar->sqlname_length );
pFieldInfo.atomName = szOurName;
pFieldInfo.uiDec = 0;
@@ -400,12 +399,12 @@ static HB_ERRCODE fbOpen( SQLBASEAREAP pArea )
bError = ( SELF_ADDFIELD( ( AREAP ) pArea, &pFieldInfo ) == HB_FAILURE );
}
hb_xfree( szOurName );
if ( bError )
break;
}
hb_xfree( pBuffer );
if ( bError )
{
hb_itemClear( pItemEof );

View File

@@ -235,7 +235,6 @@ static HB_ERRCODE mysqlOpen( SQLBASEAREAP pArea )
HB_USHORT uiFields, uiCount;
HB_ERRCODE errCode = 0;
HB_BOOL bError;
char * pBuffer;
DBFIELDINFO pFieldInfo;
MYSQL_FIELD * pMyField;
void ** pRow;
@@ -262,19 +261,12 @@ static HB_ERRCODE mysqlOpen( SQLBASEAREAP pArea )
pItemEof = hb_itemArrayNew( uiFields );
pBuffer = ( char * ) hb_xgrab( MAX_FIELD_NAME + 1 );
bError = HB_FALSE;
for ( uiCount = 0; uiCount < uiFields; uiCount++ )
{
pMyField = mysql_fetch_field_direct( pSDDData->pResult, uiCount );
hb_cdpnDup2Upper( hb_vmCDP(),
pMyField->name, strlen( pMyField->name ),
pBuffer, MAX_FIELD_NAME + 1 );
pBuffer[ MAX_FIELD_NAME ] = '\0';
pFieldInfo.atomName = pBuffer;
pFieldInfo.atomName = pMyField->name;
pFieldInfo.uiLen = ( HB_USHORT ) pMyField->length;
pFieldInfo.uiDec = 0;
@@ -405,8 +397,6 @@ static HB_ERRCODE mysqlOpen( SQLBASEAREAP pArea )
break;
}
hb_xfree( pBuffer );
if ( bError )
{
hb_itemRelease( pItemEof );

View File

@@ -342,7 +342,6 @@ static HB_ERRCODE ocilibOpen( SQLBASEAREAP pArea )
DBFIELDINFO pFieldInfo;
PHB_ITEM pName;
char * szOurName;
OCI_Column * col = OCI_GetColumn( rs, uiIndex + 1 );
@@ -363,12 +362,7 @@ static HB_ERRCODE ocilibOpen( SQLBASEAREAP pArea )
}
pName = D_HB_ITEMPUTSTR( NULL, OCI_ColumnGetName( col ) );
szOurName = hb_cdpnDupUpper( hb_vmCDP(), hb_itemGetCPtr( pName ), NULL );
hb_itemRelease( pName );
if( strlen( szOurName ) > MAX_FIELD_NAME )
szOurName[ MAX_FIELD_NAME ] = '\0';
pFieldInfo.atomName = szOurName;
pFieldInfo.atomName = hb_itemGetCPtr( pName );
uiDataType = OCI_ColumnGetType( col );
uiSize = OCI_ColumnGetSize( col );
@@ -481,7 +475,7 @@ static HB_ERRCODE ocilibOpen( SQLBASEAREAP pArea )
bError = ( SELF_ADDFIELD( ( AREAP ) pArea, &pFieldInfo ) == HB_FAILURE );
}
hb_xfree( szOurName );
hb_itemRelease( pName );
if( bError )
break;

View File

@@ -381,7 +381,6 @@ static HB_ERRCODE odbcOpen( SQLBASEAREAP pArea )
DBFIELDINFO pFieldInfo;
PHB_ITEM pName;
char * szOurName;
SQLTCHAR cName[ 256 ];
SQLULEN uiSize;
@@ -398,12 +397,7 @@ static HB_ERRCODE odbcOpen( SQLBASEAREAP pArea )
}
pName = O_HB_ITEMPUTSTRLEN( NULL, ( O_HB_CHAR * ) cName, iNameLen );
szOurName = hb_cdpnDupUpper( hb_vmCDP(), hb_itemGetCPtr( pName ), NULL );
hb_itemRelease( pName );
if( strlen( szOurName ) > MAX_FIELD_NAME )
szOurName[ MAX_FIELD_NAME ] = '\0';
pFieldInfo.atomName = szOurName;
pFieldInfo.atomName = hb_itemGetCPtr( pName );
/*
We do mapping of many SQL types to one Harbour field type here, so, we need store
@@ -549,7 +543,7 @@ static HB_ERRCODE odbcOpen( SQLBASEAREAP pArea )
bError = ( SELF_ADDFIELD( ( AREAP ) pArea, &pFieldInfo ) == HB_FAILURE );
}
hb_xfree( szOurName );
hb_itemRelease( pName );
if ( bError )
break;

View File

@@ -239,7 +239,6 @@ static HB_ERRCODE pgsqlOpen( SQLBASEAREAP pArea )
PHB_ITEM pItemEof, pItem;
HB_USHORT uiFields, uiCount;
HB_BOOL bError;
char* pBuffer;
DBFIELDINFO pFieldInfo;
pArea->pSDDData = memset( hb_xgrab( sizeof( SDDDATA ) ), 0, sizeof( SDDDATA ) );
@@ -268,18 +267,10 @@ static HB_ERRCODE pgsqlOpen( SQLBASEAREAP pArea )
pItemEof = hb_itemArrayNew( uiFields );
pItem = hb_itemNew( NULL );
pBuffer = ( char * ) hb_xgrab( MAX_FIELD_NAME + 1 );
bError = HB_FALSE;
for ( uiCount = 0; uiCount < uiFields; uiCount++ )
{
char * pszName = PQfname( pResult, ( int ) uiCount );
hb_cdpnDup2Upper( hb_vmCDP(),
pszName, strlen( pszName ),
pBuffer, MAX_FIELD_NAME + 1 );
pBuffer[ MAX_FIELD_NAME ] = '\0';
pFieldInfo.atomName = pBuffer;
pFieldInfo.atomName = PQfname( pResult, ( int ) uiCount );
pFieldInfo.uiDec = 0;
switch( PQftype( pResult, ( int ) uiCount ) )
@@ -392,7 +383,7 @@ static HB_ERRCODE pgsqlOpen( SQLBASEAREAP pArea )
bError = HB_TRUE;
break;
}
/* printf( "field:%s \ttype:%d \tsize:%d \tformat:%d \tmod:%d err=%d\n", pBuffer, PQftype( pResult, ( int ) uiCount ), PQfsize( pResult, uiCount ), PQfformat( pResult, uiCount ) , PQfmod( pResult, uiCount ), bError ); */
/* printf( "field:%s \ttype:%d \tsize:%d \tformat:%d \tmod:%d err=%d\n", pFieldInfo.atomName, PQftype( pResult, ( int ) uiCount ), PQfsize( pResult, uiCount ), PQfformat( pResult, uiCount ) , PQfmod( pResult, uiCount ), bError ); */
if ( ! bError )
{
@@ -456,8 +447,6 @@ static HB_ERRCODE pgsqlOpen( SQLBASEAREAP pArea )
break;
}
hb_xfree( pBuffer );
hb_itemRelease( pItem );
if ( bError )

View File

@@ -295,18 +295,13 @@ static HB_ERRCODE sqlite3Open( SQLBASEAREAP pArea )
DBFIELDINFO pFieldInfo;
PHB_ITEM pName;
char * szOurName;
int iDataType;
int iSize;
int iDec;
pName = S_HB_ITEMPUTSTR( NULL, sqlite3_column_name( st, uiIndex ) );
szOurName = hb_cdpnDupUpper( hb_vmCDP(), hb_itemGetCPtr( pName ), NULL );
hb_itemRelease( pName );
if( strlen( szOurName ) > MAX_FIELD_NAME )
szOurName[ MAX_FIELD_NAME ] = '\0';
pFieldInfo.atomName = szOurName;
pFieldInfo.atomName = hb_itemGetCPtr( pName );
iDataType = sqlite3_column_type( st, uiIndex );
@@ -378,7 +373,7 @@ static HB_ERRCODE sqlite3Open( SQLBASEAREAP pArea )
bError = ( SELF_ADDFIELD( ( AREAP ) pArea, &pFieldInfo ) == HB_FAILURE );
}
hb_xfree( szOurName );
hb_itemRelease( pName );
if( bError )
break;