iarspider писал(а):
STR_TO_DATE(строка, формат). Попробовал вот так:
INSERT INTO user (`Name`, `Fam`, `Age`, STR_TO_DATE('date', '%d.%m.%Y')) VALUES ('%1', '%2', '%3', '%4')
- невыходит
------------ Дoбавленo в 21.11:
Вот переработанная схема:
Add(MainForm,2953706,7,7)
{
Width=562
Height=434
Caption="Редактирование БД"
Icon=[ZIPBE08000078DA6596093C94F91FC73FE45F52AF7637FC93C89086CA51B63651C8B656CE55B28E74E9707638CA519A41A2A263C99046CA9DA392D8D48656A5328B6CBB548E15C639AE19839979F619D6DFFEEB33AFCFEB9999F7F7F9FEBECFF39DEFEF1940827C512898549634F05FF2A8495AFC95096909484F4129CC48E21F932208028209218EEF8A46A47F1C22F64481713C11671DC370D53D1A57ED827063E749A4D9F822C7702F1E6C76C3AFABED51B77C2B5A1537E19DA2314664B431345F17030BF4C096D30701750825A918FF8F2678D2AB202484A81C788EDC81FB08664781C6B98473C475B40BBB1030741E1E7527715A100F7AD74FD837180A9F8F91707AE80D9FF711881BCFC285C6641C1E89C5FE261A4E11C9A08D24C3EF8F6828682B83D6928072010B016309F06FBF82E4CA0CBC19FB8013649CEF501C86845C78765F866B7528249464B0FB69384C6276035FCDC10F5901F06DBF09ED6396D8511585BDBF5D86555938FAF843181DE3631E85BC9B6AB2B0AF4F828C011558380F0E2F93B1D8521FDF5526626F433E307736B6DEB908AAE906D879EE83E2D75A58AAB312CC3BB9586F6B01C9C5F258FFAA085B8BD2A0577803562F8A61D6CC825BCF7B1C09A3615DDBEF70186C079D5505194D0D9871FB61D9DB01170E1B878413901612905054843C793420AD5F570FC7B1719C20DF47F04671BA9F83F3090928282EC6308F0711D94FA1480481500895090216E3041823A3C824E3F1D5426CF8D8078B3E2E823AFBF15040A08AB464AF08327D04E47A0928F41358DAD88345EBD623A0878B33FD5C84FEF214905F84591D42C87792DDED21B0A99BC08E6775F0E208E0FBFA2DA4DEF1B1A04D84A5ED04CC1B3998FF5E048985F2906B22A0DB4CA0BEF11DF06602732BBA30AF5E88594B2850ACE541A99180E68B2E9CF9B31B52AFC630EBF130E458640D35A42BFAB1FCE7BFB0EE7711D6E4B230FB5E370E663D42620B8FAC4789EC8702142BC8FC898F219DD606D91C36B4C8CFF30A26205B4260517223A2926EC2B2B01D76574BF057071BDC513E340A092807E541215304B51C11F4629E433E990FA34C0EE29F77A1B4BC12CB985CAC4C1941687E2DD49309AC4915E1FBB85AE00B6550E205D0D8198385D102C846F1201FC985C245F2FE1DAB8172D40028E747A11AC906F5B208EE774691533B8A098110B34FF020174E408936008B78368C8E17C13A241F8B03BB70EE5E2BE61F6AC1DCC5DAD0A3B7C32322034B0209287AB7817A720CABF7E5C0EB3A1B9AFE5D58133A8C2F0F08B0C0F609D678D5C03FBE1EB29655503E2880AAEB9FD0706343DFAF175F6EE360A96337D4DDB8D878B80316010D70F5BE0E1A3D6572EEED6604CC12B6B4B60AC91DC1EE3301AD25E96909893167E2D2D22BE6FC7F04ECD092CB4C8CBF79BFFC97A2A4A4D888E492991C24040A9999E56FFF78DDDCD0D0FC96DD5D9E1A9ED68A192A4C4F7D39C2ADB877E98AEBA5732D7D5D5DDD2FE3C32A30B52EA9F4E23E41CF1357EB6F3534340C4D5C7CB2EB079A32A60226F183E1AAD32EDF6929ABEBE8A82BAB52BF753E70ABEF436A58E7142FBCDED376CC568BAAA447D9606646D15BB18C6A1D5CC965855F8078F58AB4FA7BFB6CB5D497484EEB1B95E5B647DBC68B3D6E8B797AD940B6AD9AFA379233A2A8683947F13EC478882F9CD9F4C4D950F97FF8DA1E47FB671495B5793C4EB147A91D72EF8EFD66A2AC348D9F6DDFB8D5CADC574F75DBC38F35E191405A4D8B9BA13A65FAECED4EABCDCD37AE5EA7B2E9400987E905309BF2761BAE9094F47F24E6BE564EE60E0EE61BED57A81DCCE2177BC9B42674DC7255236BF775F423B9BDB1B1E335BF1DE68EEA9ABB2E0F3EF092AA60BE3EBA5393E47B1C7CC5DCCACA5E1CB57DE5AA5D21BDC55E9D150983575DC5FC919F99A4E4634786E7FE3DBE3B8CB7ABAFDD15DC5C1C282A4DE097F8A8ADFC7EAABC4767190C869D9D15C3467FB37B6513D35B0AE1EFEB7D36E9FE38C57F2E604CCACA48FB87D7A3AC186FE0C2D3E127DB548D9E4D5EDDD99414274F06A3DA52ED6BD7A69157B1A1C04F197C419EAEA6A9EFB56B3F3A7AB6B77B3A3939791A2DB338F5E25566D025E076F887896817034DD3FD2905292905A4AA9D4CC9EA72FA73028F881F686177C7C8F6AAEA1B5916545733AC180C4B239DCDCEDED9AC78F75BE2FE657BB1B895879C0DB4A926A636676D6C8C745718EC8CA2B73DF50E114DFE3EC2236A072B22F75A5057692F5BABBF5E45C7DA35B8B1E1D71B215598E49D1E4C0EBFFE7EB68B8BB5C5962D5BAC6F0F0EF57697C59343FBCF64947AC415B3F97C41FED1E063076F96D4B19B9EDF8D9DC6E288D2C0C08C37EC91D1A1A1B6875D7DDDACA2D8205A3EFE3D5CA7BC036352EF96B3584DACB2CCD4A0607AD527139677D8FD70D0C5A4A49C8B414768F4CA4F47942C537425388446A7D369F9559F0D303ED10C21F82A04512641EE04204480311F5021FDC50030A7857419B92B884D23FF2DFCCB9FE9132E317D5ECB541E713E715E63728DD3E4D38C5C730E21D6DF2C2A736C]
}
Add(Button,8999394,49,49)
{
Left=6
Top=5
Width=110
Caption="Подключится к БД"
link(onClick,16216464:doEvent1,[])
}
Add(dbMySQL,6199375,168,42)
{
Login="root"
DBName="test_bb"
link(onError,11461195:doMessage,[])
}
Add(Edit,13335318,210,301)
{
Left=5
Top=35
Width=130
Text="Имя"
}
Add(Button,3587904,49,546)
{
Left=145
Top=110
Width=85
Caption="Добавить"
Data=String(select id AS ID, name AS Имя, fam AS Фамилия, age AS Возраст, DATE_FORMAT(date,'%d.%m.%Y') AS Дата from user)
link(onClick,11588217:doEvent1,[])
}
Add(Button,3326148,7,112)
{
Left=435
Top=5
Width=110
Caption="Прочитать таблицу"
Data=String(select id AS ID, name AS Имя, fam AS Фамилия, age AS Возраст, DATE_FORMAT(date,'%d.%m.%Y') AS Дата from user)
link(onClick,15158004:doEvent1,[])
}
Add(StringTable,4309656,294,28)
{
Left=5
Top=138
Width=545
Height=255
Columns=#2:ID|3:Имя|7:Фамилия|7:Возраст|4:Дата|
Redaction=1
StaticColumn=0
Point(StringTable)
Point(doEnsureVisible)
}
Add(dbMySQL_Query,8258155,119,105)
{
link(onResult,13153837:doShow,[])
link(onError,3180825:doMessage,[(202,118)(202,195)])
link(dbHandle,14321171:Var1,[(125,90)])
}
Add(dbMySQL_Exec,12880173,168,546)
{
link(onError,3136033:doMessage,[])
link(dbHandle,14321171:Var2,[])
link(QueryText,6860758:GetData,[(181,530)(209,530)])
}
Add(GetDataEx,14321171,161,81)
{
link(Data,6199375:dbHandle,[])
}
Add(EventFromData,6860758,203,490)
{
link(onEvent,7843577:doString,[])
}
Add(Message,11461195,252,42)
{
Caption="Ошибка подключения"
}
Add(Message,3180825,217,189)
{
Caption="Ошибка чтения"
}
Add(Message,3136033,252,560)
{
Caption="Ошибка записи"
}
Add(Hub,16216464,126,49)
{
link(onEvent1,6199375:doOpen,[(154,55)(154,48)])
link(onEvent2,6199375:doSelectDB,[])
}
Add(dbMySQL_ShowQuery,13153837,217,105)
{
link(Rows,8258155:Rows,[(223,90)(181,90)(181,190)(125,190)])
link(Fields,8258155:Fields,[(230,97)(190,97)(190,183)(132,183)])
link(StringTable,4309656:StringTable,[(237,90)(314,90)])
}
Add(Edit,4829398,252,301)
{
Left=5
Top=60
Width=130
Text="Фамилия"
}
Add(Edit,9813523,294,301)
{
Left=5
Top=85
Width=130
Text="Возраст"
}
Add(Hub,15158004,84,112)
{
InCount=3
link(onEvent1,8258155:doQuery,[(108,118)(108,111)])
link(onEvent2,361655:doText,[(207,125)(207,146)])
}
Add(Hub,11588217,105,546)
{
link(onEvent1,12880173:doExec,[])
link(onEvent2,15158004:doEvent2,[(131,559)(131,246)(62,246)(62,125)])
}
Add(Button,5596024,343,462)
{
Left=435
Top=33
Width=110
Caption="Поиск"
Data=String(select * from user)
link(onClick,2369053:doString,[])
}
Add(GetDataEx,16429757,203,421)
{
link(Data,14987138:Var2,[])
}
Add(GetDataEx,6548777,245,411)
{
link(Data,9354256:Var2,[])
}
Add(GetDataEx,12437419,287,401)
{
link(Data,15883626:Var2,[])
}
Add(StyleXP,9790873,7,49)
{
}
Add(Label,361655,294,140)
{
Left=518
Top=112
Width=35
Caption="0"
link(Text,4309656:Count,[])
}
Add(Label,13477847,336,140)
{
Left=433
Top=112
Width=80
Caption="Всего записей:"
}
Add(Edit,3338315,343,301)
{
Left=5
Top=110
Width=130
Text=""
}
Add(GetDataEx,10345332,336,427)
{
link(Data,11518225:Var2,[])
}
Add(StrPart,12887836,406,112)
{
Char=";"
link(onSplit,14315850:doSplit,[])
link(onPart,7005056:doText,[(452,125)(452,307)])
link(Str,4309656:Select,[(412,100)(307,100)])
}
Add(StrPart,14315850,462,112)
{
Char=";"
link(onSplit,14112336:doSplit,[])
link(onPart,13335318:doText2,[(504,125)(504,265)(199,265)(199,314)])
}
Add(StrPart,14112336,518,112)
{
Char=";"
link(onSplit,13061915:doSplit,[])
link(onPart,4829398:doText2,[(571,125)(571,275)(246,275)(246,314)])
}
Add(StrPart,13061915,581,112)
{
Char=";"
link(onSplit,3338315:doText2,[(629,118)(629,294)(338,294)(338,314)])
link(onPart,9813523:doText2,[(621,125)(621,285)(290,285)(290,314)])
}
Add(FormatStr,2369053,427,462)
{
DataCount=4
Mask="SELECT id AS ID, name AS Имя, fam AS Фамилия, age AS Возраст, DATE_FORMAT(date,'%d.%m.%Y') AS Дата FROM user WHERE (name Like "%1%") AND (fam Like "%2%") AND (age Like "%3%") AND (date Like "%4%")"
link(onFString,15158004:doEvent3,[(470,468)(470,234)(71,234)(71,132)])
link(Str1,16429757:Var3,[(433,430)])
link(Str2,6548777:Var3,[(440,420)])
link(Str3,12437419:Var3,[(447,410)])
link(Str4,10345332:Var3,[(454,436)])
}
Add(FormatStr,7843577,266,490)
{
DataCount=4
Mask="INSERT INTO user (`Name`, `Fam`, `Age`, `date`) VALUES ('%1', '%2', '%3', '%4')"
link(onFString,6860758:doData,[(308,496)(308,472)(191,472)(191,496)])
link(Str1,16429757:Var2,[(272,441)(216,441)])
link(Str2,6548777:Var2,[(279,434)(258,434)])
link(Str3,12437419:Var2,[(286,452)(300,452)])
link(Str4,10345332:Var2,[(293,460)(349,460)])
}
Add(InfoTip,3139768,308,511)
{
Info=#46:Для работы схемы необходима база данных MySQL:|15:Host: localhost|11:Login: root|9:Password:|15:DBName: test_bb|42:TableName: user (id, Name, Fam, AGE, Date)|
Font=[MS Sans Serif,10,0,0,1]
Transparent=1
Width=300
Height=120
}
Add(Button,2007050,350,49)
{
Left=435
Top=59
Width=110
Caption="Редактировать"
link(onClick,12887836:doSplit,[(390,55)(390,118)])
}
Add(FormatStr,13172279,546,462)
{
DataCount=5
Mask="UPDATE user SET ('id', `Name`, `Fam`, `Age`, 'Date') VALUES ('%1', '%2', '%3', '%4', '%5')"
link(Str1,7005056:Caption,[(552,446)(503,446)])
link(Str2,14987138:Var3,[(559,390)])
link(Str3,9354256:Var3,[(566,380)])
link(Str4,15883626:Var3,[(573,370)])
link(Str5,11518225:Var3,[(580,360)])
}
Add(Button,9037373,483,462)
{
Left=435
Top=88
Width=110
Caption="Сохранить"
link(onClick,13172279:doString,[])
}
Add(Label,7005056,497,301)
{
Left=400
Top=92
Width=30
Height=17
Caption="0"
}
Add(GetDataEx,14987138,203,381)
{
link(Data,13335318:Text,[])
}
Add(GetDataEx,9354256,245,371)
{
link(Data,4829398:Text,[])
}
Add(GetDataEx,15883626,287,361)
{
link(Data,9813523:Text,[])
}
Add(GetDataEx,11518225,336,351)
{
link(Data,3338315:Text,[])
}
Add(Label,1843509,539,301)
{
Left=354
Top=92
Width=45
Caption="Строка:"
}