Search Results

Search found 1155 results on 47 pages for 'relational algebra'.

Page 11/47 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • mysql, sqlite database source code

    - by Yang
    hi guys, i know implementing database is a huge topic, but i want to have a basic understanding of how database systems works (e.g. memory management, binary tree, transaction, sql parsing, multi-threading, partitions, etc) by investigating the source code of the database, since there are a few already proven very robust open source databases like mysql, sqlite and so on. however, the code are very complicated and i have no clue where to start. also i find that the old school database textbooks are only explaining the theory, not the implementation details. Can anyone suggest how should i get started and is there any books that emphasis on the technology and techniques of building dbms used in modern database industry? Thank in advance!

    Read the article

  • How do you use the LINQ to SQL designer to generate accessor methods for subclasses?

    - by Pricey
    Above is the LINQ to SQL designer view for my data context. Below is the relevant code: public System.Data.Linq.Table<ActivityBase> ActivityBases { get { return this.GetTable<ActivityBase>(); } } ... [Table(Name="dbo.Activities")] [InheritanceMapping(Code="1", Type=typeof(ActivityBase), IsDefault=true)] [InheritanceMapping(Code="2", Type=typeof(Project))] [InheritanceMapping(Code="3", Type=typeof(ProjectActivity))] [InheritanceMapping(Code="5", Type=typeof(Task))] [InheritanceMapping(Code="4", Type=typeof(Activity))] public abstract partial class ActivityBase : INotifyPropertyChanging, INotifyPropertyChanged { ... Is there a way to generate accessor methods for the subclasses as shown in the inheritance mapping above (Project, Task, etc...) without doing it manually? I added them manually but then a change in the designer overwrites any manual changes. Am i doing this wrong? should I not be making accessors for the sub classes? filtering from ActivityBase seems worse to me. Thanks for any help on this.

    Read the article

  • Can someone describe the nested set model from a C#/LINQ perspective?

    - by Chad
    I know the nested set model doesn't pertain to the C# language or LINQ directly... it's what I'm using to develop my web app. For hierarchical data (categories with sub-categories in my case), I'm currently using something similar to the Adjacency List model. At the moment, I've only got 2 levels of categories, but I'd like to take it further and allow for n levels of categories using the nested set model. I'm not quite clear on how to use it in a C# context. Here's the article I'm reading on the nested set model. Though this article cleared up my confusion some, I still have a big ?? in my head: - Is inserting, updating or deleting categories tedious? It looks like the left and right numbers would require re-numbering... what would the LINQ queries look like for the following scenarios? Delete a child node (re-number all node's left/right values) Delete a parent node (what do you do with the orphans?) Move a child node to a different parent node (renumber again) If my understanding is correct, at all times the child node's left/right values will always be between the parent node's left/right values, am I correct? Seems easy enough, if only the categories were static... most likely I need to spend more time to get my head around the concept. Any help is greatly appreciated!

    Read the article

  • Single value data to multiple values of data in database relation

    - by Sofiane Merah
    I have such a hard time picturing this. I just don't have the brain to do it. I have a table called reports. --------------------------------------------- | report_id | set_of_bads | field1 | field2 | --------------------------------------------- | 123 | set1 | qwe | qwe | --------------------------------------------- | 321 | 123112 | ewq | ewq | --------------------------------------------- I have another table called bads. This table contains a list of bad data. ------------------------------------- | bad_id | set_it_belongs_to | field2 | field3 | ------------------------------------- | 1 | set1 | qwe | qwe | ------------------------------------- | 2 | set1 | qee | tte | ------------------------------------- | 3 | set1 | q44w | 3qwe | ------------------------------------- | 4 | 234 | qoow | 3qwe | ------------------------------------- Now I have set the first field of every table as the primary key. My question is, how do I connect the field set_of_bads to set_it_belongs_to in the bads table. This way if I want to get the entire set of data that is set1 by calling on the reports table I can do it. Example: hey reports table.. bring up the row that has the report_id 123. Okay thank you.. Now get all the rows from bads that has the set_of_bads value from the row with the report_id 123. Thanks.

    Read the article

  • How to map IEnumerable<SelectListItem> to IList<> for ListBox

    - by Superhuman
    I have two classes. Class1 and Class2. public class Class1{ ... public virtual IList<Class2> Class2s{get;set;} ... } public class Class2{ ... public virtual IList<Class1> Class1s{get;set;} ... } The view contains <%=Html.ListBox("Class2s", ViewData.Model.Class2s.Select( x => new SelectListItem { Text = x.Name, Value = x.Id.ToString(), Selected = ViewData.Model.Class1.Class2s.Any(y => y.Id == x.Id) }) They have many to many mapping. I have a ListBox in Class1 view which displays Class2. How to map the output of the ListBox back to IList Class2s property of Class1? I am able to display the values in the ListBox but unable to map back the SelectListItem to IList.

    Read the article

  • Should we have a database independent SQL like query language in Django? [closed]

    - by Yugal Jindle
    Note : I know we have Django ORM already that keeps things database independent and converts to the database specific SQL queries. Once things starts getting complicated it is preferred to write raw SQL queries for better efficiency. When you write raw sql queries your code gets trapped with the database you are using. I also understand its important to use the full power of your database that can-not be achieved with the django orm alone. My Question : Until I use any database specific feature, why should one be trapped with the database. For instance : We have a query with multiple joins and we decided to write a raw sql query. Now, that makes my website postgres specific. Even when I have not used any postgres specific feature. I feel there should be some fake sql language which can translate to any database's sql query. Even Django's ORM can be built over it. So, that if you go out of ORM but not database specific - you can still remain database independent. I asked the same question to Jacob Kaplan Moss (In person) : He advised me to stay with the database that I like and endure its whole power, to which I agree. But my point was not that we should be database independent. My point is we should be database independent until we use a database specific feature. Please explain, why should be there a fake sql layer over the actual sql ?

    Read the article

  • Doctrine does not export relation properly

    - by iggnition
    Hi, I've got a MySQL 5.1.41 database which i'm trying to fill with doctrine, but doctrine does not insert the relations correctly. My YAML is: Locatie: connection: doctrine tableName: locatie columns: loc_id: type: integer(4) fixed: false unsigned: false primary: true autoincrement: true org_id: type: integer(4) fixed: false unsigned: false primary: false notnull: false autoincrement: false naam: type: string(30) fixed: false unsigned: false primary: false notnull: true autoincrement: false straat: type: string(30) fixed: false unsigned: false primary: false notnull: true autoincrement: false huisnummer: type: integer(4) fixed: false unsigned: false primary: false notnull: true autoincrement: false huisnummer_achtervoegsel: type: string(3) fixed: false unsigned: false primary: false notnull: false autoincrement: false plaats: type: string(25) fixed: false unsigned: false primary: false notnull: true autoincrement: false postcode: type: string(6) fixed: false unsigned: false primary: false notnull: true autoincrement: false telefoon: type: string(12) fixed: false unsigned: false primary: false notnull: true autoincrement: false opmerking: type: string() fixed: false unsigned: false primary: false notnull: false autoincrement: false inloggegevens: type: string() fixed: false unsigned: false primary: false notnull: false autoincrement: false relations: Organisatie: local: org_id foreign: org_id type: one onDelete: CASCADE onUpdate: CASCADE Organisatie: connection: doctrine tableName: organisatie columns: org_id: type: integer(4) fixed: false unsigned: false primary: true autoincrement: true naam: type: string(30) fixed: false unsigned: false primary: false notnull: true autoincrement: false straat: type: string(30) fixed: false unsigned: false primary: false notnull: true autoincrement: false huisnummer: type: integer(4) fixed: false unsigned: false primary: false notnull: true autoincrement: false huisnummer_achtervoegsel: type: string(3) fixed: false unsigned: false primary: false notnull: false autoincrement: false plaats: type: string(25) fixed: false unsigned: false primary: false notnull: true autoincrement: false postcode: type: string(6) fixed: false unsigned: false primary: false notnull: true autoincrement: false telefoon: type: string(12) fixed: false unsigned: false primary: false notnull: true autoincrement: false opmerking: type: string(255) fixed: false unsigned: false primary: false notnull: false autoincrement: false relations: Locatie: local: org_id foreign: org_id type: many Now if a make an organisation and then create a location which has a foreignkey to organisation everything is fine. but when i try to update the org_id with phpmyadmin i get a contraint error. If i manually set the foreign key to ON_UPDATE CASCADE it does work. Why does doctrine not set this option? I got it to work in Propel, but i really want to use doctrine for this.

    Read the article

  • Should this even be a has_many :through association?

    - by GoodGets
    A Post belongs_to a User, and a User has_many Posts. A Post also belongs_to a Topic, and a Topic has_many Posts. class User < ActiveRecord::Base has_many :posts end class Topic < ActiveRecord::Base has_many :posts end class Post < ActiveRecord::Base belongs_to :user belongs_to :topic end Well, that's pretty simple and very easy to set up, but when I display a Topic, I not only want all of the Posts for that Topic, but also the user_name and the user_photo of the User that made that Post. However, those attributes are stored in the User model and not tied to the Topic. So how would I go about setting that up? Maybe it can already be called since the Post model has two foreign keys, one for the User and one for the Topic? Or, maybe this is some sort of "one-way" has_many through assiociation. Like the Post would be the join model, and a Topic would has_many :users, :through = :posts. But the reverse of this is not true. Like a User does NOT has_many :topics. So would this even need to be has_many :though association? I guess I'm just a little confused on what the controller would look like to call both the Post and the User of that Post for a give Topic. Edit: Seriously, thank you to all that weighed in. I chose tal's answer because I used his code for my controller; however, I could have just as easily chosen either j.'s or tim's instead. Thank you both as well. This was so damn simple to implement, and I think today marks the day that I'm beginning to fall in love with rails.

    Read the article

  • Database design grouping contacts by lists and companies

    - by Serge
    Hi, I'm wondering what would be the best way to group contacts by their company. Right now a user can group their contacts by custom created lists but I'd like to be able to group contacts by their company as well as store the contact's position (i.e. Project Manager of XYZ company). Database wise this is what I have for grouping contacts into lists contact [id_contact] [int] PK NOT NULL, [lastName] [varchar] (128) NULL, [firstName] [varchar] (128) NULL, ...... contact_list [id_contact] [int] FK, [id_list] [int] FK, list [id_list] [int] PK [id_user] [int] FK [list_name] [varchar] (128) NOT NULL, [description] [TEXT] NULL Should I implement something similar for grouping contacts by company? If so how would I store the contact's position in that company and how can I prevent data corruption if a user modifies a contact's company name. For instance John Doe changed companies but the other co-workers are still in the old company. I doubt that will happen often (might not even happen at all) but better be safe than sorry. I'm also keeping an audit trail so in a way the contact would still need to be linked to the old company as well as the new one but without confusing what company he's actually working at the moment. I hope that made sense... Has anyone encountered such a problem? UPDATE Would something like this make sense contact_company [id_contact_company] [int] PK [id_contact] [int] FK [id_company] [int] FK [contact_title] [varchar] (128) company [id_company] [int] PK NOT NULL, [company_name] [varchar] (128) NULL, [company_description] [varchar] (300) NULL, [created_date] [datetime] NOT NULL This way a contact can work for more than one company and contacts can be grouped by companies

    Read the article

  • SimpleDB to ActiveResource. Rails

    - by Victor P
    Im looking for a way to map an ActiveResource to SimpleDB I want to avoid plugins/gems as all I have used are outdated/buggy/not mantained It doesnt seem hard, I wonder if any of you have succesfully implemented a rails app with simpleDB as an Active Resource. How did you do it? Thanks.

    Read the article

  • Representing Sparse Data in PostgreSQL

    - by Chris S
    What's the best way to represent a sparse data matrix in PostgreSQL? The two obvious methods I see are: Store data in a single a table with a separate column for every conceivable feature (potentially millions), but with a default value of NULL for unused features. This is conceptually very simple, but I know that with most RDMS implementations, that this is typically very inefficient, since the NULL values ususually takes up some space. However, I read an article (can't find its link unfortunately) that claimed PG doesn't take up data for NULL values, making it better suited for storing sparse data. Create separate "row" and "column" tables, as well as an intermediate table to link them and store the value for the column at that row. I believe this is the more traditional RDMS solution, but there's more complexity and overhead associated with it. I also found PostgreDynamic, which claims to better support sparse data, but I don't want to switch my entire database server to a PG fork just for this feature. Are there any other solutions? Which one should I use?

    Read the article

  • Rails model relations depending on count of nested relations

    - by Lowgain
    I am putting together a messaging system for a rails app I am working on. I am building it in a similar fashion to facebook's system, so messages are grouped into threads, etc. My related models are: MsgThread - main container of a thread Message - each message/reply in thread Recipience - ties to user to define which users should subscribe to this thread Read - determines whether or not a user has read a specific message My relationships look like class User < ActiveRecord::Base #stuff... has_many :msg_threads, :foreign_key => 'originator_id' #threads the user has started has_many :recipiences has_many :subscribed_threads, :through => :recipiences, :source => :msg_thread #threads the user is subscribed to end class MsgThread < ActiveRecord::Base has_many :messages has_many :recipiences belongs_to :originator, :class_name => "User", :foreign_key => "originator_id" end class Recipience < ActiveRecord::Base belongs_to :user belongs_to :msg_thread end class Message < ActiveRecord::Base belongs_to :msg_thread belongs_to :author, :class_name => "User", :foreign_key => "author_id" end class Read < ActiveRecord::Base belongs_to :user belongs_to :message end I'd like to create a new selector in the user sort of like: has_many :updated_threads, :through => :recipiencies, :source => :msg_thread, :conditions => {THREAD CONTAINS MESSAGES WHICH ARE UNREAD (have no 'read' models tying a user to a message)} I was thinking of either writing a long condition with multiple joins, or possibly writing giving the model an updated_threads method to return this, but I'd like to see if there is an easier way first. Any ideas? Also, if there is something fundamentally wrong with my structure for this functionality let me know! Thanks!!

    Read the article

  • GORM ID generation and belongsTo association ?

    - by fabien-barbier
    I have two domains : class CodeSetDetail { String id String codeSummaryId static hasMany = [codes:CodeSummary] static constraints = { id(unique:true,blank:false) } static mapping = { version false id column:'code_set_detail_id', generator: 'assigned' } } and : class CodeSummary { String id String codeClass String name String accession static belongsTo = [codeSetDetail:CodeSetDetail] static constraints = { id(unique:true,blank:false) } static mapping = { version false id column:'code_summary_id', generator: 'assigned' } } I get two tables with columns: code_set_detail: code_set_detail_id code_summary_id and code_summary: code_summary_id code_set_detail_id (should not exist) code_class name accession I would like to link code_set_detail table and code_summary table by 'code_summary_id' (and not by 'code_set_detail_id'). Note : 'code_summary_id' is define as column in code_set_detail table, and define as primary key in code_summary table. To sum-up, I would like define 'code_summary_id' as primary key in code_summary table, and map 'code_summary_id' in code_set_detail table. How to define a primary key in a table, and also map this key to another table ?

    Read the article

  • Integrating Pentaho/Talend/etc. with an OR Mapper

    - by DaDaDom
    We have an application (Java) with an own OR mapper. Within this system we have what can be compared to Hibernate's interceptors (we call it triggers): Do specific actions just before saving data in the database, after it's deleted and so on. The underlying database is MySQL. Now we would like to use tools such as Pentaho Data Integration or Talend to convert data to put it into our system. It's no problem to do that directly on the SQL level, but by doing so we loose the built-in power of our triggers. Is there a way to somehow integrate any of the Data Integration solutions into our existing application? It would be great if there was a way to write into instances of our classes instead of writing into the database directly. Any hints welcome :-)

    Read the article

  • Limit a user to view only associated records in rails

    - by trobrock
    I have an application with three Models (Profile - SubModel - SubSubModel) chained together with has many relationships. I am trying to limit a user, after logging in, to only retrieving records that are associated with their Profile. I am very new to rails and this is what I had been trying in the Profile model has_many :submodels, :conditions => {:profile_id => self.id} but this is returning an empty data set when calling with Profile.find_by_id(1).submodels, how else could I achieve what I am trying to do. Or should I handle this in the controller or view instead, I thought it sounded well suited for the model to handle this.

    Read the article

  • What's a good pure-python, document-based and flat-file database engine?

    - by joe Simpson
    Hi, for development i'd love to have a flat file database with the requirements up in the title, but I don't seem to be able to find a database with these requirements. I can't seem to get MetaKit to work. I only need it to work on the development machine, but in the real world my product will have more data and needs more room and will need something better. Does anyone know of a database engine capable of this or do I need to just use python's pickle and load and save a file? Joe

    Read the article

  • Entity Framework v4 examples and tutorials of conceptual model mapping

    - by Rody van Sambeek
    In an application I'm writing I have a fairly complicated Database model. I'd like to use EF4 to map this to a whole lot nicer conceptual model. However all the tutorials I've read are with samples of 2 or 3 tables which all map 1 on 1 to the conceptual model. I'd like to learn how to correctly map the database model to a different conceptual model using VS 2010. However I can't find any good tutorials or (preferabally) instruction video's. Somebody got any tips, links or even books?

    Read the article

  • Django: many-to-one fields and data integrity

    - by John
    Let's say that I have a Person who runs an inventory system. Each Person has some Cars, and each Car has a very large number of Parts (thousands, let's say). A Person, Bob, uses a Django form to create a Car. Now, Bob goes to create some Parts. It is only at the form level that Django knows that the Parts belong to some specific Car, and that the Parts.ForeignKey(Car) field should only have a specific Car as a choice. When creating a Part, you have to mess with the form's constructor or similar in order to limit the choice of Cars to only the cars owned by Bob. It does not seem proper that to enforce this ownership at the form level. It seems that other users' Cars must be inaccessible to anyone but the owner of the Car. What do you all think about this, and is there any way to enforce this?

    Read the article

  • Software to find dependencys in a database that not have them as restrictions

    - by Tomas Friden
    I have a database in SQL server 2005 that originaly comes fom an old mainframe. All relations was set in the surrounding software and there are non i the database. I need to find the relations, not by field name but by actual contence in the registers. (as suggestions, I realize I'l have to check them up) It would be nice with some extras, like finding motherless posts etc. but not a primary demand. There are some 200 registers with max 2 000 000 posts in any register. Does any one know of a software that can help me with this? The software I can find presuposes that relations are set in the database :(

    Read the article

  • Exclude rows with Doctrine ORM DQL (NOT IN)

    - by Sheriffen
    I'm building a chat application with codeigniter and doctrine. Tables: - User - User_roles - User_available Relations: ONE user have MANY roles. ONE user_available have ONE user. Users available for chatting will be in the user_available table. Problem: I need to get all users in in user_available that hasn't got role_id 7. So I need to express in DQL something like (this is not even SQL, just in words): SELECT * from user_available WHERE NOT user_available.User.Role.role_id = 7 Really stuck on this one EDIT: Guess I was unclear. The tables are already mapped and Doctrine does the INNER JOIN job for me. I'm using this code to get the admin that waited the longest but now I need the user: $admin = Doctrine_Query::create() ->select('c.id') ->from('Chat_available c') ->where('c.User.Roles.role_id = ?', 7) ->groupBy('c.id') ->orderBy('c.created_at ASC') ->fetchOne(); Now I need to get the user that waited the longest but this does NOT work $admin = Doctrine_Query::create() ->select('c.id') ->from('Chat_available c') ->where('c.User.Roles.role_id != ?', 7) ->groupBy('c.id') ->orderBy('c.created_at ASC') ->fetchOne();

    Read the article

  • Conditional relation

    - by Lowgain
    I've got a model like this: Stem -id -etc And then I have Stemrelation -stem_id -related_stem_id -active I can get the related stems with the following relations class Stem < ActiveRecord::Base has_many :stemrelations has_many :related_stems, :through => :stemrelations end class Stemrelation < ActiveRecord::Base belongs_to :stem belongs_to :related_stem, :class_name => "Stem", :foreign_key => "related_stem_id" end But now I'd only like to get the active relations. I tried adding this to the Stem model: has_many :active_related, :through => :stemrelations, :source => :related_stem, :conditions => {:active => true} but this gives me an error becasue it tries to check the active flag on the stem model instead of the stemrelation. What do I change here? Thanks!

    Read the article

  • ER Diagram flaws

    - by spacker_lechuck
    I have the following ER Diagram for a bank database - customers may have several accounts, accounts may be held jointly by several customers, and each customer is associated with an account set and accounts are members of one or more account sets. What design rules are violated? What modifications should be made and why? So far, a few flaws I'm not sure about are: 1) Redundant owner-address attribute in AcctSets Entity. 2) This ER does not include accounts with multiple owners with different addresses. My Question is: How would I go about fixing these flaws and/or other flaws that I may be missing from my analysis? Thanks!

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >