// This cpp file is a generated trace that consists of the following "sections": // // - Connection parameters for mysql_real_connect: // - Helper functions // - The actual trace (marked by ****** Begin/End of trace ******) // - Functions to create and populate the necessary tables // - A dump of the current mysql variables // This cpp file should be compilable with: // gcc -g -I ${MYSQL_DIR}/include ${THIS_FILE} ${MYSQL_DIR}/lib/libmysqlclient.a -lm -lz -lstdc++ // To replay the trace you should have a database "baan", or you can change the // DB_NAME variable below. // You should also have two users: bsp/baan123, who has SELECT, INSERT, UPDATE, DELETE // privileges on all objects and baan/baan123 (the owner), who has ALL PRIVILEGES. // You may choose to use other users/passwords by changing the USER_*/OWNER_* // variables below. // You can connect to MySQL through TCP/IP by setting the HOST_NAME variable, or // you can use sockets by setting HOST_NAME to NULL and setting the right UNIX_SOCKET. // // The trace replays successfully if the program silently terminates with exit status 0. #include #include #include #include #include #include #include #include // Connection parameters const char *MYSQL_CMD = "mysql"; // Used for table creation const char *HOST_NAME = NULL; const char *USER_NAME = "bsp"; const char *USER_PWD = "bsp"; const char *DB_NAME = "baan"; const char *UNIX_SOCKET = "/var/lib/mysql/mysql.sock"; // For ddl statements we use a different user/pwd const char *OWNER_NAME = "baan"; const char *OWNER_PWD = "baan"; // use "#define M_EXPECT_EQUALS (void)" to disable data validation typedef enum { STR, SESS, STMT } ; #define M_EXPECT_EQUALS(X,Y,T,V) if ( X==Y ); else { \ cout << "!!! Error (" << __LINE__ << "): " << endl \ << " Expected value:" << X << endl \ << " Returned value:" << Y << endl; \ switch (T) { \ case STR : cout << " error: " << (const char *)V << endl; break;\ case SESS: cout << " mysql error: " << mysql_error((MYSQL*)V) << endl; break;\ case STMT: cout << " mysql error: " << mysql_stmt_error((MYSQL_STMT*)V) << endl; break;\ } \ assert( 0 ); \ } \ #include "mysql.h" using namespace std; const char *enum_str[7] = {"Nul","Int","Flt","Dbl","Str","Raw","Dtm"}; class Value { public: typedef enum { Nul , Int , Flt , Dbl , Str , Raw , Dtm } Type; Value( string S, Type T ) { _str = S; _type = T; } int Equals( const Value &V ) const { return _type == V._type && _str == V._str; } void toStream( ostream& s ) const { s << "[" << enum_str[_type] << "]\"" << _str << "\""; } private: string _str; Type _type; }; ostream& operator<< (ostream& s,const Value& v) { v.toStream(s); return s; } class ValueList { public: ValueList operator + (const ValueList& other) const { ValueList newList; list::const_iterator i; for ( i = this->_vals.begin(); i != this->_vals.end(); i++ ) newList._vals.push_back(*i); for ( i = other._vals.begin(); i != other._vals.end(); i++ ) newList._vals.push_back(*i); return newList; } void operator += (const ValueList& other) { list::const_iterator i; for ( i = other._vals.begin(); i != other._vals.end(); i++ ) _vals.push_back(*i); } int operator == ( const ValueList& Other ) const { list::const_iterator i1 = _vals.begin(); list::const_iterator i2 = Other._vals.begin(); while ( i1 != _vals.end() && i2 != Other._vals.end() && i1->Equals(*i2) ) i1++, i2++; return i1 == _vals.end() && i2 == Other._vals.end(); } void toStream( ostream &s ) const { list::const_iterator i; for ( i = _vals.begin(); i != _vals.end(); i++ ) { if ( i != _vals.begin() ) s << ","; s << *i; } } protected: list _vals; }; ostream& operator<< (ostream &s,const ValueList&vl) { vl.toStream(s); return s; } class Null : public ValueList { // The NULL value public: Null(void) { _vals.push_back(Value("",Value::Nul)); } }; class I : public ValueList { // An integer value public: I(int I) { ostringstream s; s << I; _vals.push_back(Value(s.str(),Value::Int)); } }; class F : public ValueList { // A float value public: F(double D) { char str[40]; sprintf(str,"%.7g",D); _vals.push_back(Value(string(str),Value::Flt)); } }; class D : public ValueList { // A double value public: D(double D) { char str[40]; sprintf(str,"%.15lg",D); _vals.push_back(Value(string(str),Value::Dbl)); } }; class S : public ValueList { // A string value public: S(string S) { _vals.push_back(Value(S,Value::Str)); } S(const char *S, int len) { int i; string s; for ( i=0; iis_null ) { l += Null(); } else switch ( mysql_bind->buffer_type ) { case MYSQL_TYPE_LONG: l += I(*((int*)(mysql_bind->buffer))); break; case MYSQL_TYPE_FLOAT: l += F(*((float*)(mysql_bind->buffer))); break; case MYSQL_TYPE_DOUBLE: l += D(*((double*)(mysql_bind->buffer))); break; case MYSQL_TYPE_VAR_STRING: l += S((char*)mysql_bind->buffer,*mysql_bind->length); break; case MYSQL_TYPE_DATE: case MYSQL_TYPE_DATETIME: { MYSQL_TIME *t = (MYSQL_TIME*)mysql_bind->buffer; l += T(t->year,t->month,t->day,t->hour,t->minute,t->second); } break; default: assert( 0 ); // Error or type to be implemented } } return l; } void create_tables(void); // Global variables const char *m_text; int m_ret; int m_count; int m_err; MYSQL_RES *m_result; MYSQL_ROW m_row; ValueList m_expect; const unsigned long select_cursor = CURSOR_TYPE_READ_ONLY; const unsigned long update_cursor = CURSOR_TYPE_FOR_UPDATE; const unsigned long no_cursor = CURSOR_TYPE_NO_CURSOR; // Helper functions void set_bind_attrs( MYSQL_BIND *mysql_bind, enum_field_types ext_type, void *buf, int bufsz, unsigned long *act_len, my_bool *is_null ) { mysql_bind->buffer_type = ext_type; mysql_bind->buffer = buf; mysql_bind->length = act_len; mysql_bind->is_null = is_null; mysql_bind->buffer_length = bufsz; } void bind_time(void *ptr,int ye,int mo,int da,int ho,int mi,int se) { MYSQL_TIME t = {ye,mo,da,ho,mi,se}; memcpy(ptr,&t,sizeof(t)); } int main(void) { // Create the tables needed to run this trace create_tables(); // ****** Begin of trace ****** MYSQL *sess_1; sess_1 = mysql_init( NULL ); assert(sess_1); mysql_real_connect(sess_1, HOST_NAME, USER_NAME, USER_PWD, DB_NAME, 0, UNIX_SOCKET, 0); mysql_autocommit(sess_1, 0); mysql_query(sess_1, "SET SESSION sql_mode=ERROR_FOR_DIVISION_BY_ZERO"); mysql_query(sess_1, "SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED"); MYSQL_STMT *stmt_1; stmt_1 = mysql_stmt_init(sess_1); m_ret = mysql_stmt_attr_set(stmt_1,STMT_ATTR_CURSOR_TYPE,(const void *) &select_cursor); M_EXPECT_EQUALS(0,m_ret,STMT,stmt_1); m_text = "SELECT a0.t_item,a0.t_seak,a0.t_cuqp,a0.t_cupp,a0.t_cpgp,a0.t_csgp,a0.t_ccur,a0.t_prip,a0.t_cvat,a0.t_otbp,a0.t_buyr,a0.t_edco,a0.t_mlco,a0.t_rtdp,a0.t_rtdm,a0.t_rtqp,a0.t_rtqm,a0.t_acci,a0.t_mmnf,a0.t_cims,a0.t_cofc,a0.t_cwar,a0.t_retw,a0.t_vryn,a0.t_suti,a0.t_sutu,a0.t_qual,a0.t_hstq,a0.t_hstd,a0.t_casl,a0.t_txtp,90,a1.t_dsca,a1.t_kitm,b0.t_nama,a2.t_nama,a3.t_dsca,a4.t_dsca,a5.t_dsca,a6.t_dsca,a7.t_dsca,a8.t_dsca,a7.t_cwar,a7.t_cwar,a1.t_item,a1.t_kitm,a1.t_citg,a1.t_itmt,a1.t_dsca,a1.t_dscb,a1.t_dscc,a1.t_dscd,a1.t_seak,a1.t_seab,a1.t_uset,a1.t_cuni,a1.t_cwun,a1.t_wght,a1.t_ctyp,a1.t_ltct,a1.t_csel,a1.t_csig,a1.t_ctyo,a1.t_cpcl,a1.t_cood,a1.t_eitm,a1.t_umer,a1.t_cpln,a1.t_ccde,a1.t_cmnf,a1.t_cean,a1.t_cont,a1.t_cntr,a1.t_cprj,a1.t_repl,a1.t_cpva,a1.t_dfit,a1.t_stoi,a1.t_cpcp,a1.t_unef,a1.t_ichg,a1.t_uefs,a1.t_seri,a1.t_styp,a1.t_psiu,a1.t_efco,a1.t_indt,a1.t_chma,a1.t_edco,a1.t_mcoa,a1.t_opts,a1.t_txta,90,a9.t_otbp FROM ((((((((( ttdipu001090 AS a0 LEFT JOIN ttccom001090 AS a2 ON a2.t_emno = a0.t_buyr) LEFT JOIN ttcmcs002090 AS a3 ON a3.t_ccur = a0.t_ccur) LEFT JOIN ttcmcs037090 AS a4 ON a4.t_cvat = a0.t_cvat) LEFT JOIN ttcmcs024090 AS a5 ON a5.t_cprg = a0.t_cpgp) LEFT JOIN ttcmcs044090 AS a6 ON a6.t_csgp = a0.t_csgp) LEFT JOIN ttdpur012090 AS a7 ON a7.t_cofc = a0.t_cofc) LEFT JOIN ttcmcs003090 AS a8 ON a8.t_cwar = a0.t_cwar) LEFT JOIN ttccom120090 AS a9 ON a9.t_otbp = a0.t_otbp) LEFT JOIN ttccom100090 AS b0 ON b0.t_bpid = a9.t_otbp),ttcibd001090 a1 WHERE a1.t_item = a0.t_item AND (a0.t_item >= ?) AND a0.t_item = a1.t_item ORDER BY 1"; m_ret = mysql_stmt_prepare(stmt_1,m_text,strlen(m_text)); M_EXPECT_EQUALS(0,m_ret,STMT,stmt_1); m_count = mysql_stmt_param_count(stmt_1); M_EXPECT_EQUALS( 1, m_count, 0, NULL ); MYSQL_BIND *param_1 = (MYSQL_BIND *)calloc(1, sizeof(MYSQL_BIND)); MYSQL_BIND *output_1 = (MYSQL_BIND *)calloc(94, sizeof(MYSQL_BIND)); char data_1[47]; unsigned long len_1; my_bool null_1; set_bind_attrs(¶m_1[0],MYSQL_TYPE_VAR_STRING,&data_1,47,&len_1,&null_1); char data_2[47]; unsigned long len_2; my_bool null_2; set_bind_attrs(&output_1[0],MYSQL_TYPE_VAR_STRING,&data_2,47,&len_2,&null_2); char data_3[16]; unsigned long len_3; my_bool null_3; set_bind_attrs(&output_1[1],MYSQL_TYPE_VAR_STRING,&data_3,16,&len_3,&null_3); char data_4[3]; unsigned long len_4; my_bool null_4; set_bind_attrs(&output_1[2],MYSQL_TYPE_VAR_STRING,&data_4,3,&len_4,&null_4); char data_5[3]; unsigned long len_5; my_bool null_5; set_bind_attrs(&output_1[3],MYSQL_TYPE_VAR_STRING,&data_5,3,&len_5,&null_5); char data_6[6]; unsigned long len_6; my_bool null_6; set_bind_attrs(&output_1[4],MYSQL_TYPE_VAR_STRING,&data_6,6,&len_6,&null_6); char data_7[6]; unsigned long len_7; my_bool null_7; set_bind_attrs(&output_1[5],MYSQL_TYPE_VAR_STRING,&data_7,6,&len_7,&null_7); char data_8[3]; unsigned long len_8; my_bool null_8; set_bind_attrs(&output_1[6],MYSQL_TYPE_VAR_STRING,&data_8,3,&len_8,&null_8); char data_9[8]; unsigned long len_9; my_bool null_9; set_bind_attrs(&output_1[7],MYSQL_TYPE_DOUBLE,&data_9,8,&len_9,&null_9); char data_10[9]; unsigned long len_10; my_bool null_10; set_bind_attrs(&output_1[8],MYSQL_TYPE_VAR_STRING,&data_10,9,&len_10,&null_10); char data_11[9]; unsigned long len_11; my_bool null_11; set_bind_attrs(&output_1[9],MYSQL_TYPE_VAR_STRING,&data_11,9,&len_11,&null_11); char data_12[6]; unsigned long len_12; my_bool null_12; set_bind_attrs(&output_1[10],MYSQL_TYPE_VAR_STRING,&data_12,6,&len_12,&null_12); char data_13[4]; unsigned long len_13; my_bool null_13; set_bind_attrs(&output_1[11],MYSQL_TYPE_LONG,&data_13,4,&len_13,&null_13); char data_14[4]; unsigned long len_14; my_bool null_14; set_bind_attrs(&output_1[12],MYSQL_TYPE_LONG,&data_14,4,&len_14,&null_14); char data_15[4]; unsigned long len_15; my_bool null_15; set_bind_attrs(&output_1[13],MYSQL_TYPE_LONG,&data_15,4,&len_15,&null_15); char data_16[4]; unsigned long len_16; my_bool null_16; set_bind_attrs(&output_1[14],MYSQL_TYPE_LONG,&data_16,4,&len_16,&null_16); char data_17[4]; unsigned long len_17; my_bool null_17; set_bind_attrs(&output_1[15],MYSQL_TYPE_FLOAT,&data_17,4,&len_17,&null_17); char data_18[4]; unsigned long len_18; my_bool null_18; set_bind_attrs(&output_1[16],MYSQL_TYPE_FLOAT,&data_18,4,&len_18,&null_18); char data_19[4]; unsigned long len_19; my_bool null_19; set_bind_attrs(&output_1[17],MYSQL_TYPE_LONG,&data_19,4,&len_19,&null_19); char data_20[4]; unsigned long len_20; my_bool null_20; set_bind_attrs(&output_1[18],MYSQL_TYPE_LONG,&data_20,4,&len_20,&null_20); char data_21[4]; unsigned long len_21; my_bool null_21; set_bind_attrs(&output_1[19],MYSQL_TYPE_LONG,&data_21,4,&len_21,&null_21); char data_22[6]; unsigned long len_22; my_bool null_22; set_bind_attrs(&output_1[20],MYSQL_TYPE_VAR_STRING,&data_22,6,&len_22,&null_22); char data_23[6]; unsigned long len_23; my_bool null_23; set_bind_attrs(&output_1[21],MYSQL_TYPE_VAR_STRING,&data_23,6,&len_23,&null_23); char data_24[4]; unsigned long len_24; my_bool null_24; set_bind_attrs(&output_1[22],MYSQL_TYPE_LONG,&data_24,4,&len_24,&null_24); char data_25[4]; unsigned long len_25; my_bool null_25; set_bind_attrs(&output_1[23],MYSQL_TYPE_LONG,&data_25,4,&len_25,&null_25); char data_26[4]; unsigned long len_26; my_bool null_26; set_bind_attrs(&output_1[24],MYSQL_TYPE_FLOAT,&data_26,4,&len_26,&null_26); char data_27[4]; unsigned long len_27; my_bool null_27; set_bind_attrs(&output_1[25],MYSQL_TYPE_LONG,&data_27,4,&len_27,&null_27); char data_28[4]; unsigned long len_28; my_bool null_28; set_bind_attrs(&output_1[26],MYSQL_TYPE_LONG,&data_28,4,&len_28,&null_28); char data_29[4]; unsigned long len_29; my_bool null_29; set_bind_attrs(&output_1[27],MYSQL_TYPE_LONG,&data_29,4,&len_29,&null_29); char data_30[4]; unsigned long len_30; my_bool null_30; set_bind_attrs(&output_1[28],MYSQL_TYPE_LONG,&data_30,4,&len_30,&null_30); char data_31[4]; unsigned long len_31; my_bool null_31; set_bind_attrs(&output_1[29],MYSQL_TYPE_LONG,&data_31,4,&len_31,&null_31); char data_32[4]; unsigned long len_32; my_bool null_32; set_bind_attrs(&output_1[30],MYSQL_TYPE_LONG,&data_32,4,&len_32,&null_32); char data_33[4]; unsigned long len_33; my_bool null_33; set_bind_attrs(&output_1[31],MYSQL_TYPE_LONG,&data_33,4,&len_33,&null_33); char data_34[30]; unsigned long len_34; my_bool null_34; set_bind_attrs(&output_1[32],MYSQL_TYPE_VAR_STRING,&data_34,30,&len_34,&null_34); char data_35[4]; unsigned long len_35; my_bool null_35; set_bind_attrs(&output_1[33],MYSQL_TYPE_LONG,&data_35,4,&len_35,&null_35); char data_36[35]; unsigned long len_36; my_bool null_36; set_bind_attrs(&output_1[34],MYSQL_TYPE_VAR_STRING,&data_36,35,&len_36,&null_36); char data_37[35]; unsigned long len_37; my_bool null_37; set_bind_attrs(&output_1[35],MYSQL_TYPE_VAR_STRING,&data_37,35,&len_37,&null_37); char data_38[30]; unsigned long len_38; my_bool null_38; set_bind_attrs(&output_1[36],MYSQL_TYPE_VAR_STRING,&data_38,30,&len_38,&null_38); char data_39[30]; unsigned long len_39; my_bool null_39; set_bind_attrs(&output_1[37],MYSQL_TYPE_VAR_STRING,&data_39,30,&len_39,&null_39); char data_40[30]; unsigned long len_40; my_bool null_40; set_bind_attrs(&output_1[38],MYSQL_TYPE_VAR_STRING,&data_40,30,&len_40,&null_40); char data_41[30]; unsigned long len_41; my_bool null_41; set_bind_attrs(&output_1[39],MYSQL_TYPE_VAR_STRING,&data_41,30,&len_41,&null_41); char data_42[30]; unsigned long len_42; my_bool null_42; set_bind_attrs(&output_1[40],MYSQL_TYPE_VAR_STRING,&data_42,30,&len_42,&null_42); char data_43[30]; unsigned long len_43; my_bool null_43; set_bind_attrs(&output_1[41],MYSQL_TYPE_VAR_STRING,&data_43,30,&len_43,&null_43); char data_44[6]; unsigned long len_44; my_bool null_44; set_bind_attrs(&output_1[42],MYSQL_TYPE_VAR_STRING,&data_44,6,&len_44,&null_44); char data_45[6]; unsigned long len_45; my_bool null_45; set_bind_attrs(&output_1[43],MYSQL_TYPE_VAR_STRING,&data_45,6,&len_45,&null_45); char data_46[47]; unsigned long len_46; my_bool null_46; set_bind_attrs(&output_1[44],MYSQL_TYPE_VAR_STRING,&data_46,47,&len_46,&null_46); char data_47[4]; unsigned long len_47; my_bool null_47; set_bind_attrs(&output_1[45],MYSQL_TYPE_LONG,&data_47,4,&len_47,&null_47); char data_48[6]; unsigned long len_48; my_bool null_48; set_bind_attrs(&output_1[46],MYSQL_TYPE_VAR_STRING,&data_48,6,&len_48,&null_48); char data_49[4]; unsigned long len_49; my_bool null_49; set_bind_attrs(&output_1[47],MYSQL_TYPE_LONG,&data_49,4,&len_49,&null_49); char data_50[30]; unsigned long len_50; my_bool null_50; set_bind_attrs(&output_1[48],MYSQL_TYPE_VAR_STRING,&data_50,30,&len_50,&null_50); char data_51[8]; unsigned long len_51; my_bool null_51; set_bind_attrs(&output_1[49],MYSQL_TYPE_VAR_STRING,&data_51,8,&len_51,&null_51); char data_52[12]; unsigned long len_52; my_bool null_52; set_bind_attrs(&output_1[50],MYSQL_TYPE_VAR_STRING,&data_52,12,&len_52,&null_52); char data_53[8]; unsigned long len_53; my_bool null_53; set_bind_attrs(&output_1[51],MYSQL_TYPE_VAR_STRING,&data_53,8,&len_53,&null_53); char data_54[16]; unsigned long len_54; my_bool null_54; set_bind_attrs(&output_1[52],MYSQL_TYPE_VAR_STRING,&data_54,16,&len_54,&null_54); char data_55[16]; unsigned long len_55; my_bool null_55; set_bind_attrs(&output_1[53],MYSQL_TYPE_VAR_STRING,&data_55,16,&len_55,&null_55); char data_56[6]; unsigned long len_56; my_bool null_56; set_bind_attrs(&output_1[54],MYSQL_TYPE_VAR_STRING,&data_56,6,&len_56,&null_56); char data_57[3]; unsigned long len_57; my_bool null_57; set_bind_attrs(&output_1[55],MYSQL_TYPE_VAR_STRING,&data_57,3,&len_57,&null_57); char data_58[3]; unsigned long len_58; my_bool null_58; set_bind_attrs(&output_1[56],MYSQL_TYPE_VAR_STRING,&data_58,3,&len_58,&null_58); char data_59[8]; unsigned long len_59; my_bool null_59; set_bind_attrs(&output_1[57],MYSQL_TYPE_DOUBLE,&data_59,8,&len_59,&null_59); char data_60[3]; unsigned long len_60; my_bool null_60; set_bind_attrs(&output_1[58],MYSQL_TYPE_VAR_STRING,&data_60,3,&len_60,&null_60); char data_61[4]; unsigned long len_61; my_bool null_61; set_bind_attrs(&output_1[59],MYSQL_TYPE_LONG,&data_61,4,&len_61,&null_61); char data_62[3]; unsigned long len_62; my_bool null_62; set_bind_attrs(&output_1[60],MYSQL_TYPE_VAR_STRING,&data_62,3,&len_62,&null_62); char data_63[3]; unsigned long len_63; my_bool null_63; set_bind_attrs(&output_1[61],MYSQL_TYPE_VAR_STRING,&data_63,3,&len_63,&null_63); char data_64[3]; unsigned long len_64; my_bool null_64; set_bind_attrs(&output_1[62],MYSQL_TYPE_VAR_STRING,&data_64,3,&len_64,&null_64); char data_65[6]; unsigned long len_65; my_bool null_65; set_bind_attrs(&output_1[63],MYSQL_TYPE_VAR_STRING,&data_65,6,&len_65,&null_65); char data_66[6]; unsigned long len_66; my_bool null_66; set_bind_attrs(&output_1[64],MYSQL_TYPE_VAR_STRING,&data_66,6,&len_66,&null_66); char data_67[4]; unsigned long len_67; my_bool null_67; set_bind_attrs(&output_1[65],MYSQL_TYPE_LONG,&data_67,4,&len_67,&null_67); char data_68[4]; unsigned long len_68; my_bool null_68; set_bind_attrs(&output_1[66],MYSQL_TYPE_LONG,&data_68,4,&len_68,&null_68); char data_69[6]; unsigned long len_69; my_bool null_69; set_bind_attrs(&output_1[67],MYSQL_TYPE_VAR_STRING,&data_69,6,&len_69,&null_69); char data_70[25]; unsigned long len_70; my_bool null_70; set_bind_attrs(&output_1[68],MYSQL_TYPE_VAR_STRING,&data_70,25,&len_70,&null_70); char data_71[6]; unsigned long len_71; my_bool null_71; set_bind_attrs(&output_1[69],MYSQL_TYPE_VAR_STRING,&data_71,6,&len_71,&null_71); char data_72[14]; unsigned long len_72; my_bool null_72; set_bind_attrs(&output_1[70],MYSQL_TYPE_VAR_STRING,&data_72,14,&len_72,&null_72); char data_73[4]; unsigned long len_73; my_bool null_73; set_bind_attrs(&output_1[71],MYSQL_TYPE_LONG,&data_73,4,&len_73,&null_73); char data_74[3]; unsigned long len_74; my_bool null_74; set_bind_attrs(&output_1[72],MYSQL_TYPE_VAR_STRING,&data_74,3,&len_74,&null_74); char data_75[9]; unsigned long len_75; my_bool null_75; set_bind_attrs(&output_1[73],MYSQL_TYPE_VAR_STRING,&data_75,9,&len_75,&null_75); char data_76[4]; unsigned long len_76; my_bool null_76; set_bind_attrs(&output_1[74],MYSQL_TYPE_LONG,&data_76,4,&len_76,&null_76); char data_77[4]; unsigned long len_77; my_bool null_77; set_bind_attrs(&output_1[75],MYSQL_TYPE_LONG,&data_77,4,&len_77,&null_77); char data_78[47]; unsigned long len_78; my_bool null_78; set_bind_attrs(&output_1[76],MYSQL_TYPE_VAR_STRING,&data_78,47,&len_78,&null_78); char data_79[4]; unsigned long len_79; my_bool null_79; set_bind_attrs(&output_1[77],MYSQL_TYPE_LONG,&data_79,4,&len_79,&null_79); char data_80[8]; unsigned long len_80; my_bool null_80; set_bind_attrs(&output_1[78],MYSQL_TYPE_VAR_STRING,&data_80,8,&len_80,&null_80); char data_81[4]; unsigned long len_81; my_bool null_81; set_bind_attrs(&output_1[79],MYSQL_TYPE_LONG,&data_81,4,&len_81,&null_81); char data_82[4]; unsigned long len_82; my_bool null_82; set_bind_attrs(&output_1[80],MYSQL_TYPE_LONG,&data_82,4,&len_82,&null_82); char data_83[4]; unsigned long len_83; my_bool null_83; set_bind_attrs(&output_1[81],MYSQL_TYPE_LONG,&data_83,4,&len_83,&null_83); char data_84[4]; unsigned long len_84; my_bool null_84; set_bind_attrs(&output_1[82],MYSQL_TYPE_LONG,&data_84,4,&len_84,&null_84); char data_85[4]; unsigned long len_85; my_bool null_85; set_bind_attrs(&output_1[83],MYSQL_TYPE_LONG,&data_85,4,&len_85,&null_85); char data_86[4]; unsigned long len_86; my_bool null_86; set_bind_attrs(&output_1[84],MYSQL_TYPE_LONG,&data_86,4,&len_86,&null_86); char data_87[8]; unsigned long len_87; my_bool null_87; set_bind_attrs(&output_1[85],MYSQL_TYPE_VAR_STRING,&data_87,8,&len_87,&null_87); char data_88[sizeof(MYSQL_TIME)]; unsigned long len_88; my_bool null_88; set_bind_attrs(&output_1[86],MYSQL_TYPE_DATETIME,&data_88,36,&len_88,&null_88); char data_89[4]; unsigned long len_89; my_bool null_89; set_bind_attrs(&output_1[87],MYSQL_TYPE_LONG,&data_89,4,&len_89,&null_89); char data_90[4]; unsigned long len_90; my_bool null_90; set_bind_attrs(&output_1[88],MYSQL_TYPE_LONG,&data_90,4,&len_90,&null_90); char data_91[4]; unsigned long len_91; my_bool null_91; set_bind_attrs(&output_1[89],MYSQL_TYPE_LONG,&data_91,4,&len_91,&null_91); char data_92[4]; unsigned long len_92; my_bool null_92; set_bind_attrs(&output_1[90],MYSQL_TYPE_LONG,&data_92,4,&len_92,&null_92); char data_93[4]; unsigned long len_93; my_bool null_93; set_bind_attrs(&output_1[91],MYSQL_TYPE_LONG,&data_93,4,&len_93,&null_93); char data_94[4]; unsigned long len_94; my_bool null_94; set_bind_attrs(&output_1[92],MYSQL_TYPE_LONG,&data_94,4,&len_94,&null_94); char data_95[9]; unsigned long len_95; my_bool null_95; set_bind_attrs(&output_1[93],MYSQL_TYPE_VAR_STRING,&data_95,9,&len_95,&null_95); null_1 = 0; len_1 = 47; memcpy(data_1," PURCHASEORDERITEM2260 ",47); mysql_stmt_bind_param(stmt_1,param_1); m_count = mysql_warning_count(sess_1); M_EXPECT_EQUALS(0,m_count,0,NULL); m_ret = mysql_stmt_execute(stmt_1); M_EXPECT_EQUALS(0,m_ret,STMT,stmt_1); m_count = mysql_warning_count(sess_1); M_EXPECT_EQUALS(0,m_count,0,NULL); mysql_stmt_bind_result(stmt_1,output_1); m_count = mysql_warning_count(sess_1); M_EXPECT_EQUALS(0,m_count,0,NULL); m_ret = mysql_stmt_fetch(stmt_1); M_EXPECT_EQUALS(1,m_ret,STMT,stmt_1); m_count = mysql_warning_count(sess_1); M_EXPECT_EQUALS(0,m_count,0,NULL); m_err = mysql_stmt_errno(stmt_1); M_EXPECT_EQUALS( 2013,m_err,STMT,stmt_1 ); // Lost connection to MySQL server during query m_ret = mysql_stmt_free_result(stmt_1); M_EXPECT_EQUALS(0,m_ret,STMT,stmt_1); m_ret = mysql_stmt_reset(stmt_1); M_EXPECT_EQUALS(1,m_ret,STMT,stmt_1); m_err = mysql_stmt_errno(stmt_1); M_EXPECT_EQUALS( 2006,m_err,STMT,stmt_1 ); // MySQL server has gone away m_ret = mysql_stmt_close(stmt_1); M_EXPECT_EQUALS(0,m_ret,0,NULL); m_ret = mysql_rollback(sess_1); M_EXPECT_EQUALS(1,m_ret,SESS,sess_1); m_err = mysql_errno(sess_1); M_EXPECT_EQUALS( 2006,m_err,SESS,sess_1 ); // MySQL server has gone away m_ret = mysql_rollback(sess_1); M_EXPECT_EQUALS(1,m_ret,SESS,sess_1); m_err = mysql_errno(sess_1); M_EXPECT_EQUALS( 2006,m_err,SESS,sess_1 ); // MySQL server has gone away // ****** End of trace ****** } // Following code creates all tables needed to run this trace void create_tables( void ) { } #if 0 // Output of "show variables" # # Variable_name Value # auto_increment_increment 1 # auto_increment_offset 1 # automatic_sp_privileges ON # back_log 50 # basedir /usr1/mysql/ # binlog_cache_size 32768 # bulk_insert_buffer_size 8388608 # character_set_client latin1 # character_set_connection latin1 # character_set_database latin1 # character_set_results latin1 # character_set_server latin1 # character_set_system utf8 # character_sets_dir /usr1/mysql/share/mysql/charsets/ # collation_connection latin1_swedish_ci # collation_database latin1_swedish_ci # collation_server latin1_swedish_ci # completion_type 0 # concurrent_insert 1 # connect_timeout 5 # datadir /usr1/mysql/var/ # date_format %Y-%m-%d # datetime_format %Y-%m-%d %H:%i:%s # default_week_format 0 # delay_key_write ON # delayed_insert_limit 100 # delayed_insert_timeout 300 # delayed_queue_size 1000 # div_precision_increment 4 # engine_condition_pushdown OFF # expire_logs_days 0 # flush OFF # flush_time 0 # ft_boolean_syntax + -><()~*:""&| # ft_max_word_len 84 # ft_min_word_len 4 # ft_query_expansion_limit 20 # ft_stopword_file (built-in) # group_concat_max_len 1024 # have_archive NO # have_bdb NO # have_blackhole_engine NO # have_compress YES # have_crypt YES # have_csv NO # have_example_engine NO # have_federated_engine NO # have_geometry YES # have_innodb YES # have_isam NO # have_ndbcluster NO # have_openssl NO # have_query_cache YES # have_raid NO # have_rtree_keys YES # have_symlink YES # init_connect # init_file # init_slave # innodb_additional_mem_pool_size 20971520 # innodb_autoextend_increment 8 # innodb_buffer_pool_awe_mem_mb 0 # innodb_buffer_pool_size 824180736 # innodb_checksums ON # innodb_commit_concurrency 0 # innodb_concurrency_tickets 500 # innodb_data_file_path iberpln1:32000M;iberpln2:32000M;iberpln3:32000M:autoextend # innodb_data_home_dir /usr1/mysql/var/ # innodb_doublewrite ON # innodb_fast_shutdown 1 # innodb_file_io_threads 4 # innodb_file_per_table OFF # innodb_flush_log_at_trx_commit 1 # innodb_flush_method O_DIRECT # innodb_force_recovery 0 # innodb_lock_wait_timeout 2 # innodb_locks_unsafe_for_binlog OFF # innodb_log_arch_dir /usr2/mysql/var/ # innodb_log_archive OFF # innodb_log_buffer_size 8388608 # innodb_log_file_size 536870912 # innodb_log_files_in_group 2 # innodb_log_group_home_dir /usr2/mysql/var/ # innodb_max_dirty_pages_pct 90 # innodb_max_purge_lag 0 # innodb_mirrored_log_groups 1 # innodb_open_files 300 # innodb_support_xa ON # innodb_sync_spin_loops 20 # innodb_table_locks ON # innodb_thread_concurrency 20 # innodb_thread_sleep_delay 10000 # interactive_timeout 28800 # join_buffer_size 131072 # key_buffer_size 16777216 # key_cache_age_threshold 300 # key_cache_block_size 1024 # key_cache_division_limit 100 # language /usr1/mysql/share/mysql/english/ # large_files_support ON # large_page_size 0 # large_pages OFF # license GPL # local_infile ON # locked_in_memory OFF # log OFF # log_bin OFF # log_bin_trust_routine_creators OFF # log_error # log_slave_updates OFF # log_slow_queries OFF # log_warnings 1 # long_query_time 10 # low_priority_updates OFF # lower_case_file_system OFF # lower_case_table_names 0 # max_allowed_packet 1047552 # max_binlog_cache_size 4294967295 # max_binlog_size 1073741824 # max_connect_errors 10 # max_connections 100 # max_delayed_threads 20 # max_error_count 64 # max_heap_table_size 16777216 # max_insert_delayed_threads 20 # max_join_size 4294967295 # max_length_for_sort_data 1024 # max_relay_log_size 0 # max_seeks_for_key 4294967295 # max_sort_length 1024 # max_tmp_tables 32 # max_user_connections 0 # max_write_lock_count 4294967295 # multi_range_count 256 # myisam_data_pointer_size 6 # myisam_max_sort_file_size 2147483647 # myisam_recover_options OFF # myisam_repair_threads 1 # myisam_sort_buffer_size 67108864 # myisam_stats_method nulls_unequal # net_buffer_length 16384 # net_read_timeout 30 # net_retry_count 10 # net_write_timeout 60 # new OFF # old_passwords OFF # open_files_limit 1134 # optimizer_prune_level 1 # optimizer_search_depth 62 # pid_file /usr1/mysql/var/saber.pid # port 3306 # preload_buffer_size 32768 # protocol_version 10 # query_alloc_block_size 8192 # query_cache_limit 1048576 # query_cache_min_res_unit 4096 # query_cache_size 33554432 # query_cache_type ON # query_cache_wlock_invalidate OFF # query_prealloc_size 8192 # range_alloc_block_size 2048 # read_buffer_size 2093056 # read_only OFF # read_rnd_buffer_size 8384512 # relay_log_purge ON # relay_log_space_limit 0 # rpl_recovery_rank 0 # secure_auth OFF # server_id 1 # skip_external_locking ON # skip_networking OFF # skip_show_database OFF # slave_compressed_protocol OFF # slave_load_tmpdir /tmp/ # slave_net_timeout 3600 # slave_skip_errors OFF # slave_transaction_retries 10 # slow_launch_time 2 # socket /tmp/mysql.sock # sort_buffer_size 2097116 # sql_mode # sql_notes ON # sql_warnings ON # storage_engine MyISAM # sync_binlog 0 # sync_frm ON # sync_replication 0 # sync_replication_slave_id 0 # sync_replication_timeout 10 # system_time_zone CEST # table_cache 512 # table_lock_wait_timeout 50 # table_type MyISAM # thread_cache_size 8 # thread_stack 196608 # time_format %H:%i:%s # time_zone SYSTEM # timed_mutexes OFF # tmp_table_size 33554432 # tmpdir # transaction_alloc_block_size 8192 # transaction_prealloc_size 4096 # tx_isolation REPEATABLE-READ # updatable_views_with_limit YES # version 5.0.16-nightly-20051017-debug # version_comment Source distribution # version_compile_machine i686 # version_compile_os pc-linux-gnu # wait_timeout 28800 # #endif // Output of "show variables"