Questions tagged [database-agnostic]

This tag specifies that the question is independent of any particular database and the sql should work in any rdbms.

100 questions
8
votes
2 answers

How can this SQL query code be broken/exploited by user input?

Possible Duplicate: Can I protect against SQL Injection by escaping single-quote and surrounding user input with single-quotes? We have a legacy app that doesn't do queries using positional parameters, and there's SQL everywhere. It was decided…
Jon Seigel
  • 12,251
  • 8
  • 58
  • 92
7
votes
5 answers

Is NOW() a stable function?

If I do INSERT INTO table1 (datetime1, datetime2) VALUES (NOW(),NOW()) Will the two fields always be identical in both columns? Ditto for INSERT INTO table1 (datetime1, datetime2) VALUES (NOW(),NOW()) …
Johan
  • 74,508
  • 24
  • 191
  • 319
7
votes
1 answer

Distributed primary key - UUID, simple auto increment or custom sequential values?

I know this type of question has been asked before, but I could not find one that compared the options I have in mind. So I am going to post them here, please post links if there are duplicates. This has ended up a rather long post, if you have…
Kioshiki
  • 951
  • 8
  • 22
7
votes
4 answers

Implementing a Flexible Relationship in a RDBMS -- What really are the tradeoffs?

I have a bunch of products with a bunch of different possible attributes for each product. E.g. Product A has a name, size, color, shape. Product B has a name, calories, sugar, etc. One way to solve this is like: 1) Create tables Products (id,…
6
votes
4 answers

Is converting database string enums to integers worth it?

There are two ways to store enum types in database: as a string or as an integer. Saving the enumeration ( sex = {male,female}, account_type = {regular,pro,admin}, etc. ) as strings makes things more readable but requires more space than integers.…
randomguy
  • 12,042
  • 16
  • 71
  • 101
6
votes
3 answers

How to construct query in querydsl without domain classes

While looking for java libraries to build queries in a database agnostic way I came across many including iciql, querydsl, jooq, joist, hibernate etc. I wanted something that does not require configuration files and can work with dynamic schemas.…
MickJ
  • 2,127
  • 3
  • 20
  • 34
6
votes
3 answers

Standard database neutral XSD to describe a relational database schema

Is anyone aware of a vendor neutral XSD to describe a relational database schema? Our system needs to grab information about the structure of a database: Tables Columns and types Primary and Foreign Keys Constraints Indexes etc in a vendor…
5
votes
1 answer

Changing timezone on an existing Django project

Like an idiot, I completely overlooked the timezone setting when I first built an application that collects datetime data. It wasn't an issue then because all I was doing was "time-since" style comparisons and ordering. Now I need to do full reports…
Oli
  • 235,628
  • 64
  • 220
  • 299
5
votes
2 answers

Difference between JOIN...ON...JOIN...ON vs JOIN...JOIN...ON...ON

What, if any, is the difference between the following? FROM table1 LEFT JOIN table2 ON table1.key = table2.key LEFT JOIN table3 ON table2.key = table3.key and: FROM table1 LEFT JOIN table2 LEFT JOIN table3 ON table2.key = table3.key ON…
Misamoto
  • 572
  • 6
  • 16
5
votes
0 answers

How to write a DB-agnostic .NET Core app?

I'm struggling to port a console app from .NET Framework 4.6.2 to .NET Core 2.0. The app needs to connect to a database whose platform is not known at compile time. In the full framework this was easily achieved by using the DbProviderFactories…
Dejan
  • 9,150
  • 8
  • 69
  • 117
5
votes
3 answers

Database neutral .NET application

Many product developers want to write a .NET application which will work seamlessly with any popular RDBMS like SQL server, oracle, DB2 , MySql. If we use the Data application block it dynamically picks the database driver (OracleClient, SQLClient…
Chakra
  • 2,525
  • 8
  • 43
  • 82
4
votes
4 answers

Best way to enforce inter-table constraints inside database

I looking for the best way to check for inter-table constraints an step forward of foreing keys. For instance, to check if a date child record value is between a range date on two parent rows columns. For instance: Parent table ID DATE_MIN …
FerranB
  • 35,683
  • 18
  • 66
  • 85
4
votes
2 answers

What's a good tool to run SQL scripts against any database?

Currently I have a custom tool which generates vanilla-SQL (only using standard SQL), from our Data-models that sets up database schemas and initial data for our new databases, and do version patches, etc... This part is all fine and dandy right…
Robert Gould
  • 68,773
  • 61
  • 187
  • 272
3
votes
3 answers

Where are specific collations used in a modern utf application

I was wondering if collation is still a big issue when working with databases without legacy data. For example, for something like BigQuery or Snowflake the character encoding is utf-8. BigQuery actually only supports two collations -- default and…
David542
  • 104,438
  • 178
  • 489
  • 842
3
votes
3 answers

ANSI sql for comparison with string and non-string

Let's say I have any one of the following expression: SELECT DATE '2014-01-01' < '2014-02-01', DATE '2014-01-01' < '321', 9 < '10', 9 < 'a' Is there a recommendation or requirement in the SQL standard of how these should be…
David542
  • 104,438
  • 178
  • 489
  • 842