| 4169 | // |
| 4170 | |
| 4171 | static act* act_set_dialect() |
| 4172 | { |
| 4173 | act* action = (act*) MSC_alloc(ACT_LEN); |
| 4174 | action->act_type = ACT_sql_dialect; |
| 4175 | |
| 4176 | USHORT dialect = EXP_USHORT_ordinal(false); |
| 4177 | if (dialect < 1 || dialect > 3) |
| 4178 | CPR_s_error("SQL DIALECT 1,2 or 3"); |
| 4179 | |
| 4180 | if (gpreGlob.isc_databases && dialect != gpreGlob.compiletime_db_dialect && |
| 4181 | gpreGlob.sw_ods_version < 10) |
| 4182 | { |
| 4183 | char warn_mesg[100]; |
| 4184 | sprintf(warn_mesg, "Pre 6.0 database. Cannot use dialect %d, Resetting to %d\n", |
| 4185 | dialect, SQL_DIALECT_V5); |
| 4186 | dialect = SQL_DIALECT_V5; |
| 4187 | CPR_warn(warn_mesg); |
| 4188 | } |
| 4189 | else if (gpreGlob.isc_databases && dialect != gpreGlob.compiletime_db_dialect) |
| 4190 | { |
| 4191 | char warn_mesg[100]; |
| 4192 | sprintf(warn_mesg, "Client dialect set to %d. Compiletime database dialect is %d\n", |
| 4193 | dialect, gpreGlob.compiletime_db_dialect); |
| 4194 | CPR_warn(warn_mesg); |
| 4195 | } |
| 4196 | |
| 4197 | action->act_object = (ref*) MSC_alloc(SDT_LEN); |
| 4198 | ((set_dialect*) action->act_object)->sdt_dialect = dialect; |
| 4199 | |
| 4200 | // Needed because subsequent parsing pass1 looks at sw_Sql_dialect value |
| 4201 | gpreGlob.sw_sql_dialect = dialect; |
| 4202 | gpreGlob.dialect_specified = true; |
| 4203 | |
| 4204 | PAR_get_token(); |
| 4205 | return action; |
| 4206 | } |
| 4207 | |
| 4208 | |
| 4209 | //____________________________________________________________ |
no test coverage detected