* in quotes. This is especially true for those that do not
* allow keywords used as aliases.
*/
-/* #define BACKSQL_ALIASING_QUOTE '"' */
-/* #define BACKSQL_ALIASING_QUOTE '\'' */
+#define BACKSQL_ALIASING_QUOTE ""
+/* #define BACKSQL_ALIASING_QUOTE "\"" */
+/* #define BACKSQL_ALIASING_QUOTE "'" */
/*
* API
bb.bb_val.bv_len = 0;
bb.bb_len = 0;
backsql_strfcat( &bb, "sb",
- "SELECT COUNT(distinct subordinates.id) FROM ldap_entries,ldap_entries subordinates WHERE subordinates.parent=ldap_entries.id AND ",
-
+ "SELECT COUNT(distinct subordinates.id) "
+ "FROM ldap_entries,ldap_entries " BACKSQL_ALIASING "subordinates "
+ "WHERE subordinates.parent=ldap_entries.id AND ",
&bi->sql_children_cond );
bi->sql_has_children_query = bb.bb_val.bv_val;
{
struct berbuf bb = BB_NULL;
-#ifdef BACKSQL_ALIASING_QUOTE
- backsql_strfcat( &bb, "lblcbclblbcbl",
- (ber_len_t)STRLENOF( "SELECT " ), "SELECT ",
- &at_map->bam_sel_expr,
- (ber_len_t)STRLENOF( " " BACKSQL_ALIASING ), " " BACKSQL_ALIASING,
- BACKSQL_ALIASING_QUOTE,
- &at_map->bam_ad->ad_cname,
- BACKSQL_ALIASING_QUOTE,
- (ber_len_t)STRLENOF( " FROM " ), " FROM ",
- &at_map->bam_from_tbls,
- (ber_len_t)STRLENOF( " WHERE " ), " WHERE ",
- &oc_map->bom_keytbl,
- '.',
- &oc_map->bom_keycol,
- (ber_len_t)STRLENOF( "=?" ), "=?" );
-#else /* ! BACKSQL_ALIASING_QUOTE */
backsql_strfcat( &bb, "lblblblbcbl",
(ber_len_t)STRLENOF( "SELECT " ), "SELECT ",
&at_map->bam_sel_expr,
- (ber_len_t)STRLENOF( " " BACKSQL_ALIASING ), " " BACKSQL_ALIASING,
+ (ber_len_t)STRLENOF( " " BACKSQL_ALIASING BACKSQL_ALIASING_QUOTE ),
+ " " BACKSQL_ALIASING BACKSQL_ALIASING_QUOTE,
&at_map->bam_ad->ad_cname,
- (ber_len_t)STRLENOF( " FROM " ), " FROM ",
+ (ber_len_t)STRLENOF( BACKSQL_ALIASING_QUOTE " FROM " ),
+ BACKSQL_ALIASING_QUOTE " FROM ",
&at_map->bam_from_tbls,
(ber_len_t)STRLENOF( " WHERE " ), " WHERE ",
&oc_map->bom_keytbl,
'.',
&oc_map->bom_keycol,
(ber_len_t)STRLENOF( "=?" ), "=?" );
-#endif /* ! BACKSQL_ALIASING_QUOTE */
if ( !BER_BVISNULL( &at_map->bam_join_where ) ) {
backsql_strfcat( &bb, "lb",
&at_map->bam_join_where );
}
-#ifdef BACKSQL_ALIASING_QUOTE
- backsql_strfcat( &bb, "lcbc",
- (ber_len_t)STRLENOF( " ORDER BY " ), " ORDER BY ",
- BACKSQL_ALIASING_QUOTE,
+ backsql_strfcat( &bb, "lbl",
+ (ber_len_t)STRLENOF( " ORDER BY " BACKSQL_ALIASING_QUOTE ),
+ " ORDER BY " BACKSQL_ALIASING_QUOTE,
&at_map->bam_sel_expr,
- BACKSQL_ALIASING_QUOTE );
-#else /* ! BACKSQL_ALIASING_QUOTE */
- backsql_strfcat( &bb, "lb",
- (ber_len_t)STRLENOF( " ORDER BY " ), " ORDER BY ",
- &at_map->bam_sel_expr );
-#endif /* ! BACKSQL_ALIASING_QUOTE */
+ (ber_len_t)STRLENOF( BACKSQL_ALIASING_QUOTE ),
+ BACKSQL_ALIASING_QUOTE );
at_map->bam_query = bb.bb_val.bv_val;
&bsi->bsi_oc->bom_oc->soc_cname,
'\'' );
}
-#ifdef BACKSQL_ALIASING_QUOTE
- backsql_strfcat( &bsi->bsi_sel, "lclcl",
- (ber_len_t)STRLENOF( " " BACKSQL_ALIASING ),
- " " BACKSQL_ALIASING,
- BACKSQL_ALIASING_QUOTE,
- (ber_len_t)STRLENOF( "objectClass" ),
- "objectClass",
- BACKSQL_ALIASING_QUOTE,
- (ber_len_t)STRLENOF( ",ldap_entries.dn " BACKSQL_ALIASING "dn" ),
- ",ldap_entries.dn " BACKSQL_ALIASING "dn" );
-#else /* ! BACKSQL_ALIASING_QUOTE */
backsql_strfcat( &bsi->bsi_sel, "l",
- (ber_len_t)STRLENOF( " " BACKSQL_ALIASING "objectClass,ldap_entries.dn " BACKSQL_ALIASING "dn" ),
- " " BACKSQL_ALIASING "objectClass,ldap_entries.dn " BACKSQL_ALIASING "dn" );
-#endif /* ! BACKSQL_ALIASING_QUOTE */
+ (ber_len_t)STRLENOF( " " BACKSQL_ALIASING
+ BACKSQL_ALIASING_QUOTE "objectClass" BACKSQL_ALIASING_QUOTE
+ ",ldap_entries.dn " BACKSQL_ALIASING BACKSQL_ALIASING_QUOTE "dn" BACKSQL_ALIASING_QUOTE ),
+ " " BACKSQL_ALIASING
+ BACKSQL_ALIASING_QUOTE "objectClass" BACKSQL_ALIASING_QUOTE
+ ",ldap_entries.dn " BACKSQL_ALIASING BACKSQL_ALIASING_QUOTE "dn" BACKSQL_ALIASING_QUOTE );
backsql_strfcat( &bsi->bsi_from, "lb",
(ber_len_t)STRLENOF( " FROM ldap_entries," ),
0, 0, 0 );
#endif /* BACKSQL_TRACE */
- return SQLPrepare( *sth, query, SQL_NTS );
+ return SQLPrepare( *sth, (SQLCHAR *)query, SQL_NTS );
}
RETCODE
(SQLUINTEGER)( sizeof( colname ) - 1 ),
&name_len, &col_type,
&col_prec, &col_scale, &col_null );
- ber_str2bv( colname, 0, 1, &row->col_names[ i - 1 ] );
+ ber_str2bv( (char *)colname, 0, 1, &row->col_names[ i - 1 ] );
#ifdef BACKSQL_TRACE
Debug( LDAP_DEBUG_TRACE, "backsql_BindRowAsStrings: "
"col_name=%s, col_prec[%d]=%d\n",
}
/* oracle doesn't understand "AS" :( and other RDBMSes don't need it */
-#ifdef BACKSQL_ALIASING_QUOTE
- backsql_strfcat( &res, "scsc", " " BACKSQL_ALIASING,
- BACKSQL_ALIASING_QUOTE, s, BACKSQL_ALIASING_QUOTE );
-#else /* ! BACKSQL_ALIASING */
- backsql_strcat( &res, " " BACKSQL_ALIASING, s, NULL );
-#endif /* ! BACKSQL_ALIASING */
+ backsql_strcat( &res, " " BACKSQL_ALIASING BACKSQL_ALIASING_QUOTE, s, BACKSQL_ALIASING_QUOTE, NULL );
return res.bb_val.bv_val;
}