Search Results

Search found 7391 results on 296 pages for 'record locking'.

Page 98/296 | < Previous Page | 94 95 96 97 98 99 100 101 102 103 104 105  | Next Page >

  • Thinking of an Inner Join as a Cross Join and then satisfying some condition(s)?

    - by Jian Lin
    It seems like the safest way to think of an Inner Join is to think of it as a Cross Join and then satisfying some condition(s)? Because the equi-join can be obvious, but the non-equi-join can be a bit confusing. But if we always use the Cross Join, and then filter out the ones satisfying the condition, then we get the resulting table. In other words, we can always analyze it by using the first record on the left table, and then go through every single records on the right, and then repeat that for 2nd record on the left, and for the 3rd, 4th, ... etc. So in our mind, we can analyze it using this way, and it is like O(n^2), although what happens in the DBMS maybe that it is a lot faster (when an index is present). Is there another good way to think of it besides this method?

    Read the article

  • It seems like the safest way to think of an Inner Join is to think of it as a Cross Join and then sa

    - by Jian Lin
    It seems like the safest way to think of an Inner Join is to think of it as a Cross Join and then satisfying some condition(s)? Because the equi-join can be obvious, but the non-equi-join can be a bit confusing. But if we always use the Cross Join, and then filter out the ones satisfying the condition, then we get the resulting table. In other words, we can always analyze it by using the first record on the left table, and then go through every single records on the right, and then repeat that for 2nd record on the left, and for the 3rd, 4th, ... etc. So in our mind, we can analyze it using this way, and it is like O(n^2), although what happens in the DBMS maybe that it is a lot faster (when an index is present). Is there another good way to think of it besides this method?

    Read the article

  • What databse uses these specific type of .dat and .idx files?

    - by Cape Cod Gunny
    I'm trying to figure out what type of database uses these specific .dat and .idx files. When I view the .dat files using a binary file reader I see Record Schema followed by somewhat decipherable data names. A little further down I see Key Schema whch apears to be a comma separated list of clear text references. Each .dat file has a matching .idx file. Each .dat file contains the phrase "Record Schema" and "Key Schema" as described above. How would I convert these files so I can use them in an SQL database?

    Read the article

  • How to read line by line a CR-only file with Perl?

    - by Subb
    Hi, I'm trying to read a file which has only CR as line delimiter. I'm using Mac OS X and Perl v.5.8.8. This script should run on every platform, for every kind of line delimiter (CR, LF, CRLF). My current code is the following : open(FILE, "test.txt"); while($record = <FILE>){ print $record; } close(TEST); This currently print only the last line (or worst). What is going on? Obvisously, I would like to not convert the file. Is it possible?

    Read the article

  • Summarising (permanently) data in a SQL table

    - by Cylindric
    Geetings, Stackers. I have a huge number of data-points in a SQL table, and I want to summarise them in a way reminiscent of RRD. Assuming a table such as ID | ENTITY_ID | SCORE_DATE | SCORE | SOME_OTHER_DATA ----+-----------+------------+-------+----------------- 1 | A00000001 | 01/01/2010 | 100 | some data 2 | A00000002 | 01/01/2010 | 105 | more data 3 | A00000003 | 01/01/2010 | 104 | various text ... | ......... | .......... | ..... | ... ... | A00009999 | 01/01/2010 | 101 | ... | A00000001 | 02/01/2010 | 104 | ... | A00000002 | 02/01/2010 | 119 | ... | A00000003 | 02/01/2010 | 119 | ... | ......... | .......... | ..... | ... | A00009999 | 02/01/2010 | 101 | arbitrary data ... | ......... | .......... | ..... | ... ... | A00000001 | 01/02/2010 | 104 | ... | A00000002 | 01/02/2010 | 119 | ... | A00000003 | 01/01/2010 | 119 | I want to end up with one record per entity, per month: ID | ENTITY_ID | SCORE_DATE | SCORE | ----+-----------+------------+-------+ ... | A00000001 | 01/01/2010 | 100 | ... | A00000002 | 01/01/2010 | 105 | ... | A00000003 | 01/01/2010 | 104 | ... | A00000001 | 01/02/2010 | 100 | ... | A00000002 | 01/02/2010 | 105 | ... | A00000003 | 01/02/2010 | 104 | (I Don't care about the SOME_OTHER_DATA - I'll pick something - either the first or last record probably.) What's an easy way of doing this on a regular basis, so that anything in the last calendar month is summarised in this way? At the moment my plan is kind of: For each EntityID For each month Find average score for all records in given month Update first record with results of previous step Delete all records that aren't the first I can't think of a neat way of doing it though, that doesn't involve lots of updates and iteration. This can either be done in a SQL Stored Procedure, or it can be incorporated into the .Net app that's generating this data, so the solution doesn't really need to be "one big SQL script", but can be :) (SQL-2005)

    Read the article

  • Binding multiple arrays for WHERE IN in PostgreSQL

    - by Alec
    So I want to prepare a query something like: SELECT id FROM users WHERE (branch, cid) IN $1; But I then need to bind a variable length list of arrays like (('a','b'),('c','d')) to it. How do I go about doing this? I've tried using ANY but can't seem to get the syntax right. Cheers, Alec Edit: After some fiddling around, this is valid syntactically: SELECT id FROM users WHERE (branch, cid) = ANY ($1::text[][]); and then binding the string '{{a,b},{c,d}}' to $1 but throws the error "operator does not exist: record = text". Changing 'text' to 'record' then throws "input of anonymous composite types is not implemented". Any ideas?

    Read the article

  • MVC validation error with strongly typed view

    - by Remnant
    I have a simple form that I would like to validate on form submission. Note I have stripped out the html for ease of viewing <%=Html.TextBox("LastName", "")%> //Lastname entry <%=Html.ValidationMessage("LastName")%> <%=Html.TextBox("FirstName", "")%>//Firstname entry <%=Html.ValidationMessage("FirstName")%> <%=Html.DropDownList("JobRole", Model.JobRoleList)%> //Dropdownlist of job roles <% foreach (var record in Model.Courses) // Checkboxes of different courses for user to select { %> <li><label><input type="checkbox" name="Courses" value="<%=record.CourseName%>" /><%= record.CourseName%></label></li> <% } %> On submission of this form I would like to check that both FirstName and LastName are populated (i.e. non-zero length). In my controller I have: public ActionResult Submit(string FirstName, string LastName) { if (FirstName.Trim().Length == 0) ModelState.AddModelError("FirstName", "You must enter a first name"); if (LastName.Trim().Length == 0) ModelState.AddModelError("LastName", "You must enter a first name"); if (ModelState.IsValid) { //Update database + redirect to action } return View(); //If ModelState not valid, return to View and show error messages } Unfortunately, this code logic produces an error that states that no objects are found for JobRole and Courses. If I remove the dropdownlist and checkboxes then all works fine. The issue appears to be that when I return the View the view is expecting objects for the dropwdownlist and checkboxes (which is sensible as that is what is in my View code) How can I overcome this problem? Things I have considered: In my controller I could create a JobRoleList object and Course object to pass to the View so that it has the objects to render. The issue with this is that it will overwrite any dropdownlist / checkbox selections that the user has already made. In the parameters of my controller method Submit I could aslo capture the JobRoleList object and Course object to pass back to the View. Again, not sure this would capture any items the user has already selected. I have done much googling and reading but I cannot find a good answer. When I look at examples in books or online (e.g. Nerddinner) all the validation examples involve simple forms with TextBox inputs and don't seems to show instances with multiple checkboxes and dropdownlists. Have I missed something obvious here? What would be best practice in this situation? Thanks

    Read the article

  • WPF/C#: How to simplify the use of codes when calling a function (Generating Images)

    - by eibhrum
    I created a function in one of my application that allows to generate an image (in WPF) by getting the 'source path' from the database that I am using: public void ShowImageThumb() { try { cn = new MySqlConnection(); cn.ConnectionString = ConfigurationManager.AppSettings["MyConnection"]; cn.Open(); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = cn; cmd.CommandType = CommandType.Text; cmd.CommandText = "SELECT thumb FROM album WHERE thumbNo=1"; MySqlDataAdapter adp = new MySqlDataAdapter(); adp.SelectCommand = cmd; DataTable dt = new DataTable(); adp.Fill(dt); MySqlDataReader r = cmd.ExecuteReader(); while (r.Read()) { BitmapImage bmi1 = new BitmapImage(new Uri(r[0].ToString(), UriKind.Relative)); image1.Source = bmi1; } r.Close(); cn.Close(); } catch (Exception err){ System.Windows.MessageBox.Show(err.Message); } finally { } } Take a look on my SQL statement. I put a WHERE thumbNo=1 which allows the function to get 1 record. You see, I do have at least 10 records - file paths listed in that table. I just wanna ask if there's a possible way to make my SQL statement something like this: SELECT thumb FROM album; while having this piece of code inserted in my function: BitmapImage bmi2 = new BitmapImage(new Uri(r["second record?"].ToString(), UriKind.Relative)); image2.Source = bmi2; //something like this BitmapImage bmi3 = new BitmapImage(new Uri(r["third record?"].ToString(), UriKind.Relative)); image3.Source = bmi3; //something like this and so on and so forth, without ending up creating 10 different functions for 10 records. ShowImageThumb2(); . . // will not do this . ShowImageThumb10(); Sorry for the lengthy post. I hope somebody could answer back. Thanks!

    Read the article

  • Unable to enter data into database

    - by Zerotoinfinite
    Hi All, I have a gridview, I am allowing user to enter HTML data while editing a record in a gridview row. When I am clicking update button then I am getting this message A potentially dangerous Request.Form value was detected from the client (ctl00$ContentPlaceHolder1$gvCommentDetails$ctl02$ctl04="This is message,This is mark. ..."). Please let me know how could I resolve this , as I am using sql data source to update the gridview record. ============= " SelectCommand=" SELECT c.Id,c.Name, c.message FROM Table1 c UpdateCommand=" UPDATE Table1 SET Name = @Name, message = @message WHERE Id= @Id" Thanks in adavance

    Read the article

  • Parsing log files in a folder in ColdFusion

    - by Simon Guo
    The problem is there is a folder ./log/ containing the files like: jan2010.xml, feb2010.xml, mar2010.xml, jan2009.xml, feb2009.xml, mar2009.xml ... each xml file would like: <root><record name="bob" spend="20"></record>...(more records)</root> I want to write a piece of ColdFusion code (log.cfm) that simply parsing those xml files. For the front end I would let user to choose a year, then the click submit button. All the content in that year will be show up in separate table by month. Each table shows the total money spent for each person. like: person cost bob 200 mike 300 Total 500 Thanks.

    Read the article

  • PHP/MYSQL Year Month table for news archive

    - by ee12csvt
    Hi all, I am creating a news archive for my site and want to create an overview page from the following DB table id - Unique identifier newsDate - in a format XXXX-XX-XX title - News Item title details - News item photo - News Item Photo caption - News Item Photo caption update - Timestamp for record The news on the site is current but I hope to add some data from years gone by over the next few months and years. What I want to do is create a new line for each year and highlight the month which corresponds to a record in the DB table, similar to that below. 2002 JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC 2004 JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC 2005 JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC 2008 JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC Any help or advice would be much appreciated Cheers

    Read the article

  • Dynamically removing records when certain columns = 0; data cleansing

    - by cdburgess
    I have a simple card table: CREATE TABLE `users_individual_cards` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` char(36) NOT NULL, `individual_card_id` int(11) NOT NULL, `own` int(10) unsigned NOT NULL, `want` int(10) unsigned NOT NULL, `trade` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `user_id` (`user_id`,`individual_card_id`), KEY `user_id_2` (`user_id`), KEY `individual_card_id` (`individual_card_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1; I have ajax to add and remove the records based on OWN, WANT, and TRADE. However, if the user removes all of the OWN, WANT, and TRADE cards, they go to zero but it will leave the record in the database. I would prefer to have the record removed. Is checking after each "update" to see if all the columns = 0 the only way to do this? Or can I set a conditional trigger with something like: //psuedo sql AFTER update IF (OWN = 0, WANT = 0, TRADE = 0) DELETE What is the best way to do this? Can you help with the syntax?

    Read the article

  • Postgres Stored procedure using iBatis

    - by Om Yadav
    --- The error occurred while applying a parameter map. --- Check the newSubs-InlineParameterMap. --- Check the statement (query failed). --- Cause: org.postgresql.util.PSQLException: ERROR: wrong record type supplied in RETURN NEXT Where: PL/pgSQL function "getnewsubs" line 34 at return next the function detail is as below.... CREATE OR REPLACE FUNCTION getnewsubs(timestamp without time zone, timestamp without time zone, integer) RETURNS SETOF record AS $BODY$declare v_fromdt alias for $1; v_todt alias for $2; v_domno alias for $3; v_cursor refcursor; v_rec record; v_cpno bigint; v_actno int; v_actname varchar(50); v_actid varchar(100); v_cpntypeid varchar(100); v_mrp double precision; v_domname varchar(100); v_usedt timestamp without time zone; v_expirydt timestamp without time zone; v_createdt timestamp without time zone; v_ctno int; v_phone varchar; begin open v_cursor for select cpno,c.actno,usedt from cpnusage c inner join account s on s.actno=c.actno where usedt = $1 and usedt < $2 and validdomstat(s.domno,v_domno) order by c.usedt; fetch v_cursor into v_cpno,v_actno,v_usedt; while found loop if isactivation(v_cpno,v_actno,v_usedt) IS TRUE then select into v_actno,v_actname,v_actid,v_cpntypeid,v_mrp,v_domname,v_ctno,v_cpno,v_usedt,v_expirydt,v_createdt,v_phone a.actno,a.actname as name,a.actid as actid,c.descr as cpntypeid,l.mrp as mrp,s.domname as domname,c.ctno as ctno,b.cpno,b.usedt,b.expirydt,d.createdt,a.phone from account a inner join cpnusage b on a.actno=b.actno inner join cpn d on b.cpno=d.cpno inner join cpntype c on d.ctno=c.ctno inner join ssgdom s on a.domno=s.domno left join price_class l ON l.price_class_id=b.price_class_id where validdomstat(a.domno,v_domno) and b.cpno=v_cpno and b.actno=v_actno; select into v_rec v_actno,v_actname,v_actid,v_cpntypeid,v_mrp,v_domname,v_ctno,v_cpno,v_usedt,v_expirydt,v_createdt,v_phone; return next v_rec; end if; fetch v_cursor into v_cpno,v_actno,v_usedt; end loop; return ; end;$BODY$ LANGUAGE 'plpgsql' VOLATILE; ALTER FUNCTION getnewsubs(timestamp without time zone, timestamp without time zone, integer) OWNER TO radius If i am running the function from the console it is running fine and giving me the correct response. But when using through java causing the above error. Can ay body help in it..Its very urgent. Please response as soon as possible. Thanks in advance.

    Read the article

  • Customise a control in dynamics crm

    - by webturner
    I've written code that can make a phone dial a number from a function call, that's done and dusted. What I would like to achieve is adding a Dial button to each phone number field on the forms in Dynamics CRM. Eventually this could also create a new phone record fill in the basic details and show it to the user to enter notes and an outcome for the phone call, and perhaps some other workflow bits to schedule the next call. Can I put a custom control on a standard form in place of the standard control. I'm assuming it would have to be an IFrame to an asp.net page, that pulls in the record id, and the field name, looks up the number to show in a text box, and passes the number to the DialNumber function. Hey presto... I assume its not going to be that easy... Has anyone tried this before, what's the process, what are the gotchas?

    Read the article

  • Jquery cant get dynamic data

    - by Napoleon Wai Lun Wong
    i am a noob to using the jQuery i have a problem about the Uncaught SyntaxError: Unexpected token i am using the 1.9.0 version of jqery i am creating a dynamic number of record, each record would create a "tr" in a table ,also i want to add some dynamic coding into the textbox part of Html coding : <-tbody<-tr id="row_1"<-input id="1" name="collections[appearance][headersubcolor][entity_id1][name]" value="0" class="Root Catalog input-text" type="text" Click inside to change a color of each Category <-tr id="row_2"<-td class="label"<-td class="value"<-input id="2" name="collections[appearance][headersubcolor][entity_id2][name]" value="0" class="Default Category input-text" type="text".... jQuery coding : $('tr[id^="row_"]'.each(function(){ var rowid = parsInt(this.id.replace("row_","")); console.lof("id:"+ rowid); var ??? = new jscolor.color(document.getElementById('???'), {}) }); $('tr[id^="row_"]'.each(function() <--- i cant getting the DATA

    Read the article

  • What is the difference between a constructor and a procedure in Delphi records?

    - by HMcG
    Is there difference in behavior between a constructor call and a procedure call in Delphi records? I have a D2010 code sample I want to convert to D2009 (which I am using). The sample uses a parameterless constructor, which is not permitted in Delphi 2009. If I substitute a simple parameterless procedure call, is there any functional difference for records? I.E. TVector = record private FImpl: IVector; public constructor Create; // not allowed in D2009 end; becomes TVector = record private FImpl: IVector; public procedure Create; // so change to procedure end; As far as I can see this should work, but I may be missing something.

    Read the article

  • Help me understand Rails eager loading

    - by aaronrussell
    I'm a little confused as to the mechanics of eager loading in active record. Lets say a Book model has many Pages and I fetch a book using this query: @book = Book.find book_id, :include => :pages Now this where I'm confused. My understanding is that @book.pages is already loaded and won't execute another query. But suppose I want to find a specific page, what would I do? @book.pages.find page_id # OR... @book.pages.to_ary.find{|p| p.id == page_id} Am I right in thinking that the first example will execute another query, and therefore making the eager loading pointless, or is active record clever enough to know that it doesn't need to do another query? Also, my second question, is there an argument that in some cases eager loading is more intensive on the database and sometimes multiple small queries will be more efficient that a single large query? Thanks for your thoughts.

    Read the article

  • Android insert into sqlite database

    - by Josh
    I know there is probably a simple thing I'm missing, but I've been beating my head against the wall for the past hour or two. I have a database for the Android application I'm currently working on (Android v1.6) and I just want to insert a single record into a database table. My code looks like the following: //Save information to my table sql = "INSERT INTO table1 (field1, field2, field3) " + "VALUES (" + field_one + ", " + field_two + ")"; Log.v("Test Saving", sql); myDataBase.rawQuery(sql, null); the myDataBase variable is a SQLiteDatabase object that can select data fine from another table in the schema. The saving appears to work fine (no errors in LogCat) but when I copy the database from the device and open it in sqlite browser the new record isn't there. I also tried manually running the query in sqlite browser and that works fine. The table schema for table1 is _id, field1, field2, field3. Any help would be greatly appreciated. Thanks!

    Read the article

  • how to invoke function writen in a validation.php and stroe all function name in database.

    - by saint
    Respected all, i'm in trouble. I created a file with name validation.php and store all my validation functionality in this file with different function names like, check_textbox(parm1, pram2, pram3, pram4) { // Definition here } check_chkBox(parm1, pram2) { // Definition here } and so on.....! then i created a table in mysql with the name tbValidation and stored all the function name with parameters in a table. the record stored in table look like as: interfaceid---------- functionNameWithReturnValue 1 ------------ check_textbox(parm1, pram2, pram3, pram4) = 1 2 ------------ check_textbox(parm1, pram2, pram4) = 0 3 ------------ check_textbox(parm1, pram2, pram4) = 1) AND (check_chkBox(parm1, pram2)=0) when i fetch record from database i want to invoke those functions that store in validation.php $data = mysql_fetch_array($drow); if($db->row_count > 0) { // when i fetch row one from database. I used this one but not working // @ $data[0] have value "check_textbox(parm1, pram2, pram3, pram4) = 1" if($data[0]) { // Do this } } How i can do this task...? :(

    Read the article

  • MySQL triggers cannot update rows in same table the trigger is assigned to. Suggested workaround?

    - by Cory House
    MySQL doesn't currently support updating rows in the same table the trigger is assigned to since the call could become recursive. Does anyone have suggestions on a good workaround/alternative? Right now my plan is to call a stored procedure that performs the logic I really wanted in a trigger, but I'd love to hear how others have gotten around this limitation. Edit: A little more background as requested. I have a table that stores product attribute assignments. When a new parent product record is inserted, I'd like the trigger to perform a corresponding insert in the same table for each child record. This denormalization is necessary for performance. MySQL doesn't support this and throws: Can't update table 'mytable' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. A long discussion on the issue on the MySQL forums basically lead to: Use a stored proc, which is what I went with for now. Thanks in advance!

    Read the article

  • Rails link from one model to another based on db field?

    - by Danny McClelland
    Hi Everyone, I have a company model and a person model with the following relationships: class Company < ActiveRecord::Base has_many :kases has_many :people def to_s; companyname; end end class Person < ActiveRecord::Base has_many :kases # foreign key in join table belongs_to :company end In the create action for the person, I have a select box with a list of the companies, which assigns a company_id to that person's record: <%= f.select :company_id, Company.all.collect {|m| [m.companyname, m.id]} %> In the show view for the person I can list the company name as follows: <%=h @person.company.companyname %> What I am trying to work out, is how do I make that a link to the company record? I have tried: <%= link_to @person.company.companyname %> but that just outputs the company name inside a href tag but links to the current page. Thanks, Danny

    Read the article

  • sql select with exact outcome

    - by Shiro
    Asking a simple question, just want everyone have fun to solve it. I got 2 tables. 1. Student 2. Course Student +----+--------+ | id | name | +----+--------+ | 1 | User1 | | 2 | User2 | +----+--------+ Course +----+------------+------------+ | id | student_id | course_name| +----+------------+------------+ | 1 | 1 | English | | 2 | 1 | Chinese | | 3 | 2 | English | | 4 | 2 | Japanese | +----+------------+------------+ I would like to get the result all student, who have taken English and Chinese, NOT English or Chinese. Expected result: +----+------------+------------+ | id | student_id | course_name| +----+------------+------------+ | 1 | 1 | English | | 2 | 1 | Chinese | +----+------------+------------+ What we normally do is select * from student join course on (student.id = course.student_id) WHERE course_name = 'English' OR course_name = 'Chinese' but in this result I can get User2 record which is not my expected result. I want the record only display the User take the course English+Chinese only.

    Read the article

  • How I can make Recycle Bin for Database ?Application?

    - by Wael Dalloul
    Hi, I have database application, I want to allow the user to restore the deleted records from the database, like in windows we have Recycle bin for files I want to do the same thing but for database records, Assume that I have a lot of related tables that have a lot of fields. Edit: let's say that I have the following structures: Reports table RepName primary key ReportData Users table ID primary key Name UserReports table RepName primary key UserID primary key IsDeleted now if I put isdeleted field in UserReports table, the user can't add same record again if it marked as deleted, because the record is already and this will make duplication.

    Read the article

  • How to instert child entities in JDO (Google App Engine) ?

    - by Kerem Pekçabuk
    How do i add a record to a child entity in the example below ? For example i have a Employee Record which is name is "Sam". how do i add 2 street adress for sam ? Guess i have a The Parent entity is Employee import java.util.List; // ... @Persistent(mappedBy = "employee") private List contactInfoSets; The Child key is Adress import com.google.appengine.api.datastore.Key; // ... imports ... @PersistenceCapable public class ContactInfo { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private String streetAddress; // ... }

    Read the article

< Previous Page | 94 95 96 97 98 99 100 101 102 103 104 105  | Next Page >