SubSonic Oracle and properties case - subsonic

I don´t know the answer for this question.
With MSSQLSERVER and MYSQL the next configuration runs very well but with Oracle don´t.
With Oracle appear like this
Cargo c = new Cargo();
c.Idcargo = 1;
With MSSQL AND MYSQL
c.IdCargo = 1;
How to configure the connection with Oracle to appear "IdCargo" and not "Idcargo". ??
THE CONFIGURATION:
<providers>
<clear/>
<add name="oracle" type="SubSonic.oracleDataProvider, SubSonic"
connectionStringName="oracle"
fixDatabaseObjectCasing="true"
regexDictionaryReplace="Empresaendereco,EmpresaEndereco;Empresacontato,EmpresaContato;Franqueadoendereco,FranqueadoEndereco;Franqueadocontato,FranqueadoContato;Funcionarioacesso,FuncionarioAcesso;Funcionarioendereco,FuncionarioEndereco;Funcionariocontato,FuncionarioContato;Clienteendereco,ClienteEndereco;Clientecontato,ClienteContato;Clientehistorico,ClienteHistorico;Agendastatus,AgendaStatus;Historicostatus,HistoricoStatus"
generateRelatedTablesAsProperties="true"
fixPluralClassNames="false"
generatedNamespace="ModeloDados"
regexIgnoreCase="false"
removeUnderscores="false"
setPropertyDefaultsFromDatabase="true"
generateNullableProperties="true"
useExtendedProperties="true" useUtc="true"/>
</providers>

Valmir, What does the definition of your Cargo Table look like? I am betting that your error is coming from Oracle and not SubSonic if your definition looks something like this
Create Table Cargo(
ldCargo Decimal(12,0) )
Than your property in subsonic will not come across as ldCargo. This is due to the fact that Oracle stores all of the column names and table names as upper case. You would need to change ldCargo to ld_cargo if you would like to have it come across in SubSonic as camel case (SubSonic will remove the "_" for you)

As runxc1 says Oracle does not respect case for column/table names, your regexdictionaryreplace config is, I imagine, hiding the issue for tables.
You can force oracle to be case sensitive in your db creation scripts by surrounding table/column names with quotes however I believe that has it's own drawbacks:
http://www.dbforums.com/oracle/1005513-column-name-any-convention.html#post3705627
http://oracle.ittoolbox.com/groups/technical-functional/oracle-apps-l/column-name-case-771715
Since you are having the same problem with MySql I would suggest you move to using underscores (once again as runxc1 says) for your db table/column naming conventions then you can remove the regexdictionaryreplace completely.

Related

Increase column's size in Oracle DB tables with Knex.js

I have a Password's column in a table, stored in OracleDB 11g.
In order to store hashed passwords on it, I need to increment its size from 25 to 60 or 100 BYTE.
I do not want to do this manually, I hope I can find a script or anything else using KnexJS (Something like migrations or seeds)
Thank you.
The correct term for what you want to do is "increase", not "increment". It looks like Knex.js supports changing the default DDL for columns (which is to create) to alter via the alter method. http://knexjs.org/#Schema-alter
In theory, it should work something like this:
knex.schema.alterTable('user', function(t) {
t.string('password', 100).alter();
});
I must admit, the following verbage in this method has me a little concerned:
Alter is not done incrementally over older column type so if you like to add notNull and keep the old default value, the alter statement must contain both .notNull().defaultTo(1).alter().
I'm not sure what that means at the end of the day. Just be sure to test this in development before trying it in production!

Moved from sql server to snowflake finding case sensitive collation issue

in snowflake it searches data with case sensitiveness while in sql server it used to search with case insensitiveness i changed database level collation with below command
ALTER DATABASE IF EXISTS powerdb SET COLLATION = 'en-ci'
but it did not help is there any other way to achive case insensitiveness
There's a number of ways really.
one of them is using ILIKE for your string comparison: https://docs.snowflake.net/manuals/sql-reference/functions/ilike.html
another one is setting up collation at column level:
https://docs.snowflake.net/manuals/sql-reference/collation.html
- but please note that not all of the string functions are supported on collated columns
also you can use COLLATION functions (also described in the link below) or set it on database level with account-level parameter of DEFAULT_DDL_COLLATION = 'en-ci'
everything depends on what you want to achieve really...

HikariCP Acceptable Test Query for Sybase 16

The below question and answer is perfect for answering this question for almost any database except for Sybase ASE (SAP ASE):
Efficient SQL test query or validation query that will work across all (or most) databases
What is a suitable setting for ASE ? I'm using ASE 16 with driver:
spring.datasource.driver-class-name=com.sybase.jdbc4.jdbc.SybDriver
pom:
<dependency>
<groupId>com.sybase</groupId>
<artifactId>jconn4</artifactId>
<version>16</version>
</dependency>
From the error below it appears to be expecting a stored procedure, however when I try an existing sproc (as appose to "SELECT 1") it doesn't work either
HikariPool-1 - Failed to execute connection test query (Stored procedure '"SELECT 1"' not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).
app properties:
spring.datasource.hikari.connection-test-query="SELECT 1"
In Sybase ASE select can be without where or from clause
A simple select statement contains only the select clause; the from clause is almost always included, but is necessary only in select statements that retrieve data from tables. All other clauses, including the where clause, are optional.
So you can just use Select 1 removing the double quotes as in example
connection-test-query: SELECT 1

Delete all in FOXPRO

This question may seem rudimentary but nothing that I have found online quite fits.
I am looking at an old FOXPRO script that we used to make a table. At the moment, I am attempting to translate this script into SQL. Of note is the following,
delete all for code='000000'
pack
If I understand this correctly, it deletes all rows/records where the code field has a value of 000000. Am I correct?
"Into SQL"
What do you mean by "SQL"?
Do you mean do the same thing using SQL in VFP for a VFP table? If so then:
use myTable exclusive
delete from myTable where code = '000000'
pack
But I doubt you are asking this, when you could do it by simply using the xBase code you wrote.
Do you mean how to that in an SQL backend like MS SQL server. postgreSQL, MySQL ...? If so then:
delete from myTable where code = '000000'
Note: In your code "all" is unnecessary but wouldn't do any harm.
Note2: In VFP code that you wrote, first line is "marking" the rows as "deleted" that have code value '000000'.
Second line really removes those rows from the table.
What version of foxpro?
delete from [table] where code = '00000'
pack
or
delete for code = '000000'
pack
both should work

Rocket Software SQL ODBC, Retrieve Wrong Filenames

I installed Rocket Software for accessing an Unidata Db through SQL Server 2008. The idea is to write SQL Procedures for populating SQL Tables, but the problem I am getting is retrieving wrong filenames i. e. Select * from MyDb_Members. I got the field names as Member{Name, Phone{number. In my unidata core these fields are named as Member Name, Phone Number.
Do you know if there is way to run sql queries with those field names without getting sql query errors. It looks sql server does not like to use that name convention:
Select Member{Name from MyDb_Members
Error near '{'
Thanks for your help
Try formatting the query using NATIVE keyword. I don't use Unidata, but in UniVerse this works well. I have a lot of columns that contain periods and those are illegal column names in standard SQL.
{ NATIVE "Select * from MyDb_Members" }

Resources