Search Results

Search found 6988 results on 280 pages for 'if statement'.

Page 16/280 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Simple Select Statement on MySQL Database Hanging

    - by AlishahNovin
    I have a very simple sql select statement on a very large table, that is non-normalized. (Not my design at all, I'm just trying to optimize while simultaneously trying to convince the owners of a redesign) Basically, the statement is like this: SELECT FirstName, LastName, FullName, State FROM Activity Where (FirstName=@name OR LastName=@name OR FullName=@name) AND State=@state; Now, FirstName, LastName, FullName and State are all indexed as BTrees, but without prefix - the whole column is indexed. State column is a 2 letter state code. What I'm finding is this: When @name = 'John Smith', and @state = '%' the search is really fast and yields results immediately. When @name = 'John Smith', and @state = 'FL' the search takes 5 minutes (and usually this means the web service times out...) When I remove the FirstName and LastName comparisons, and only use the FullName and State, both cases above work very quickly. When I replace FirstName, LastName, FullName, and State searches, but use LIKE for each search, it works fast for @name='John Smith%' and @state='%', but slow for @name='John Smith%' and @state='FL' When I search against 'John Sm%' and @state='FL' the search finds results immediately When I search against 'John Smi%' and @state='FL' the search takes 5 minutes. Now, just to reiterate - the table is not normalized. The John Smith appears many many times, as do many other users, because there is no reference to some form of users/people table. I'm not sure how many times a single user may appear, but the table itself has 90 Million records. Again, not my design... What I'm wondering is - though there are many many problems with this design, what is causing this specific problem. My guess is that the index trees are just too large that it just takes a very long time traversing the them. (FirstName, LastName, FullName) Anyway, I appreciate anyone's help with this. Like I said, I'm working on convincing them of a redesign, but in the meantime, if I someone could help me figure out what the exact problem is, that'd be fantastic.

    Read the article

  • need help passing multiple variables from foreach loop to test in switch case statement

    - by Brad
    $list_of_groups = array("FACULTY","STAFF"); foreach ($list_of_groups as $i => $group) { $user_in_group = $adldap->user_ingroup($username,$group); print "<h2>Group: ".$group." user in group? ".$user_in_group."</h2>"; // if 1, means yes } Need to print run the appropriate function based on what returns true. There are user's that are members of both FACULTY and STAFF groups, so I want to check for those users and display the appropriate content for them. So if the user is both faculty and staff, then display this, if they are only of staff, display that, same for faculty, might not make sense, but I will write out some code "in theory" that will help you understand what I am trying to do switch(Get group membership of user) { case "FACULTY": print "Faculty group member"; break; case "STAFF": print "Staff group member"; break; case "FACULTY and STAFF": print "Member of both faculty and staff"; break; } I am unsure on how it will check if they are members of both groups and run that thru the case statement to display the appropriate message. The foreach look currently runs thru every group the user belongs to, prints out the ones from the $list_of_groups and the number 1 to the right of it, signifying they belong to it. The problem I have is trying to use that information to run thru the case statement, I am unsure of how to go about that. This is what it prints out for the user currently passed thru the foreach loop: Group: FACULTY user in group? 1 Group: STAFF user in group? 1 Any help is appreciated.

    Read the article

  • If statement with dataitems in markup

    - by Eric
    I am trying to write an if statement to decide whether or not to display a field. I'm using a listview. <telerik:RadListView ID="RadListView4" runat="server" ItemPlaceholderID="WitnessPlaceHolder" DataSourceID="SqlDataSource5"> <LayoutTemplate> <asp:PlaceHolder ID="WitnessPlaceHolder" runat="server" /> </LayoutTemplate> <ItemTemplate> <center> <fieldset style="float: left; width: 280px;"> <legend> <%# Eval("title").ToString()%> </legend> <table> <tr> <td align="center"> <%if (DataBinder.Eval(Container.DataItem,"field").Equals("C")) Response.Write(Eval("field"));%> </td> How can I write the above if statement in the markup?? What i have doesn't work.

    Read the article

  • UITabBarControllerDelegate compare value of viewController

    - by T9
    I have a tabBar with 4 tabs on it, and I want to perform some action when a specific tab is selected, so I have uncommented the UITabBarControllerDelegate in the xxAppDelegate.m I also wanted to see the value that was being sent logged in the console - in order to test my "if" statement. However this is where I got stumped. // Optional UITabBarControllerDelegate method - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { NSLog(@"%@", viewController); } The console dutifully logged any selected controller that had been selected, but in this particular format: <MyViewController: 0x3b12950> Now, I wasn't expecting the square brackets or the colon or the Hex. So my question is how do I format my IF statement? This is what I thought would work but I get an error mentioned further down. // Optional UITabBarControllerDelegate method - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { NSLog(@"%@", viewController); if (viewController == MyViewController) { //do something nice here … }; } ... The error is "Expected expression before 'MyViewController'" Anyone know how I should be doing this?

    Read the article

  • Iterate through main function in C?

    - by Mohit Deshpande
    Here is my main function: int main(int argc, char **argv) { LoadFile(); Node *temp; char *key; switch (GetUserInput()) { case 1: temp = malloc(sizeof(Node)); printf("\nEnter the key of the new node: "); scanf("%s", temp->key); printf("\nEnter the value of the new node: "); scanf("%s", temp->value); AddNode(temp); free(temp); break; case 2: key = malloc(sizeof(char *)); printf("Enter the key of the node you want to delete: "); scanf("%s", key); DeleteNode(key); free(key); break; case 3: PrintAll(); break; case 4: SaveFile(); break; case 5: return 0; break; default: printf("\nWrong choice!\n"); break; } return 0; } The only problem with it is that after any case statement breaks, the program just exits out. I understand why, but I don't know how to fix it. I want the program to repeat itself each time even after the case statements. Would I just say: main(argc, argv); before every break statement?

    Read the article

  • Noob question about a statement in a Java program

    - by happysoul
    I am beginner to java and was trying out this code puzzle from the book head first java which I solved as follows and got the output correct :D class DrumKit { boolean topHat=true; boolean snare=true; void playSnare() { System.out.println("bang bang ba-bang"); } void playTopHat() { System.out.println("ding ding da-ding"); } } public class DrumKitTestDriver { public static void main(String[] args) { DrumKit d =new DrumKit(); if(d.snare==true) { d.playSnare(); } d.playTopHat(); } } Output is :: bang bang ba-bang ding ding da-ding Now the problem is that in that code puzzle one code snippet is left that I did not include..it's as follows d.snare=false; Even though I did not write it , I got the output like the book. I am wondering why is there need for us to set it's value as false even when we know the code is gonna run without it too !?? I am wondering what the coder had in mind ..I mean what could be the possible future use and motive behind doing this ? I am sorry if it's a dumb question. I just wanna know why or why not to include that particular statement ? It's not like there's a loop or something that we need to come out of. Why is that statement there ?

    Read the article

  • MonoRail ActiveRecord - The UPDATE statement conflicted with the FOREIGN KEY SAME TABLE

    - by Justin
    Hey all, I'm new to MonoRail and ActiveRecord and have inherited an application that I need to modify. I have a Category table (Id, Name) and I'm adding a ParentId FK which references the Id in the same table so that you can have parent/child category relationships. I tried adding this to my Category model class: [Property] public int ParentId { get; set; } I also tried doing it this way: [BelongsTo("ParentId")] public Category Parent { get; set; } When I call a method to get all parent categories (they have a null ParentId), it works fine: public static Category[] GetParentCategories() { var criteria = DetachedCriteria.For<Core.Models.Category>(); return (FindAllByProperty("ParentId", null)); } However, when I call a method to get all child categories within a specific category, it errors out: public static Category[] GetChildCategories(int parentId) { var criteria = DetachedCriteria.For<Core.Models.Category>(); return (FindAllByProperty("ParentId", parentId)); } The error is: "The UPDATE statement conflicted with the FOREIGN KEY SAME TABLE constraint \"FK_Category_ParentId\". The conflict occurred in database \"UCampus\", table \"dbo.Category\", column 'Id'.\r\nThe statement has been terminated." I'm hard-coding in the parentId parameter as 1 and I'm 100% sure it exists as an id in the Category table so I don't know why it'd give this error. Also, I'm doing a select, not an update, so what is going on here?? Thanks for any input on this, Justin

    Read the article

  • Jquery if statement help

    - by mtwallet
    Hi. I want to know how to correctly write an if statement with jquery. I have a bunch of div's with an anchor in each that when clicked expands the the div's width using toggleClass. This works fine but I want to write an if statement that checks to see if the other div's have the same class applied, if so contract that div, then expand the next div (hope that makes sense), my code so far: HTML: <div class="content-block"> <h2>Title</h2> <p>Content...</p> <a class="expand" href="#">Expand View</a> </div> <div class="content-block"> <h2>Title</h2> <p>Content...</p> <a class="expand" href="#">Expand View</a> </div> <div class="content-block"> <h2>Title</h2> <p>Content...</p> <a class="expand" href="#">Expand View</a> </div> <div class="content-block"> <h2>Title</h2> <p>Content...</p> <a class="expand" href="#">Expand View</a> </div> JQUERY: $(document).ready(function(){ $('a.expand').click(function(){ $(this).parent('.content-block').toggleClass('wide'); }); });

    Read the article

  • SQL Is it possible to setup a column that will contain a value dependent on another column?

    - by Wesley
    I have a table (A) that lists all bundles created off a machine in a day. It lists the date created and the weight of the bundle. I have an ID column, a date column, and a weight column. I also have a table (B) that holds the details related to that machine for the day. In that table (B), I want a column that lists a sum of weights from the other table (A) that the dates match on. So if the machine runs 30 bundles in a day, I'll have 30 rows in table (A) all dated the same day. In table (B) I'll have 1 row detailing other information about the machine for the day plus the column that holds the total bundle weight created for the day. Is there a way to make the total column in table (B) automatically adjust itself whenever a row is added to table (A)? Is this possible to do in the table schema itself rather than in an SQL statement each time a bundle is added? If it's not, what sort of SQL statement do I need? Wes

    Read the article

  • If Then Else Statement Condition Being Ignored?

    - by Matma
    I think im going mad but can some show me what im missing, it must be some stupidly simple i just cant see the wood for the trees. BOTH side of this if then else statement are being executed? Ive tried commenting out the true side and moving the condition to a seperate variable with the same result. However if i explicitly set the condition to 1=0 or 1=1 then the if then statement is operating as i would expect. i.e. only executing one side of the equation... The only time ive seen this sort of thing is when the compiler has crashed and is no longer compiling (without visible indication that its not) but ive restarted studio with the same results, ive cleaned the solution, built and rebuilt with no change? please show me the stupid mistake im making using vs2005 if it matters. Dim dset As DataSet = New DataSet If (CboCustomers.SelectedValue IsNot Nothing) AndAlso (CboCustomers.SelectedValue <> "") Then Dim Sql As String = "Select sal.SalesOrderNo As SalesOrder,cus.CustomerName,has.SerialNo, convert(varchar,sal.Dateofpurchase,103) as Date from [dbo].[Customer_Table] as cus " & _ " inner join [dbo].[Hasp_table] as has on has.CustomerID=cus.CustomerTag " & _ " inner join [dbo].[salesorder_table] as sal On sal.Hasp_ID =has.Hasp_ID Where cus.CustomerTag = '" & CboCustomers.SelectedValue.ToString & "'" Dim dap As SqlDataAdapter = New SqlDataAdapter(Sql, FormConnection) dap.Fill(dset, "dbo.Customer_Table") DGCustomer.DataSource = dset.Tables("dbo.Customer_Table") Else Dim erm As String = "wtf" End If

    Read the article

  • e4x statement conflicts with local variable?

    - by semen
    Hi, griends! Somewhere in code i have decalred variable: [Bindable] var nameWin:String = ""; after this i have an e4x statement podContent.xml_m = xml_m.item.(nameWin=="necessary name"); that should compare item's namewin with "necessary name" and return only items whose nameWin matches with "necessary name". xml_m.item: <item> <nameWin>necessary name</nameWin> <nameCol>??????-?????? ???????????</nameCol> <date>2009 ???</date> <summa>259267.7976</summa> </item> <item> <nameWin>unnecessary name</nameWin> <nameCol>??????-?????? ???????????</nameCol> <date>2010 ??????</date> <summa>104.3254</summa> </item> <item> <nameWin>necessary name</nameWin> <nameCol>??????-?????? ???????????</nameCol> <date>2010 ???</date> <summa>21.5174</summa> </item> if I use in statement xml-child distinct of nameWin (summa, e. g.), it works good. But with nameWin, e4x compares local variable nameWin (which not interested for me at all at this time) with "necessary name" instead of compare item's nameWin with "necessary name". Any ideas? Versions of libraries can be reason?

    Read the article

  • Modify MySQL INSERT statement to omit the insertion of certain rows

    - by dave
    I'm trying to expand a little on a statement that I received help with last week. As you can see, I'm setting up a temporary table and inserting rows of student data from a recently administered test for a few dozen schools. When the rows are inserted, they are sorted by the score (totpct_stu, high to low) and the row_number is added, with 1 representing the highest score, etc. I've learned that there were some problems at school #9999 in SMITH's class (every student made a perfect score and they were the only students in the district to do so). So, I do not want to import SMITH's class. As you can see, I DELETED SMITH's class, but this messed up the row numbering for the remainder of student at the school (e.g., high score row_number is now 20, not 1). How can I modify the INSERT statement so as to not insert this class? Thanks! DROP TEMPORARY TABLE IF EXISTS avgpct ; CREATE TEMPORARY TABLE avgpct_1 ( sch_code VARCHAR(3), schabbrev VARCHAR(75), teachername VARCHAR(75), totpct_stu DECIMAL(5,1), row_number SMALLINT, dummy VARCHAR(75) ); -- ---------------------------------------- INSERT INTO avgpct SELECT sch_code , schabbrev , teachername , totpct_stu , @num := IF( @GROUP = schabbrev, @num + 1, 1 ) AS row_number , @GROUP := schabbrev AS dummy FROM sci_rpt WHERE grade = '05' AND totpct_stu >= 1 -- has a valid score ORDER BY sch_code, totpct_stu DESC ; -- --------------------------------------- -- select * from avgpct ; -- --------------------------------------- DELETE FROM avgpct_1 WHERE sch_code = '9999' AND teachername = 'SMITH' ;

    Read the article

  • sqlite3 crashes for second insert statement

    - by Ayaz Alavi
    My App is crashing on statement (sqlite3_step(insertAlert) == SQLITE_DONE) when executed for i = 1. Can anybody tell me why it is crashing? sqlite3_stmt *insertAlert; textmeAppDelegate *textme = (textmeAppDelegate *)[[UIApplication sharedApplication] delegate]; NSString *insert = @"INSERT INTO alerts (alert_id, email_address, messege_text, when_to_send, how_often_send, recipient_phone_number) VALUES(?, ?, ?, ?, ?, ?)"; if(sqlite3_prepare_v2(textme.dbConn, [insert UTF8String], -1, &insertAlert, NULL) == SQLITE_OK) { NSDictionary *tmpDictionary; NSString *alertId; for(int i=0; i<[keys count]; i++) { alertId = [NSString stringWithFormat:@"%@", [keys objectAtIndex:i]]; tmpDictionary = [NSDictionary dictionaryWithDictionary:[dictionary2 objectForKey:alertId]]; sqlite3_bind_text(insertAlert, 1, [NSString stringWithFormat:@"%@", [tmpDictionary objectForKey:@"alert_id"]], -1, SQLITE_TRANSIENT); sqlite3_bind_text(insertAlert, 2, [NSString stringWithFormat:@"%@", [tmpDictionary objectForKey:@"email_address"]], -1, SQLITE_TRANSIENT); sqlite3_bind_text(insertAlert, 3, [NSString stringWithFormat:@"%@", [tmpDictionary objectForKey:@"messege_text"]], -1, SQLITE_TRANSIENT); sqlite3_bind_text(insertAlert, 4, [NSString stringWithFormat:@"%@", [tmpDictionary objectForKey:@"when_to_send"]], -1, SQLITE_TRANSIENT); sqlite3_bind_text(insertAlert, 5, [NSString stringWithFormat:@"%@", [tmpDictionary objectForKey:@"how_often_send"]], -1, SQLITE_TRANSIENT); sqlite3_bind_text(insertAlert, 6, [NSString stringWithFormat:@"%@", [tmpDictionary objectForKey:@"recipient_phone_number"]], -1, SQLITE_TRANSIENT); if (sqlite3_step(insertAlert) == SQLITE_DONE) { sqlite3_finalize(insertAlert); sqlite3_clear_bindings(insertAlert); } else { NSAssert1(0, @"Error while creating add statement. '%s'", sqlite3_errmsg(textme.dbConn)); //[textme showError:@"Device Error" errMsg:sqlite3_errmsg(textme.dbConn)]; return FALSE; } } sqlite3_finalize(insertAlert); }

    Read the article

  • Avoid MySQL multi-results from SP with Execute

    - by hhyhbpen
    Hi, i have an SP like BEGIN DECLARE ... CREATE TEMPORARY TABLE tmptbl_found (...); PREPARE find FROM" INSERT INTO tmptbl_found (SELECT userid FROM ( SELECT userid FROM Soul WHERE .?.?. ORDER BY .?.?. ) AS left_tbl LEFT JOIN Contact ON userid = Contact.userid WHERE Contact.userid IS NULL LIMIT ?) "; DECLARE iter CURSOR FOR SELECT userid, ... FROM Soul ...; ... l:LOOP FETCH iter INTO u_id, ...; ... EXECUTE find USING ...,. . .,u_id,...; ... END LOOP; ... END// and it gives multi-results. Besides it's inconvenient, if i get all this multi-results (which i really don't need at all), about 5 (limit's param) for each of the hundreds of thousands of records in Soul, i'm afraid it will take all my memory (and all in vain). Also, i noticed, if i do prepare from an empty string, it still has multi-results... At least how to get rid of them in the execute statement? And i would like to have a recipe to avoid ANY output from SP, for any possible statement (i also have a lot of "update ..."s and "select ... into "s inside, if they can produce multi's). Tnx for any help...

    Read the article

  • sql statement supposed to have 2 distinct rows, but only 1 is returned

    - by jello
    I have an sql statement that is supposed to return 2 rows. the first with psychological_id = 1, and the second, psychological_id = 2. here is the sql statement select * from psychological where patient_id = 12 and symptom = 'delire'; But with this code, with which I populate an array list with what is supposed to be 2 different rows, two rows exist, but with the same values: the second row. OneSymptomClass oneSymp = new OneSymptomClass(); ArrayList oneSympAll = new ArrayList(); string connStrArrayList = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\PatientMonitoringDatabase.mdf; " + "Initial Catalog=PatientMonitoringDatabase; " + "Integrated Security=True"; string queryStrArrayList = "select * from psychological where patient_id = " + patientID.patient_id + " and symptom = '" + SymptomComboBoxes[tag].SelectedItem + "';"; using (var conn = new SqlConnection(connStrArrayList)) using (var cmd = new SqlCommand(queryStrArrayList, conn)) { conn.Open(); using (SqlDataReader rdr = cmd.ExecuteReader()) { while (rdr.Read()) { oneSymp.psychological_id = Convert.ToInt32(rdr["psychological_id"]); oneSymp.patient_history_date_psy = (DateTime)rdr["patient_history_date_psy"]; oneSymp.strength = Convert.ToInt32(rdr["strength"]); oneSymp.psy_start_date = (DateTime)rdr["psy_start_date"]; oneSymp.psy_end_date = (DateTime)rdr["psy_end_date"]; oneSympAll.Add(oneSymp); } } conn.Close(); } OneSymptomClass testSymp = oneSympAll[0] as OneSymptomClass; MessageBox.Show(testSymp.psychological_id.ToString()); the message box outputs "2", while it's supposed to output "1". anyone got an idea what's going on?

    Read the article

  • SQL Server INSERT ... SELECT Statement won't parse

    - by Jim Barnett
    I am getting the following error message with SQL Server 2005 Msg 120, Level 15, State 1, Procedure usp_AttributeActivitiesForDateRange, Line 18 The select list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of INSERT columns. I have copy and pasted the select list and insert list into excel and verified there are the same number of items in each list. Both tables an additional primary key field with is not listed in either the insert statement or select list. I am not sure if that is relevant, but suspicious it may be. Here is the source for my stored procedure: CREATE PROCEDURE [dbo].[usp_AttributeActivitiesForDateRange] ( @dtmFrom DATETIME, @dtmTo DATETIME ) AS BEGIN SET NOCOUNT ON; DECLARE @dtmToWithTime DATETIME SET @dtmToWithTime = DATEADD(hh, 23, DATEADD(mi, 59, DATEADD(s, 59, @dtmTo))); -- Get uncontested DC activities INSERT INTO AttributedDoubleClickActivities ([Time], [User-ID], [IP], [Advertiser-ID], [Buy-ID], [Ad-ID], [Ad-Jumpto], [Creative-ID], [Creative-Version], [Creative-Size-ID], [Site-ID], [Page-ID], [Country-ID], [State Province], [Areacode], [OS-ID], [Domain-ID], [Keyword], [Local-User-ID], [Activity-Type], [Activity-Sub-Type], [Quantity], [Revenue], [Transaction-ID], [Other-Data], Ordinal, [Click-Time], [Event-ID]) SELECT [Time], [User-ID], [IP], [Advertiser-ID], [Buy-ID], [Ad-ID], [Ad-Jumpto], [Creative-ID], [Creative-Version], [Creative-Size-ID], [Site-ID], [Page-ID], [Country-ID], [State Province], [Areacode], [OS-ID], [Domain-ID], [Keyword], [Local-User-ID] [Activity-Type], [Activity-Sub-Type], [Quantity], [Revenue], [Transaction-ID], [Other-Data], REPLACE(Ordinal, '?', '') AS Ordinal, [Click-Time], [Event-ID] FROM Activity_Reports WHERE [Time] BETWEEN @dtmFrom AND @dtmTo AND REPLACE(Ordinal, '?', '') IN (SELECT REPLACE(Ordinal, '?', '') FROM Activity_Reports WHERE [Time] BETWEEN @dtmFrom AND @dtmTo EXCEPT SELECT CONVERT(VARCHAR, TripID) FROM VisualSciencesActivities WHERE [Time] BETWEEN @dtmFrom AND @dtmTo); END GO

    Read the article

  • Are Dynamic Prepared Statements Bad? (with php + mysqli)

    - by John
    I like the flexibility of Dynamic SQL and I like the security + improved performance of Prepared Statements. So what I really want is Dynamic Prepared Statements, which is troublesome to make because bind_param and bind_result accept "fixed" number of arguments. So I made use of an eval() statement to get around this problem. But I get the feeling this is a bad idea. Here's example code of what I mean // array of WHERE conditions $param = array('customer_id'=>1, 'qty'=>'2'); $stmt = $mysqli->stmt_init(); $types = ''; $bindParam = array(); $where = ''; $count = 0; // build the dynamic sql and param bind conditions foreach($param as $key=>$val) { $types .= 'i'; $bindParam[] = '$p'.$count.'=$param["'.$key.'"]'; $where .= "$key = ? AND "; $count++; } // prepare the query -- SELECT * FROM t1 WHERE customer_id = ? AND qty = ? $sql = "SELECT * FROM t1 WHERE ".substr($where, 0, strlen($where)-4); $stmt->prepare($sql); // assemble the bind_param command $command = '$stmt->bind_param($types, '.implode(', ', $bindParam).');'; // evaluate the command -- $stmt->bind_param($types,$p0=$param["customer_id"],$p1=$param["qty"]); eval($command); Is that last eval() statement a bad idea? I tried to avoid code injection by encapsulating values behind the variable name $param. Does anyone have an opinion or other suggestions? Are there issues I need to be aware of?

    Read the article

  • MySQL " identify storage engine statement"

    - by sammysmall
    This IS NOT a Homework question! While building my current student database project I realized that I may want to identify comprehensive information about a database design in the future. More-so if I am fortunate enough to get a job in this field and were handed a database project how could I break down certain elements for identification... In all of my previous designs I have been using MySQL Community Server (GPL) 5.1.42, I thought (duh) that I was using the MyISAM based on most of my text-book instruction and MySQL 5.0 Reference Manual :: 13 Storage Engines :: 13.1 The MyISAM Storage Engine I determined that this was in fact incorrect for this version and the use of "SHOW ENGINES" at the console... No problem, figured out why they have "versions" the need to pay attention to what version is being used, and the need for a means to determine what I am about to mess up "if" I do not pay attention to detail... Q1. Specifically what statement will identify the version used by someone elses initial database creation? (since I created my own databases I know what version I used) Q2. Specifically what statement will identify the storage engine that the developer used when creating the database. (I specified a particular database in my collection then tried SHOW Engine, did not work, then tried to just get the metadata from one table in that database: mysql SELECT duck_cust, table_type, engine - FROM INFORMATION_SCHEMA.tables - WHERE table_schema = 'tp' - ORDER BY table_type ASC, table_name DESC; as this was not really what I wanted (and did not work) I am looking for some direction from the pros... Q3. (If you really have the inclination to continue helping) If I were to access a database from an earlier/later "version" are there backward/forward compatibility issues for maintaining/updating data between versions? Please and Thank you in advance for your time and efforts! sammysmall

    Read the article

  • Python Loop for mysql statement

    - by user552974
    Hi, I have a project that i need to compile number of cities in each state and make an insert statement for mysql database. I think the easiest way to do it is via python but since i m a complete noob i would like to reach out all the python gurus here. Here is what the input looks like. Example below is for Florida. cities = ['Boca Raton', 'Boynton Beach', 'Bradenton', 'Cape Coral', 'Deltona'] and this what the output should be. INSERT INTO `oc_locations` (`idLocation`, `name`, `idLocationParent`, `friendlyName`) VALUES (1, 'Florida', 0, 'Florida'), (2, 'Boca Raton', 1, 'Boca Raton'), (3, 'Boynton Beach', 1, 'Boynton Beach'), (4, 'Bradenton', 1, 'Bradenton'), (5, 'Cape Coral', 1, 'Cape Coral'), (6, 'Deltona', 1, 'Deltona'), If you look at carefully the "idLocationParent" for "Florida" value is "0" so which means it is a top level value. This will be done for 50 states so ability to plug the state name into the mysql statement would be icing on the cake if there is a easy way to do it. Also alphabetical order and auto increment for the idLocation would be great. Here is an example of what i m trying to achieve concatenation is the part i need to figure out. for city in cities: print (1, 'city', 0, 'city'), city

    Read the article

  • Java if statement strings and more

    - by user1820578
    I have decided to try and learn a little in java tonight and i have just been trying some stuff with things i have learned. My question is in an if statement how to i make two stings to be true. Here is what i have so far. if ("male".equals(gender)) && ("brendan".equals(name)) the problem i am pretty sure is the && but i am not sure. also my other question is with gender it should either be male or female. I want to have if statement with male and another for female. For this do i just do another if. For eg if ("male".equals(gender)) && ("brendan".equals(name)) { System.out.println("blah blah"); } else { System.out.println(" wrong wrong"); } if ("female".equals(gender)) { System.out.println("blah blah2"); } else { System.out.println(" wrong wrong 2"); } hope that makes sense. Any help would be great.

    Read the article

  • No operations allowed after statement closed issue

    - by Washu
    I have the next methods in my singleton to execute the JDBC connections public void openDB() throws ClassNotFoundException, IllegalAccessException, InstantiationException, SQLException { Class.forName("com.mysql.jdbc.Driver").newInstance(); String url = "jdbc:mysql://localhost/mbpe_peru";//mydb conn = DriverManager.getConnection(url, "root", "admin"); st = conn.createStatement(); } public void sendQuery(String query) throws SQLException { st.executeUpdate(query); } public void closeDB() throws SQLException { st.close(); conn.close(); } And I'm having a problem in a void where i have to call this twice. private void jButton1ActionPerformed(ActionEvent evt) { Main.getInstance().openDB(); Main.getInstance().sendQuery("call insertEntry('"+EntryID()+"','"+SupplierID()+"');"); Main.getInstance().closeDB(); Main.getInstance().openDB(); for(int i=0;i<dataBox.length;i++){ Main.getInstance().sendQuery("call insertCount('"+EntryID()+"','"+SupplierID()+"','"+BoxID()+"'); Main.getInstance().closeDB(); } } I have already tried to keep the connection open and send the 2 querys and after that closed and it didnt work... The only way it worked was to not use the methods, declare the commands for the connection and use different variables for the connection and the statement. I thought that if i close the Connecion and the Statement I could use the variable once again since is a method but I'm not able to. Is there any way to solve this using my methods for the JDBC connection?

    Read the article

  • Nested IF statements in Excel [Over the 7 allowed limit]

    - by Alks
    hey guys, i am trying to create a spreadsheet which automagically gives a grade to a student based on their marks they got. I've apparently hit excels nested IF statement limit which is 7. here's my if statement: =IF(O5>0.895,"A+",IF(O5>0.845,"A",IF(O5>0.795,"A-",IF(O5>0.745,"B+",IF(O5>0.695,"B",IF(O5>0.645,"B-",IF(O5>0.595,"C+",IF(O5>0.545,"C","D")))))))) I was reading online that I could create a VBA script and assign it that, but I dont know anything about VBA....so if someone could help me write a VBA for this, would be awesome. Its still mising the C- grade and anything lower should be awarded a D mark. This is the grading scheme I am trying to create...: A+ 89.500 - 100.000 Pass with Distinction A 84.500 - 89.490 Pass with Distinction A- 79.500 - 84.490 Pass with Distinction B+ 74.500 - 79.490 Pass with Merit B 69.500 - 74.490 Pass with Merit B- 64.500 - 69.490 Pass with Merit C+ 59.500 - 64.490 Pass C 54.500 - 59.490 Pass C- 49.500 - 54.490 Pass D 0.000 - 49.490 Specified Fail I wouldn't mind going down the VBA route, however my understanding of VB language is absolutely minimal (don't like it)...if this gets too tedious, I was thinking to create a small php/mysql application instead. Cheers :)

    Read the article

  • Should '#include' and 'using' statements be repeated in both header and implementation files (C++)?

    - by Dr. Monkey
    I'm fairly new to C++, but my understanding is that a #include statement will essentially just dump the contents of the #included file into the location of that statement. This means that if I have a number of '#include' and 'using' statements in my header file, my implementation file can just #include the header file, and the compiler won't mind if I don't repeat the other statements. What about people though? My main concern is that if I don't repeat the '#include', 'using', and also 'typedef' (now that I think of it) statements, it takes that information away from the file in which it's used, which could lead to confusion. I am just working on small projects at the moment where it won't really cause any issues, but I can imagine that in larger projects with more people working on them it could become a significant issue. An example follows: //Unit.h #include <string> #include <ostream> #include "StringSet.h" using std::string; using std::ostream; class Unit { public: //public members private: //private members //unrelated side-question: should private members //even be included in the header file? } ; //Unit.cpp #include "Unit.h" //The following are all redundant from a compiler perspective: #include <string> #include <ostream> #include "StringSet.h" using std::string; using std::ostream; //implementation goes here

    Read the article

  • iPhone producing strange results on 'if' statement

    - by Rob
    I have a UIPicker where the user inputs a specified time (i.e. 13:00, 13:01, 13:02, etc.) - which determines their score. Once they hit the button an alert comes up with the score that is determined through this 'if-else' statement. Everything seems to work great MOST of the time - but I am getting some erratic behavior. This is the code: //Gets my value from the UIPicker and then converts it into a format that can be used in the 'if' statement. NSInteger runRow = [runTimePicker selectedRowInComponent:2]; NSString *runSelected = [runTimePickerData objectAtIndex:runRow]; NSString *runSelectedFixed = [runSelected stringByReplacingOccurrencesOfString:@":" withString:@"."]; //The actual 'if' statment. if ([runSelectedFixed floatValue] <= 13.00) { runScore = 100; } else if ([runSelectedFixed floatValue] <= 13.06) { runScore = 99; } else if ([runSelectedFixed floatValue] <= 13.12) { runScore = 97; } else if ([runSelectedFixed floatValue] <= 13.18) { runScore = 96; } else if ([runSelectedFixed floatValue] <= 13.24) { runScore = 94; } else if ([runSelectedFixed floatValue] <= 13.30) { runScore = 93; } else if ([runSelectedFixed floatValue] <= 13.36) { runScore = 92; } else if ([runSelectedFixed floatValue] <= 13.42) { runScore = 90; } else if ([runSelectedFixed floatValue] <= 13.48) { runScore = 89; } else if ([runSelectedFixed floatValue] <= 13.54) { runScore = 88; } Now, when I test the program, I will get the expected result when I choose '13:00' which is '100'. I also get the expected result of '99' when I choose all of the times between '13:01 and 13:05'. BUT, when I choose '13:06' it gives me a score of '97'. I also get a score of '97' on '13:07 through 13:12' - which is the desired result. Why would I get a '97' right on '13:12' but not get a '99' right on '13:06'???? Could this be a memory leak or something???

    Read the article

  • Else statement crashes when i enter a letter for a cin << int value

    - by TimothyTech
    Alright, i have a question, i veered away from using strings for selection so now i use an integer.when the user enters a number then the game progresses. if they enter a wrong character it SHOULD give the else statement, however if i enter a letter or character the system goes into an endless loop effect then crashes. is there a way to give the else statement even if the user defies the variable's type. // action variable; int c_action: if (c_action == 1){ // enemy attack and user attack with added effect buffer. /////////////////////////////////////////////////////// u_attack = userAttack(userAtk, weapons); enemyHP = enemyHP - u_attack; cout << " charging at the enemy you do " << u_attack << "damage" << endl; e_attack = enemyAttack(enemyAtk); userHP = userHP - e_attack; cout << "however he lashes back causing you to have " << userHP << "health left " << endl << endl << endl << endl; //end of ATTACK ACTION }else{ cout << "invalid actions" << endl; goto ACTIONS; }

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >