database-abstraction

Database abstraction class design using PHP PDO

纵然是瞬间 提交于 2019-12-03 20:21:37
问题 I am in the process of designing a web application (really, it's a hobby, and I'm trying to teach myself design, and what better way is there than doing it :). Anyway, I was thinking about how I would deal with my database. I am comfortable with PDO, and I was thinking of leveraging PDO in my abstraction class. I am thinking of making a singleton, so that there's only one database connection. This singleton would create a PDO connection. After that, I fail to see why I would need to do too

What does “data abstraction” exactly mean?

倾然丶 夕夏残阳落幕 提交于 2019-12-02 23:35:09
What does data abstraction refer to? Please provide real life examples alongwith. Abstraction has two parts: Hide details that don't matter from a certain point of view Identify details that do matter from a certain point of view and consider items to be of the the same class if they possess those details. For example, if I am designing a program to deal with inventory, I would like to be able to find out how many items of a certain type the system has in stock. From the perspective of the interface system, I don't care if I am getting this information from a database, a csv file, a remote

Counting the number of results returned by a database query in Codeigniter

左心房为你撑大大i 提交于 2019-12-01 04:31:41
I am not having much luck detecting when a database query in Codeigniter returns zero results. I have had a good read of the notes on the PHP count function but am none the wiser! I call the query/view as follows from the controller: $data['result'] = $this->search_model->do_search(set_value('name')); $data['title'] = "Search results"; $this->load->view('search_view',$data); The view generates a results table for me OK, but when I try and trap an empty result, the count always returns 1: I have tried if count(array($result)) and just if count($result) So what's a good way to get the count? I'm

Database abstraction class design using PHP PDO

牧云@^-^@ 提交于 2019-11-30 15:26:27
I am in the process of designing a web application (really, it's a hobby, and I'm trying to teach myself design, and what better way is there than doing it :). Anyway, I was thinking about how I would deal with my database. I am comfortable with PDO , and I was thinking of leveraging PDO in my abstraction class. I am thinking of making a singleton, so that there's only one database connection. This singleton would create a PDO connection. After that, I fail to see why I would need to do too much else. I can then just use the database handler to call PDO functions. I may want some helper

Best PHP DAL (data abstraction layer) so far [closed]

烈酒焚心 提交于 2019-11-28 22:27:15
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . What is the best PHP DAL (data abstraction layer) so far developed under any open source project which we could re-use with good faith? I am finding it hard to choose a DAL for my application that sufficiently supports abstraction to most common databases systems (MySQL, PostgreSQL, MSSQL, Oracle, etc) and is:

Database abstraction layer design - Using IRepository the right way?

给你一囗甜甜゛ 提交于 2019-11-28 16:15:39
I'm in the process of designing my ASP.NET MVC application and I ran across a couple of interesting thoughts. Many samples I have seen describe and use the Repository pattern ( IRepository ) so this is the way I did it while I was learning MVC. Now I know what it's all doing, I starting to look at my current design and wonder if it's the best way to go. Currently I have a basic IUserRepository , which defines methods such as FindById() , SaveChanges() , etc. Currently, whenever I want to load/query the user table in the DB, I do something along the lines of the following: private

How To Handle Communication Between the Domain and Database Layers?

半城伤御伤魂 提交于 2019-11-28 02:22:21
问题 I am fairly new to using separate layers for the business logic (Domain) and database access logic, but in the course of working things out I've come across a problem to which I still feel I haven't found a great solution. Clarification My existing solution uses Data Mappers to deal with the database interactions directly. However, as I've further investigated this issue many people have suggested that the Domain layer should not directly communicate with nor contain the Data Mappers that

Database abstraction layer design - Using IRepository the right way?

六月ゝ 毕业季﹏ 提交于 2019-11-27 09:38:08
问题 I'm in the process of designing my ASP.NET MVC application and I ran across a couple of interesting thoughts. Many samples I have seen describe and use the Repository pattern ( IRepository ) so this is the way I did it while I was learning MVC. Now I know what it's all doing, I starting to look at my current design and wonder if it's the best way to go. Currently I have a basic IUserRepository , which defines methods such as FindById() , SaveChanges() , etc. Currently, whenever I want to load

mysqli or PDO - what are the pros and cons? [closed]

会有一股神秘感。 提交于 2019-11-25 21:37:31
问题 In our place we\'re split between using mysqli and PDO for stuff like prepared statements and transaction support. Some projects use one, some the other. There is little realistic likelihood of us ever moving to another RDBMS. I prefer PDO for the single reason that it allows named parameters for prepared statements, and as far as I am aware mysqli does not. Are there any other pros and cons to choosing one over the other as a standard as we consolidate our projects to use just one approach?