Questions tagged [data-access]

Data access typically refers to software and activities related to storing, retrieving, or acting on data housed in a database or other repository.

Data Access is simply the authorization you have to access different data files. Data access can help distinguish the abilities of Administrators and users. E.g. Admins may be able to remove, edit and add data, while a general user may not be able as they don’t have the access to that particular file.

327 questions
112
votes
6 answers

Saving multiple objects in a single call in rails

I have a method in rails that is doing something like this: a = Foo.new("bar") a.save b = Foo.new("baz") b.save ... x = Foo.new("123", :parent_id => a.id) x.save ... z = Foo.new("zxy", :parent_id => b.id) z.save The problem is this takes longer…
captncraig
  • 22,118
  • 17
  • 108
  • 151
87
votes
5 answers

Can I have an optional OUTPUT parameter in a stored procedure?

I have a stored procedure that has a bunch of input and output parameters because it is Inserting values to multiple tables. In some cases the stored proc only inserts to a single table (depending on the input parameters). Here is a mocked up…
Justin
  • 10,667
  • 15
  • 58
  • 79
65
votes
3 answers

Transactions for read-only DB access?

There seem to be very different opinions about using transactions for reading from a database. Quote from the DeveloperWorks article Transaction strategies: Models and strategies overview: Why would you need a transaction if you are only reading…
jbandi
  • 17,499
  • 9
  • 69
  • 81
65
votes
12 answers

How can I generate database tables from C# classes?

Does anyone know a way to auto-generate database tables for a given class? I'm not looking for an entire persistence layer - I already have a data access solution I'm using, but I suddenly have to store a lot of information from a large number of…
VanOrman
  • 4,351
  • 5
  • 35
  • 31
49
votes
13 answers

What's Up with O(1)?

I have been noticing some very strange usage of O(1) in discussion of algorithms involving hashing and types of search, often in the context of using a dictionary type provided by the language system, or using dictionary or hash-array types used…
orcmid
  • 2,618
  • 19
  • 20
46
votes
8 answers

What exactly is "persistence ignorance"?

Persistence ignorance is typically defined as the ability to persist & retrieve standard .NET objects (or POCOs if you really insist on giving them a name). And a seemingly well accepted definition of a standard .NET object is: "...ordinary classes…
Greg Beech
  • 133,383
  • 43
  • 204
  • 250
40
votes
8 answers

Should I use public or private variables?

I am doing a large project for the first time. I have lots of classes and some of them have public variables, some have private variables with setter and getter methods and same have both types. I decided to rewrite this code to use primarily only…
Marek Čačko
  • 980
  • 2
  • 21
  • 31
39
votes
3 answers

Transaction script is Antipattern?

Well there is a similar topic about transaction script with NoSQL database, but this one is about the pattern in general. From what I find about Transaction script, it is not object-oriented at all. Its basically procedural code despite the fact…
Lord Yggdrasill
  • 3,197
  • 4
  • 26
  • 42
31
votes
6 answers

Execute multiple SQL commands in one round trip

I am building an application and I want to batch multiple queries into a single round-trip to the database. For example, lets say a single page needs to display a list of users, a list of groups and a list of permissions. So I have stored procs (or…
tster
  • 17,883
  • 5
  • 53
  • 72
21
votes
16 answers

ORM vs Handcoded Data Access Layer

I'm a bit scared to ask this question as it may start a religous war so I want to be really clear on what I'm looking for. I'm looking for a reason(s) why you would or have jumped one way or the other and also for items to add to my lists. I'm…
19
votes
3 answers

PHP Lazy loading objects and dependency injection

I have recently started reading about dependency injection and it has made me rethink some of my designs. The problem i have is something like this: Let's say i have two classes: Car and Passenger; For those two classes i have some data mappers to…
Ivan Pintar
  • 1,861
  • 1
  • 15
  • 27
16
votes
4 answers

pooled connection timed out

On the production server sometimes randomly the connection fails to the ORacle database. I get a lot of Oracle.DataAccess.Client.OracleException Pooled connection request timed out at…
Coder
  • 886
  • 1
  • 12
  • 28
15
votes
12 answers

Generics in c# & accessing the static members of T

My question concerns c# and how to access Static members ... Well I don't really know how to explain it (which kind of is bad for a question isn't it?) I will just give you some sample code: Class test{ int method1(Obj Parameter1){ …
niklasfi
  • 15,245
  • 7
  • 40
  • 54
14
votes
11 answers

Is it bad practice to run tests on a database instead of on fake repositories?

I know what the advantages are and I use fake data when I am working with more complex systems. What if I am developing something simple and I can easily set up my environment in a real database and the data being accessed is so small that the…
Sruly
  • 10,200
  • 6
  • 34
  • 39
14
votes
8 answers

simple jdbc wrapper

To implement data access code in our application we need some framework to wrap around jdbc (ORM is not our choice, because of scalability). The coolest framework I used to work with is Spring-Jdbc. However, the policy of my company is to avoid…
Mark Vital
  • 960
  • 3
  • 14
  • 25
1
2 3
21 22